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  <20122013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: Re: Calcout using CA output link sometimes gets INVALID severity
From: Andrew Johnson <anj@aps.anl.gov>
To: "J. Lewis Muir" <jlmuir@imca-cat.org>
Cc: tech-talk@aps.anl.gov
Date: Fri, 12 Oct 2012 11:38:02 -0500
Hi Lewis,

On 2012-10-12 J. Lewis Muir wrote:
> Yes, inserting the delay makes the problem go away.
> 
> But this seems like a bug to me.  Isn't the IOC supposed to be
> in the "running" state after iocInit completes?  I would expect
> this to mean that any threads related to CA link processing have
> completed starting and are in a state ready to service CA
> requests.  I would not expect to have to insert epicsThreadSleep
> calls after iocInit to make things work.

The threads involved have all started and are processing, but connecting CA 
channels is fundamentally an asynchronous process.  You wouldn't want us to 
delay the completion of iocInit until all CA links in the database are 
connected up; the database has no idea whether a CA link points to a local or 
remote PV, it treats them all identically.

I may have removed an epicsThreadSleep() from the iocInit code in the past; I 
could put one back in so you don't have to provide one yourself, but that 
would unnecessarily delay IOCs that don't actually need to wait.

In your case the delay is really a requirement before doing the dbpf because 
you don't want to process that calcout record until the output link has 
connected.  Maybe a more robust alternative might be to provide a command 
which waits for a named link field to have connected, so instead of a delay 
you'd use something like
    dbcaWaitConnected "ioc23:PresetHistoryAdd.OUT"
but I don't know how easy it would be to implement that.

> Also, I don't know exactly how the pause and run stuff works,
> but if the IOC is paused and then run again at a later time,
> will the same problem occur?  If so, I guess I'd have to add a
> delay on coming out of the paused state to ensure my record will
> process correctly.  That would be pretty lame.

Pausing won't help, that stops the CA server side of the IOC so requires 
reconnecting.  It was added to solve a completely different problem.

- Andrew
-- 
Never interrupt your enemy when he is making a mistake.
-- Napoleon Bonaparte

Replies:
Re: Calcout using CA output link sometimes gets INVALID severity J. Lewis Muir
References:
Calcout using CA output link sometimes gets INVALID severity J. Lewis Muir
Re: Calcout using CA output link sometimes gets INVALID severity Andrew Johnson
Re: Calcout using CA output link sometimes gets INVALID severity J. Lewis Muir

Navigate by Date:
Prev: Re: Calcout using CA output link sometimes gets INVALID severity Ralph Lange
Next: Re: Calcout using CA output link sometimes gets INVALID severity J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
Navigate by Thread:
Prev: Re: Calcout using CA output link sometimes gets INVALID severity Tim Mooney
Next: Re: Calcout using CA output link sometimes gets INVALID severity J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·