EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 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: Weird CAS hangup on IOC
From: Torsten Bögershausen via Core-talk <core-talk at aps.anl.gov>
To: Ralph Lange <ralph.lange at gmx.de>, EPICS Core Talk <core-talk at aps.anl.gov>
Date: Thu, 6 Feb 2020 19:02:06 +0100
Hej again,
I think there is a risk for race conditions .
for me it seams as if bind() succeeded,
but then listen() fails.

From my (limited) understanding, 2 processes are allowed to bind() to the same
port, for whatever reasons.
process 1 may use connect() on the port (specifying local port to be something
defined.
   This is not usually used, but technically possible and allowed.)
process 2 may use listen() on the same port, listening for incomming connections.
No both processes don’t interfere by using the same local port.

From that point of view, I would suspect that bind() can be done on the same port
from 2 different processes without problems.

The “trouble” starts, when we want to listen() from 2 differnent processes on
the same port,
that is not a valid use-case.

In this case, our EPICS code could handle this situation more gently,
by closing the bind() port, bind() to the next one and triy to listen.

Does this make any sense ?

/Torsten



On 06/02/20 13:44, Ralph Lange via Core-talk wrote:
Hej Torsten,

On Thu, 6 Feb 2020 at 13:35, Torsten Bögershausen <torsten.bogershausen at ess.eu <mailto:torsten.bogershausen at ess.eu>> wrote:

          if ( listen ( IOC_sock, 20 ) < 0 ) {
              char sockErrBuf[64];
              epicsSocketConvertErrnoToString (
                  sockErrBuf, sizeof ( sockErrBuf ) );
              errlogPrintf ( "CAS: Listen error: %s\n",
                  sockErrBuf );
              epicsSocketDestroy (IOC_sock);
              epicsThreadSuspendSelf ();
          }

    We should be able to print out errno,
    to see what is going on and why listen fails.
    (could be EAGAIN ??) We need to find out...


Well, we have the error string, right? "Address already in use" is not EAGAIN.

Also, the hanging IOC reports (casr 4) to be running on the 5064 port, which matches the missing "dynamically assigned TCP port" warning - sorry, I should have mentioned that in my original mail.

Cheers,
~Ralph


References:
Weird CAS hangup on IOC Ralph Lange via Core-talk
Re: Weird CAS hangup on IOC Torsten Bögershausen via Core-talk
Re: Weird CAS hangup on IOC Ralph Lange via Core-talk

Navigate by Date:
Prev: Re: My Jenkins builds fail checking out. Why? Andrew Johnson via Core-talk
Next: Re: Weird CAS hangup on IOC Michael Davidsaver via Core-talk
Index: 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: Weird CAS hangup on IOC Ralph Lange via Core-talk
Next: Re: Weird CAS hangup on IOC Michael Davidsaver via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 06 Feb 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·