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: FW: Calling ca_context_create(1) too late
From: <[email protected]>
To: <[email protected]>
Date: Tue, 23 Apr 2013 10:29:16 +0000
Forgive me: my attempt to send the message below bounced with the following error:

  [email protected]
    SMTP error from remote mail server after end of data:
    host gmail-smtp-in.l.google.com [173.194.66.26]:
    552-5.7.0 Our system detected an illegal attachment on your message. Please
    552-5.7.0 visit http://support.google.com/mail/bin/answer.py?answer=6590 to
    552 5.7.0 review our attachment guidelines. f5si5897477wiz.42 - gsmtp

Alas, I don't know who did or didn't get the message, so I'm having to resend.  The problem here appears to be a .cmd in the .tgz file ... ffs.  I'm resending with an obfuscated tar file to side-step gmail's brain damaged policy: if you want the content (and you didn't get the earlier message) you'll have to decode it with the following command:

	openssl rc2 -d -k password <test-ioc.tgz.enc |tar xz

(yes, the password is "password", very secure).  If gmail eats this as well...

Honestly, there's nothing in the tgz that isn't already in the original mail below, just the usual IOC boilerplate.

> -----Original Message-----
> From: [email protected] [mailto:tech-talk-
> [email protected]] On Behalf Of [email protected]
> Sent: 23 April 2013 09:18
> To: [email protected]; [email protected]
> Subject: RE: Calling ca_context_create(1) too late
> 
> 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.
> 
> I've attached a complete example IOC -- just compile it and run `test`
> or `test 1` in the root.  Running `test` will call ca_context_create(1)
> late and will print out 'count = 0'; running `test 1` calls
> ca_context_create(1) early and prints out 'count = 1'.  I've tested
> this with both 3.14.11 and 3.14.12.3.
> 
> 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.  Note that if the PV being fetched is an external PV then
> 'count = 1' is printed as expected.
> 
> Note, by the way, that my earlier diagnosis (that something else was
> also calling ca_context_create() and conflicting) appears to have been
> completely wrong.  Sorry about the red herring.
> 
> Here's the core of the IOC:
> 
> test.c
> ======
> #include <stdbool.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> 
> #include <cadef.h>
> #include <iocsh.h>
> 
> 
> static chid pv_channel;
> 
> static void on_get(struct event_handler_args args)
> {
>     printf("on get\n");
>     printf("count = %ld\n", args.count);
> }
> 
> static void on_ca_connect(struct connection_handler_args args)
> {
>     printf("on connect\n");
>     ca_array_get_callback(3, 0, pv_channel, on_get, NULL);
> }
> 
> int main(int argc, char **argv)
> {
>     bool early_create = argc > 1  &&  *argv[1] == '1';
>     printf("Creating CA context %s\n", early_create ? "early" :
> "late");
> 
>     if (early_create)
>         ca_context_create(1);
>     iocsh("TEST.cmd");
>     if (!early_create)
>         ca_context_create(1);
> 
>     ca_create_channel("TESTPV", on_ca_connect, NULL, 0, &pv_channel);
> 
>     sleep(1);
>     return 0;
> }
> 
> 
> TEST.cmd
> ========
> dbLoadDatabase("dbd/TEST.dbd", NULL, NULL)
> TEST_registerRecordDeviceDriver(pdbbase)
> dbLoadRecords("TEST.db", NULL)
> iocInit()
> 
> 
> TEST.db
> =======
> record(bo, "TESTPV")
> {
> }
> 

Attachment: test-ioc.tgz.enc
Description: test-ioc.tgz.enc


Navigate by Date:
Prev: RE: Calling ca_context_create(1) too late michael.abbott
Next: How to create EPICS device support for a simple serial or GPIB device Vahe Sahakyan
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 Hill, Jeff
Next: Add choice to dbd file Bruno Santos
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 ·