EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Waveform Runtime Database Access Error
From: Ralph Lange <[email protected]>
To: EPICS Tech Talk <[email protected]>
Cc: Tobin R Weber <[email protected]>
Date: Fri, 9 Feb 2018 09:03:46 +0100
Hi Toby,

The sixth argument to dbGetField() is described in the manual (App developers) as:

The pfl argument is for use by the Channel Access monitor routines. All other users must pass in NULL.

You are passing in a pointer to an uninitialized local integer variable.
Depending on the random value of that variable, and the memory corruption that your first dbGetField() call in thisWorks() produces, you might get a working second call, an error message or a core dump.

Cheers,
~Ralph


On Fri, Feb 9, 2018 at 12:44 AM, Tobin R Weber <[email protected]> wrote:
Hello EPICS colleagues,

I have been using a state machine to call C functions that pass PV data to an MDSplus and PSQL database. I use "dbNameToAddr", "dbGetField" and "dbPutField" calls to move data. dbNameToAddr gets called every time I do a Get/Put. I'm also using waveform records to pass comment information that I want to be more then 40 characters, the stringout limit. I'm concerned I'm dong something with unexpected side effects, and I've seen one issue that has me seriously concerned.

Basically, with this record:

record(waveform, "PreShot") {
  field(NELM, "500")
  field(FTVL, "CHAR")
}

And this function,

static void thisDoesNOTWork() {

  long numRequestsWF = 500;
  long getOptions = 0;
  int getMon;
  struct dbAddr dbEntry = 0;
  char postShotComment[500];

  dbNameToAddr("PreShot", &dbEntry);
  dbGetField(&dbEntry, DBF_CHAR, postShotComment, &getOptions, &numRequestsWF, &getMon);

  return;
}

I get the following error after the "dbGetField()" call:

"Illegal Database Request Type PV: PreShot.VAL error detected in routine: dbGet: Request type is 1"

But, when I include a longout record,

record(waveform, "PreShot") {
  field(NELM, "500")
  field(FTVL, "CHAR")
}

record(longout, "ShotNumber") {
  field(VAL, "2")
  field(PINI, "YES")
  field(SCAN, "Passive")
  field(OMSL, "supervisory")
}

And add this database access to my function,

static void thisWorks() {

  long numRequestsWF = 500;
  long getOptions = 0;
  int getMon;
  struct dbAddr dbEntry;
  char postShotComment[500];
  long shotNumber = 0;
  long numRequests = 1;

  dbNameToAddr("ShotNumber.VAL", &dbEntry);
  dbGetField(&dbEntry, DBF_LONG, &shotNumber, &getOptions, &numRequests, &getMon);

  dbNameToAddr("PreShot", &dbEntry);
  dbGetField(&dbEntry, DBF_CHAR, postShotComment, &getOptions, &numRequestsWF, &getMon);

  return;
}


Everything works, and I get no error.

Does anyone see an issue with the run time database access in the first function call? Is there some part of the dbAddr struct that isn't getting set properly for the dbNameToAddr call to a Waveform record? In general, I'm also concerned about this type of run time database access. I'm doing it in many places. Is it okay to call dbNameToAddr multiple times? Can I use the same struct dbAddr for multiple dbNameToAddr calls?

Thank you very much for everyone's help and support. This is running a z-pinch machine at the University of Washington, and we are right in the middle of a run campaign. I don't know how we would have done all this without EPICS!

Toby




--
Tobin Weber
University of Washington
Department of Aeronautics and Astronautics
Research Scientist


References:
Waveform Runtime Database Access Error Tobin R Weber

Navigate by Date:
Prev: Waveform Runtime Database Access Error Tobin R Weber
Next: FLNK length limit Hinko Kocevar
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Waveform Runtime Database Access Error Tobin R Weber
Next: FLNK length limit Hinko Kocevar
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
ANJ, 09 Feb 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·