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  <20132014  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  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Subscription updates halting?
From: Andrew Johnson <[email protected]>
To: "Gibbs, Matt" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Mon, 11 Nov 2013 10:52:23 -0600
Hi Matt,

On 11/10/2013 04:46 AM, Gibbs, Matt wrote:
I have a simple test script where I create a channel, then create a
new subscription, and pass in an event callback function which just
prints the current value of the PV to the terminal.  Most of the
time, this works great, but maybe 20% of the time, I get two updates,
then nothing else for the duration of the program.  This is always
using the same code, with the same PV.  If I run ‘camonitor’ on the
PV repeatedly, I never see the same problem.

I don’t get any exception messages, and the rest of the script
doesn’t crash or halt, so it seems like the event callback just stops
getting called.

Any ideas about what might be happening, or things I can do to
further debug this?

As Dirk said its easier for us to help if you can show us the code, but I can suggest a couple of possibilities.

Are you configuring the CA library to use pre-emptive callbacks or not? See http://www.aps.anl.gov/epics/base/R3-14/12-docs/CAref.html#Thread for an explanation. If you want libca run your callbacks from its internal threads at any time (pre-emptive enabled) you must handle any necessary locking to protect your data structures against race conditions. If on the other hand you disable pre-emptive callbacks you must call ca_pend_event() regularly because libca can only call your event callbacks while your main thread is inside that routine.

Note that the callbacks will still happen in the context of those internal libca threads, but you don't have to worry about using mutexes to protect your data in most cases.

There is a difference between ca_pend_io() and ca_pend_event(); the former will only result in monitor callbacks being run while the library is waiting for channel connections and ca_get() and ca_put() operations to complete. If the only I/O outstanding is waiting for monitor events to fire, ca_pend_io() will return immediately without processing them, thus you usually need to use ca_pend_event().

If that doesn't help we'll probably need to see your code to work out what's going on.

- Andrew
--
Advertising may be described as the science of arresting the human
intelligence long enough to get money from it. -- Stephen Leacock

Replies:
Re: Subscription updates halting? Gibbs, Matt
References:
Subscription updates halting? Gibbs, Matt

Navigate by Date:
Prev: Re: autosave failure S_rpcLib_RPC_CANTSEND Ron Sluiter
Next: RE: autosave failure S_rpcLib_RPC_CANTSEND Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Subscription updates halting? Dirk Zimoch
Next: Re: Subscription updates halting? Gibbs, Matt
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·