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  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: EPICS R3.14.11, sequencer 2.0.12 crash on device support write error
From: "Kasemir, Kay" <[email protected]>
To: EPICS Tech-Talk <[email protected]>
Date: Wed, 07 Jul 2010 11:10:36 -0400
Hello:

I ran into the following issue upgrading from EPICS R3.14.8.2 to R3.14.11.
In case others see this, here's a description and workaround.

It starts with device support that detects if the underlying I/O hardware is
not present.

For the AO record, this device support write_ao() routine used to
1) Put the record into alarm
   recGblSetSevr(rec, WRITE_ALARM, INVALID_ALARM);
2) return some error code like 1 or 2.

The return code is critical for the following.

According to the record reference manual, it's OK to return 0 or anything
else for errors:
"When finished, write_ao should ... return one the following values:
 0: Success.
 other: Error.
"

So far, that had worked OK. If there's a write error, the record goes into
WRITE/INVALID. In addition, a Channel Access client sees an error like this:

caput MyRecord 1
CA.Client.Exception...............................................
    Warning: "Channel write request failed"
    Context: "op=1, channel= MyRecord , type=DBR_DOUBLE, count=1, ctx="
MyRecord""
    Source File: ../oldChannelNotify.cpp line 159
    Current Time: Wed Jul 07 2010 08:53:52.816914000



After switching from R3.14.8.2 to R3.14.11, however, sequencer code that
writes to such channels would crash:

0x6474e0 (name_of_my_sequence): Unhandled C++ exception resulted in call to
terminate
Thread name_of_my_sequence (0x6474e0) suspended

This is on vxWorks 6.7 on an MVME5500. Stack trace:
>tt 0x6474e0
0x00137398 vxTaskEntry  +0x48 : 0x014ef464 ()
0x014ef4d0 epicsThreadCreate+0x1e4: sequencer ()
0x014284f4 sequencer    +0x19c: 0x0142817c ()
0x0142817c ss_entry     +0x498: 0x013ff814 ()
0x013ff8d4 name_of_my_sequenceRegistrar+0x138: seq_pvPut ()
0x01425900 seq_pvPut    +0xb0 : 0x0142b54c ()
0x0142b598 pvVarPutNoBlock+0x50 : caVariable::putNoBlock(pvType, int,
pvValue *) ()
0x0142e100 caVariable::putNoBlock(pvType, int, pvValue *)+0x104:
ca_array_put (0)
0x014a5cb8 ca_array_put +0xa4 : dbChannelIO::write(epicsGuard<epicsMutex> &,
unsigned int, unsigned long, const void  ()
0x014851c8 dbChannelIO::write(epicsGuard<epicsMutex> &, unsigned int,
unsigned long, const void +0x1cc: __cxa_throw ()
0x00126ac0 __cxa_throw  +0x70 : std::terminate() ()
0x0012699c __cxxabiv1::__unexpected(void (*)())+0x0  :
__cxxabiv1::__terminate(void (*)()) ()
0x00126968 __cxxabiv1::__terminate(void (*)())+0x18 : cplusTerminate() ()
0x00145e70 cplusTerminate()+0x50 : taskSuspend ()

As far as I could track this down in the source code, the sequencer's
caVariable::putNoBlock calls ca_array_put (pv/pvCa.cc line 292).

ca_array_put calls pChan->io.write (ca/oldChannelNotify.cpp line 487).

That in turn calls the database and finally my write_ao() routine.

Something must throw an exception in response to the non-zero return code of
my write_ao. I don't understand why that causes a problem, because
ca_array_put catches all sorts of exceptions, including a "catch ( ... )" in
ca/oldChannelNotify.cpp line 522.

Still, the sequencer crashes with an unhandled C++ exception as long as the
write_ao of the record's device support returns a non-zero status code.

I stopped trying to debug it, and instead changed my device support to
always return 0 for OK, because the WRITE/INVALID status/severity already
reports the underlying I/O hardware problem to some extend.

Thanks,
Kay



Replies:
RE: EPICS R3.14.11, sequencer 2.0.12 crash on device support write error Jeff Hill

Navigate by Date:
Prev: Re: Thread model for EPICS on ARM CPU Rod Nussbaumer
Next: RE: EPICS R3.14.11, sequencer 2.0.12 crash on device support write error Jeff Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS on ARM (continued) Rod Nussbaumer
Next: RE: EPICS R3.14.11, sequencer 2.0.12 crash on device support write error Jeff Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 27 Oct 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·