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  2013  2014  2015  2016  2017  2018  2019  <20202021  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  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Pure Python IOC (CAProcess issue)
From: Simon Reiter via Tech-talk <tech-talk at aps.anl.gov>
To: Michael Davidsaver <mdavidsaver at gmail.com>
Cc: EPICS Tech-Talk <tech-talk at aps.anl.gov>
Date: Mon, 20 Jul 2020 10:44:47 +0200
Using 'forkserver' and 'spawn' seem to work both. The creating is slower, but
this might not be problematic.

The only drawback at the moment is that the framework is still running on
Python 2. We already made some effort to move to Python 3, but this is not
final. And Python 2 does not provide the selection of the start method.


PS: I also managed to run into the same problem on Python 3.8 in a conda
environment with obviously running EPICS 3.17.6:

> Thread 1 (Thread 0x7f65d9f52740 (LWP 9303)):
> #0  __lll_lock_wait () at
> ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
> #1  0x00007f65d9b4ae9b in _L_lock_883 () from /lib64/libpthread.so.0
> #2  0x00007f65d9b4ad68 in __GI___pthread_mutex_lock (mutex=0x7f65af498fc0
> <onceLock>) at ../nptl/pthread_mutex_lock.c:78
> #3  0x00007f65af467b06 in epicsThreadOnce () from
> /home/sreiter/anaconda3/envs/lab3/epics/lib/linux-x86_64/./libCom.so.3.17.6
> #4  0x00007f65af4c905b in ca_context_create () from
> /home/sreiter/anaconda3/envs/lab3/epics/lib/linux-x86_64/libca.so
> ...

I just do not see the epicsTimeGetCurrent() function call.





On Sat, 2020-07-18 at 08:59 +0200, Simon Reiter wrote:
> I also thought about using ’spwan’ to create an independent process. But I
> was wondering why this is not mentioned at all on the pyepics page. And in
> fact, in that case it is also not clear to me what the advantage is of using
> CAProcess instead of Process.
> 
> I will try this now and report here again.
> 
> > On Jul 17, 2020, at 18:55, Michael Davidsaver <mdavidsaver at gmail.com>
> > wrote:
> > 
> > On 7/17/20 9:33 AM, Michael Davidsaver wrote:
> > > The python subprocess module shouldn't let this happen though since it
> > > does
> > > fork() and then execv(), and the situation which I describe is only
> > > possible
> > > if fork() is not followed by execv().
> > 
> > Oh wait.  CAProcess (which I've not seen previously) is using
> > the multiprocessing module, which can do fork() without exec().
> > In fact, this is the default on *NIX.  So this is likely or
> > problem.  I think you'll need to use the 'spawn' or 'forkserver'
> > method.
> > 
> > https://docs.python.org/3.7/library/multiprocessing.html#contexts-and-start-methods
> > 
> > https://github.com/pyepics/pyepics/blob/1f795c647458435cca0cf11b984b34fc11180c25/epics/multiproc.py
> 
> 


References:
Pure Python IOC (CAProcess issue) Simon Reiter via Tech-talk
Re: Pure Python IOC (CAProcess issue) Michael Davidsaver via Tech-talk
Re: Pure Python IOC (CAProcess issue) Michael Davidsaver via Tech-talk
Re: Pure Python IOC (CAProcess issue) Michael Davidsaver via Tech-talk
Re: Pure Python IOC (CAProcess issue) Simon Reiter via Tech-talk

Navigate by Date:
Prev: Re: data acquisition strategies Jemian, Pete R. via Tech-talk
Next: Re: two IOC run as a time Hitesh Dhola via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Pure Python IOC (CAProcess issue) Simon Reiter via Tech-talk
Next: PowerMaster II device support? DiMonte, Nicholas via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 20 Jul 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·