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: Calling ca_context_create(1) too late
From: Andrew Johnson <[email protected]>
To: [email protected]
Cc: [email protected]
Date: Tue, 23 Apr 2013 10:50:16 -0500
Hi Michael,

On 2013-04-23 [email protected] wrote:
> I've finally isolated the issue when calling ca_context_create(1) late ...
> and it's something to do with how the zero count is handled in
> ca_array_get_callback -- to be precise, when calling
> 
> 	ca_array_get_callback(dbrcode, 0, channel, callback, context)
> 
> the size of the returned array differs, depending on whether
> ca_context_create(1) was called before or after iocInit!  Note that this
> problem only occurs with internal PVs, for external PVs the correct count
> is returned in both cases.

Ok, this explains it, but hopefully Jeff will chime in too and look into a 
solution for the underlying problem.  If you call ca_context_create() before 
iocInit() your client then doesn't know about the server's local channels, 
because the server hasn't registered as a local channel provider with libCa 
yet.  Local channels allows the client library to search the local server for 
channel names directly before broadcasting them on the network.

Unfortunately there is a known and rather long-standing bug related to using 
local channels with an array count of zero:
    https://bugs.launchpad.net/epics-base/+bug/541393

> I've attached a complete example IOC

... and you thereby discovered by I don't recommend sending st.cmd files to 
tech-talk as attachments, even embedded inside a compressed tarfile or 
zipfile.  Spam filters are terrified of files with a .cmd extension in case 
they contain instructions that Windows will execute.  Just paste the contents 
of any st.cmd file into the message in the future.

> I can't find documentation for the expected behaviour of calling
> ca_array_get_callback() with a zero count, but I've never encountered
> problems with this before: up to now I've expected to get the "natural"
> record size.

http://www.aps.anl.gov/epics/base/R3-14/12-docs/CAref.html#ca_get

The CA documentation does actually say (briefly!) what a count of zero is 
supposed to mean; look for COUNT under the Arguments detail.

Prior to 3.14.12 we didn't support dynamic array sizes and specifying a zero 
size was supposed to always give you the maximum size of the array; after 
3.14.12 it should give you just the number of elements the array currently 
holds.

- Andrew
-- 
It is difficult to get a man to understand something, when his salary
depends upon his not understanding it. -- Upton Sinclair

References:
Calling ca_context_create(1) too late michael.abbott
Re: Calling ca_context_create(1) too late Andrew Johnson
RE: Calling ca_context_create(1) too late michael.abbott

Navigate by Date:
Prev: Re: Add choice to dbd file Andrew Johnson
Next: asynPrint to print asyn port name ulrik.pedersen
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: Calling ca_context_create(1) too late michael.abbott
Next: RE: Calling ca_context_create(1) too late Hill, Jeff
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 ·