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 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
<== Date ==> <== Thread ==>

Subject: libca bug?
From: Bruno Martins via Tech-talk <tech-talk@aps.anl.gov>
To: tech-talk <tech-talk@aps.anl.gov>
Date: Fri, 3 May 2019 15:43:22 -0400
Hi all,

This is a bug (or is it?) that involves libca, pyDevSup and pyepics. We use pyDevSup on some of our IOCs. On most of them, we also want to use pyepics.

Everything works fine until we issue exit() on the IOC shell. When that happens, the IOC segfaults.

I believe that the following are true:

  -  pyepics dynamically loads libca, which ends up being the same instance as the one loaded by the IOC itself (for dbCa)
  -  pyepics does not share the same context with dbCa if it is run on its own thread and the proper context_create call is performed
  -  Even when not sharing libca contexts, the variable caClientCallbackThreadId ends up being the same for pyepics and dbCa.
  -  cacExitHandler runs when the IOC is exiting and sets caClientCallbackThreadId=0 [1]
  -  Any subsequent libca call by pyepics (during its cleanup) that tries to use caClientCallbackThreadId will segfault.

Possible solutions:

  -  Register pyepics' finalize_libca with pyDevSup's addHook('AtIocExit',...), but this runs after dbCa cleanup. Can it be made to run before? Can there be a 'BeforeIocExit' hook?
  -  Remove caClientCallbackThreadId=0 in libca. I have no idea about the implications.
  -  Something else?

Of course, I understand that both the IOC itself and pyepics kind of expect to be the sole users of libca in their processes. This assumption doesn't hold when I have pyepics inside a IOC.





Thanks!

Bruno

Replies:
Re: libca bug? Michael Davidsaver via Tech-talk
Re: libca bug? Matt Newville via Tech-talk

Navigate by Date:
Prev: Re: RES: Pmac Slits Davis, Mark via Tech-talk
Next: Re: libca bug? Michael Davidsaver 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
Navigate by Thread:
Prev: Software Engineer position in LIGO Hanks, Jonathan via Tech-talk
Next: Re: libca bug? Michael Davidsaver 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
ANJ, 03 May 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·