iocLogServer connection problem on win32-x86 platform
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Incomplete
|
Low
|
mdavidsaver |
Bug Description
I am running iocLogServer on the win32-x86 platform (base 3.14.12, VS 2010 Express, Windows 7).
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(
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 behaviour. Since the shutdown function is used to close the connection gracefully I think the line 494 should be removed.
Also the IOC log client code uses the shutdown function to shut down the receive part of the socket. To my experience this works fine on all the platforms but it still might be a good idea to remove it as well. At least on win32 platform no resources are freed until close function is called.
Regards,
Janez
Server side:
import socket
HOST = ''
PORT = 50007
s = socket.
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connected by', addr
conn.shutdown(
while 1:
data = conn.recv(1024)
if not data: break
print '"{}"'.format(data)
conn.close()
Client side:
import socket
import time
HOST = 'localhost'
PORT = 50007
s = socket.
s.connect((HOST, PORT))
s.send('This should succeed')
time.sleep(100)
s.send('This shuld fail')
Presumably the shutdown call can be removed. The main issue here will be to make certain that any changes do not negatively impact other OS.