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

Subject: RE: asyn timeout
From: Mark Rivers <rivers@cars.uchicago.edu>
To: 'Torsten bögershaus' <torsten.bogershausen@esss.se>, Pedro Gigoux <pgigoux@gemini.edu>
Cc: Eric Norum <wenorum@lbl.gov>, "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Mon, 19 Oct 2015 15:46:49 +0000
I don't know a lot about this.  However, the following is from this document:

http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/#usingkeepalive


*********************************
Linux has built-in support for keepalive. You need to enable TCP/IP networking in order to use it. You also need procfs support and sysctl support to be able to configure the kernel parameters at runtime.

The procedures involving keepalive use three user-driven variables:

tcp_keepalive_time
    the interval between the last data packet sent (simple ACKs are not considered data) and the first keepalive probe; after the connection is marked to need keepalive, this counter is not used any further

tcp_keepalive_intvl
   the interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantime

tcp_keepalive_probes
   the number of unacknowledged probes to send before considering the connection dead and notifying the application layer

Remember that keepalive support, even if configured in the kernel, is not the default behavior in Linux. Programs must request keepalive control for their sockets using the setsockopt interface. There are relatively few programs implementing keepalive, but you can easily add keepalive support for most of them following the instructions explained later in this document.

*********************************

So this says that although the Linux kernel supports keepalive, it must be enabled on a per socket basis using the setsockopt() function call.

This is an example of how it can be done:
************************
   /* Set the option active */
   optval = 1;
   optlen = sizeof(optval);
   if(setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) < 0) {
      perror("setsockopt()");
      close(s);
      exit(EXIT_FAILURE);
   }
   printf("SO_KEEPALIVE set on socket\n");
************************

The asyn drvAsynIPPort driver calls setsockopt() for several options, but it does not set SO_KEEPALIVE.

Should asyn be setting SO_KEEPALIVE by default?  Perhaps drvAsynIPPort should implement the asynOption interface and we could control things like this over that interface, like drvAsynSerialPort does for baud rate, stop bits, etc.?

Mark


-----Original Message-----
From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Torsten bögershaus
Sent: Monday, October 19, 2015 10:27 AM
To: Pedro Gigoux
Cc: tech-talk@aps.anl.gov
Subject: Re: asyn timeout

Not with asyn in special, but with all kind of TCP/IP related devices.

TCP/IP has a "Keepalive", but this is typically 2 hours.

Could you share more information about that "component in the communication chain" ?
And what happens if the communication is broken ?
Is there a clean FIN on the TCP-layer ?
Is it just dropped ?

Can you run Wireshark on the IOC ?
On the instrument ?
More info is appreciated 




Am 19.10.2015 um 16:38 schrieb Pedro Gigoux <pgigoux@gemini.edu>:

> Hi,
> 
> We are using asynDriver to talk to an instrument connected to a socket port on a remote site using an ASCII based protocol. The communication works well except that the connection consistently drops when the exposure time is longer than 30 minutes. While the instrument is exposing there's no traffic in the socket; this points to a component in the communication chain that times out if it doesn't see any traffic for more than a certain time. I did not find timeouts in the asynDriver code so I suspect that the problem is in a network switch/firewall. Has anyone seen a similar problem with asyn before?
> 
> Thank you,
> Pedro Gigoux
> Gemini Observatory
> 




Replies:
Re: asyn timeout Eric Norum
References:
asyn timeout Pedro Gigoux
Re: asyn timeout Torsten bögershaus

Navigate by Date:
Prev: Re: asyn timeout Torsten bögershaus
Next: Re: asyn timeout Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017 
Navigate by Thread:
Prev: Re: asyn timeout Torsten bögershaus
Next: Re: asyn timeout Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·