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  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: iocLogServer connection problem on win32-x86 platform
From: "Hill, Jeff" <[email protected]>
To: Janez Golob <[email protected]>, "[email protected]" <[email protected]>
Date: Tue, 4 Jun 2013 14:10:17 +0000

Ø  What is the reason for using half-duplex connection only?

 

The purpose was to release resources that were not being used. I have not observed any issues resulting from this choice in the past, but the log server maybe isn’t run on windows all that often. I suspect that it won’t cause any issues to remove that shutdown call, other than additional resource consumption, although I haven’t touched this code in some time.

 

Could you file a bug report on this issue?

 

Thanks,

 

Jeff

 

From: [email protected] [mailto:[email protected]] On Behalf Of Janez Golob
Sent: Tuesday, June 04, 2013 7:43 AM
To: [email protected]
Subject: iocLogServer connection problem on win32-x86 platform

 

Hi All,

 

I am running iocLogServer on the win32-x86 platform (base 3.14.12, VS 2010 Express).

 

If the connection to the log server is inactive for more than 90 second (more precisely, if there are no messages logged) the following error is reported by the IOC (IOC log client):

epics> log client: lost contact with log server at "127.0.0.1:7111" because "An existing connection was forcibly closed by the remote host. "

 

I was digging a bit in to the iocLogServer.c source code and it seems to me the following statement causes the problem:

494      status = shutdown(pclient->insock, SHUT_WR);

 

It seems to me that shutting down one half of the connection can also close the opposite half. On the socket level the below  two short python programs can be used to reproduce the behavior.

 

What is the reason for using half-duplex connection only? To my experience the shutdown function is used to close the connection gracefully.

 

Regards,

Janez

 

 

 

Server side:

 

import socket

 

HOST = ''

PORT = 50007

 

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.bind((HOST, PORT))

s.listen(1)

conn, addr = s.accept()

print 'Connected by', addr

conn.shutdown(socket.SHUT_WR)

while 1:

    data = "">

    if not data: break

    print '"{}"'.format(data)

conn.close()

 

Client side:

 

import socket

import time

 

HOST = 'localhost'

PORT = 50007

 

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.connect((HOST, PORT))

s.send('This should succeed')

time.sleep(100)

s.send('This shuld fail')


References:
iocLogServer connection problem on win32-x86 platform Janez Golob

Navigate by Date:
Prev: Re: SEQ with dynamic assignment of PV in array variable Benjamin Franksen
Next: RE: SEQ with dynamic assignment of PV in array variable Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: iocLogServer connection problem on win32-x86 platform Janez Golob
Next: Announcement of publication of the Proceedings of PCaPAC-2012 Shantonu Sahoo
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·