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  2018  2019  2020  2021  2022  <20232024  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  2018  2019  2020  2021  2022  <20232024 
<== Date ==> <== Thread ==>

Subject: Re: Problem writing enum entries from asyn driver (areaDetector) ino a databse record.
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: Jörn Dreyer <j.dreyer at hzdr.de>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Mon, 21 Aug 2023 13:40:07 +0000
Hi Jörn,

You're right, that is a bug.  I have fixed it on the master branch on Github.

Note that NDPluginFile is the only plugin driver that allows passing the interfaceMask and interruptMask to the constructor.  So the problem does not exist for other plugins.

Thanks,
Mark



From: Jörn Dreyer <j.dreyer at hzdr.de>
Sent: Monday, August 21, 2023 2:17 AM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>; Mark Rivers <rivers at cars.uchicago.edu>
Subject: Re: Problem writing enum entries from asyn driver (areaDetector) ino a databse record.
 
HI Mark,

I did a printout of the configuration of my asyn port:

FileOpenPMD1 multiDevice:No canBlock:Yes autoConnect:Yes
    enabled:Yes connected:Yes numberConnects 1
    nDevices 0 nQueued 0 blocked:No
    asynManagerLock:No synchronousLock:No
    exceptionActive:No exceptionUsers 1 exceptionNotifys 0
    traceMask:0x1 traceIOMask:0x0 traceInfoMask:0x1
    interposeInterfaceList
        asynOctet pinterface 0x7f992f1a4440 drvPvt 0x1e5b610
    interfaceList
        asynCommon pinterface 0x7f992f1a4cf0 drvPvt 0x1e61810
        asynDrvUser pinterface 0x7f992f1a4a80 drvPvt 0x1e61810
        asynOctet pinterface 0x7f992f1a4bc0 drvPvt 0x1e61810
        asynInt32 pinterface 0x7f992f1a4cc0 drvPvt 0x1e61810
        asynFloat64 pinterface 0x7f992f1a4c20 drvPvt 0x1e61810
        asynInt32Array pinterface 0x7f992f1a4b60 drvPvt 0x1e61810
        asynGenericPointer pinterface 0x7f992f1a4ae0 drvPvt 0x1e61810

My constructor calls its base calls as follows:

: NDPluginFile(portName, queueSize, blockingCallbacks,
                 NDArrayPort, NDArrayAddr, 1,
                 0, 0, asynGenericPointerMask | asynEnumMask,
asynGenericPointerMask | asynEnumMask,
                 ASYN_CANBLOCK, 1, priority, stackSize, 1, true),
m_series(NULL), m_numBackends(0)

so, asynEnumMask should be set.

Looking at NDPluginFile.cpp I found the reason:

>NDPluginFile::NDPluginFile(const char *portName, int queueSize, int
>blockingCallbacks,
>                           const char *NDArrayPort, int NDArrayAddr, int
>maxAddr,
>                           int maxBuffers, size_t maxMemory, int
>interfaceMask, int interruptMask,
>                           int asynFlags, int autoConnect, int priority, int
>stackSize, int maxThreads,
>                           bool compressionAware)
>
>    /* Invoke the base class constructor.
>     * We allocate 1 NDArray of unlimited size in the NDArray pool.
>     * This driver can block (because writing a file can be slow), and it is
>not multi-device.
>     * Set autoconnect to 1.  priority and stacksize can be 0, which will use
>defaults. */
>    : NDPluginDriver(portName, queueSize, blockingCallbacks,
>                     NDArrayPort, NDArrayAddr, maxAddr, maxBuffers,
>maxMemory,
>                     asynGenericPointerMask, asynGenericPointerMask,
----------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The masks are hardcoded here!!
>                     asynFlags, autoConnect, priority, stackSize, maxThreads,
>compressionAware),
>    pCapture(NULL)
>{

The interfaceMask and the interruptMask are just not passed on to the next
layer! Seems to be a bug.

Regards,

Jörn

Am Freitag, 18. August 2023, 15:10:39 CEST schrieb Mark Rivers via Tech-talk:
> Hi
>
> The problem is actually that the first argument to interruptStart, pasynPvt,
> is 0.  That is why pinterruptBase is 0.
>
> static asynStatus interruptStart(void *pasynPvt,ELLLIST **plist)
> {
>     interruptBase  *pinterruptBase = (interruptBase *)pasynPvt;
>
> This is line 3363 in asynPortDriver.cpp
>
>     pasynManager->interruptStart(this->asynStdInterfaces.enumInterruptPvt,
> &pclientList);
>
> That means that this->asynStdInterfaces.enumInterruptPvt is null, but it
> should not be.
>
> If you can execute a command before it crashes then do this:
>
> asynReport 5 "portName"
>
> where portName is the name of your asyn port.  That will print out the
> values of all of the interruptPvt pointers.
>
> It is acting like you did not put asynEnum in the interruptMask in the
> asynPortDriver constructor, but you said you did.
>
> Mark
>
>
> ________________________________
> From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Jörn Dreyer via
> Tech-talk <tech-talk at aps.anl.gov> Sent: Friday, August 18, 2023 7:47 AM
> To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
> Subject: Problem writing enum entries from asyn driver (areaDetector) ino a
> databse record.
>
> Hello,
>
> I have a strange problem in a areaDetector plugin I currently writing. I
> want to fill a mbbo record with the strings from an std::vector I get from
> a library function. I copy the elements of the std::vestor to a pre
> allocated char** array and fill values and severities arrays. In my
> writeInt32 function I do a call to
>
> doCallbacksEnum(strings, values, severities, nEntries, function, 0)
>
> This leads to a crash with SIGSEGV. After recompiling my code and the asyn
> module with debug symbols I managed to track down the problem to an
> uninitialized variable in asynManager:
>
> #0  0x00007ffff7f33417 in interruptStart (pasynPvt=0x0,
> plist=0x7fffc37f9568) at ../../asyn/asynDriver/asynManager.c:2438
> 2438        port *pport = pinterruptBase->pport;
>
> looking at pinterruptBase it returns 0x0.
> The backtrace leading to this crash is:
>
> #0  0x00007ffff7f33417 in interruptStart (pasynPvt=0x0,
> plist=0x7fffc37f9568) at ../../asyn/asynDriver/asynManager.c:2438
> #1  0x00007ffff7f56b57 in asynPortDriver::doCallbacksEnum(char**, int*,
> int*, unsigned long, int, int)
>     (this=0x745a90, strings=0x73f4b0, values=0x744000, severities=0x744060,
> nElements=7, reason=80, address=0)
>     at ../../asyn/asynPortDriver/asynPortDriver.cpp:3363
> #2  0x00007ffff7df1e4b in NDFileOpenPMD::writeInt32(asynUser*, int)
>     (this=<optimized out>, pasynUser=<optimized out>, value=<optimized out>)
> at ../NDFileOpenPMD.cpp:192
>
> My driver is derived from NDFilePlugin as:
>
> NDPluginFile(portName, queueSize, blockingCallbacks,
>                  NDArrayPort, NDArrayAddr, 1,
>                  0, 0, asynGenericPointerMask | asynEnumMask,
> asynGenericPointerMask | asynEnumMask,
>                  ASYN_CANBLOCK, 1, priority, stackSize, 1, true)
>
> So in my understanding it should be configured to be able to use enum
> functions.
>
> Can anybody help me to figure out what I'm doing wrong?  I did a crosscheck
> with other areaDetector plugin drivers if there is a special setting missing
> and also looked at the examples from asy, but could not figur out whjat is
> wrong in my code.
>
> Regards,
>
> Jörn Dreyer




References:
Problem writing enum entries from asyn driver (areaDetector) ino a databse record. Jörn Dreyer via Tech-talk
Re: Problem writing enum entries from asyn driver (areaDetector) ino a databse record. Mark Rivers via Tech-talk
Re: Problem writing enum entries from asyn driver (areaDetector) ino a databse record. Jörn Dreyer via Tech-talk

Navigate by Date:
Prev: Reminder: EPICS documentation community survey NICOLE Remi via Tech-talk
Next: Trouble with pva:// on Phoebus with often-restarted IOCs Leblanc, Gregory via Tech-talk
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  2018  2019  2020  2021  2022  <20232024 
Navigate by Thread:
Prev: Re: Problem writing enum entries from asyn driver (areaDetector) ino a databse record. Jörn Dreyer via Tech-talk
Next: Job Opportunity at HZDR Meyer, Markus via Tech-talk
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  2018  2019  2020  2021  2022  <20232024 
ANJ, 21 Aug 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·