EPICS Home

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  <20192020  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  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: libca bug?
From: Bruno Martins via Tech-talk <[email protected]>
To: tech-talk <[email protected]>
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.


[1] https://github.com/epics-base/epics-base/blob/3.15/src/ca/client/ca_client_context.cpp#L51



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  <20192020  2021  2022  2023  2024 
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  <20192020  2021  2022  2023  2024