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  <20172018  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  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: monitor subscription in areaDetector
From: Andrew Johnson <[email protected]>
To: <[email protected]>
Date: Fri, 27 Jan 2017 11:53:10 -0600
Hi Matt,

On 01/27/2017 11:25 AM, Pearson, Matthew R. wrote:
> In areaDetector, for when we append NDAttribute data to NDArray
> objects, we have a class that can set up monitors on PVs. When a
> monitor event happens we record the data for use by the next NDArray
> object. However, we were setting a monitor callback handler for every
> connection event. This can result in multiple monitors being setup if
> the IOC that hosts the PV being monitored has been restarted a few
> times (resulting in a multiple connection events in the areaDetector
> IOC).

A very common bug in CA client code unfortunately, the client library
API makes this mistake easy to make.

> I was able to fix this in the same was as camonitor.c handles this,
> by using a flag to indicate that we’ve already connected (and set up
> a monitor) to a PV. Is this the most appropriate method to handle
> this? In the CA reference manual I see that there are functions like
> ca_clear_channel() and ca_clear_subscription() that we could possibly
> use on a disconnection event.

Given that reconnection happens automatically inside the CA library and
you usually want that to happen, it's generally a bad idea to clear your
subscriptions just because a channel disconnects. However the connection
handler may need to make sure that the channel's native data type hasn't
changed since the last time it connected. If the client's code assumes
that the subscription always uses the channel's native type then the
connection handler will have to clear and resubscribe if the type
changes, but some clients may always subscribe with a specific data
type, in which case they won't need to worry about that.

- Andrew

-- 
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon

References:
monitor subscription in areaDetector Pearson, Matthew R.

Navigate by Date:
Prev: Re: monitor subscription in areaDetector Kasemir, Kay
Next: 答复: Questions about set parameters to device by using epics lzf neu
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: monitor subscription in areaDetector Kasemir, Kay
Next: macro question Rolf Keitel
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024