EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Out of order replies from a serial device
From: Dirk Zimoch <[email protected]>
To: Phillip Sorensen <[email protected]>
Cc: TechTalk EPICS <[email protected]>, [email protected]
Date: Mon, 05 Feb 2007 14:45:31 +0100
Hi,

In StreamDevice, I do a pasynOctet->flush(pvtOctet, pasynUser) before doing any writes to get rid of "old" replies. Asyn is not doing this automatically (and also should not).

The flush() function works as if you do read() until no further data is available and discards everything. But it might be significantly faster.

Dirk

Phillip Sorensen wrote:
Phillip Sorensen wrote:

I took some time to look at the asyn code this morning. I am looking at ASYN 4-6.

Mark Rivers wrote:

I believe asyn is doing the flush operation that Emmanuel suggested.


As far as I can tell, there is no flush before writes at either the devGpib level or the port driver level for drvAsynSerialPort or drvAsynIPPort. What I did find was that in the drvAsynSerialPort.c file that a timeout at this level causes a flush. There is no similiar flush in the drvAsynIPPort.c code.


I suspect you are not getting out of order replies. I think you are getting a timeout, but then stale data from some buffer is ending up in the apparent data you received with the timeout.


The "out of order" data seems to be coming from the OS socket buffer (I am running under linux). They are never flushed after a timeout.

This looks like a "possible" bug to me, and think that flushing the buffer would do away with my "out of order error", BUT I don't think it is the root cause of my problem.

After taking a second look at the code, I think I have found the root of my problem. I was puzzled by the fact that the code seemed to work with an older version of ASYN and that increasing the timeout parameter had no effect on the problem.

It appears that when the timeout handling code was removed from the drvAsynIPPort driver the SOCK_EINTR error return from the recv is now treated as if it were a timeout. In the previous version of the code that I have and in the drvAsynSerialPort code, the recv was inside a for(;;) loop which would retry the read in the EINTR error state.

I will try to put together a patch to retry to the recv on SOCK_EINTR in the next day or so.


Phil Sorensen CHESS



-- Dr. Dirk Zimoch Swiss Light Source Computing and Controls Paul Scherrer Institut phone +41 56 310 5182 fax +41 56 310 4413

References:
Out of order replies from a serial device Phillip Sorensen
Re: Out of order replies from a serial device Emmanuel Mayssat
Re: Out of order replies from a serial device Phillip Sorensen
RE: Out of order replies from a serial device Mark Rivers
Re: Out of order replies from a serial device Phillip Sorensen
Re: Out of order replies from a serial device Phillip Sorensen

Navigate by Date:
Prev: Re: StreamDevice and checksum Dirk Zimoch
Next: Re: asyn driver for serial device Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Out of order replies from a serial device Phillip Sorensen
Next: EDM Message Box issue.... Dave Reid
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·