ConnectionClosedError("receiving: connection lost: "+str(x))
ConnectionClosedError: receiving: connection lost: [Errno 104] Connection reset by peer
If I haven't been clear, the following is what causes this issue: -Open 4 connections on different SSH sessions to the device and run repeated tests which setup a pyro proxy. (These work just fine and complete without error) -Open more connections, all hanging on my call to get data. They hang for at least 5 minutes, and some will infrequently raise the above exception. -Not all of them will do this. Once 1 of the 4 running tests finishes, the 5th test that was hanging will pick up and finish just fine. The others will follow, but never any more than 4 at a time.
Lastly, the following code (in socketutil.py) is where the exception is actually happening:
def receiveData(sock, size):
"""Retrieve a given number of bytes from a socket.
It is expected the socket is able to supply that number of bytes.
If it isn't, an exception is raised (you will not get a zero length result
or a result that is smaller than what you asked for). The partial data that
has been received however is stored in the 'partialData' attribute of
the exception object."""
try:
retrydelay=0.0
msglen=0
chunks=[]
if hasattr(socket, "MSG_WAITALL"):
# waitall is very convenient and if a socket error occurs,
# we can assume the receive has failed. No need for a loop,
# unless it is a retryable error.
# Some systems have an erratic MSG_WAITALL and sometimes still return
# less bytes than asked. In that case, we drop down into the normal
# receive loop to finish the task.
while True:
try:
data=sock.recv(size, socket.MSG_WAITALL)
if len(data)==size:
return data
# less data than asked, drop down into normal receive loop to finish
msglen=len(data)
chunks=[data]
break
except socket.timeout:
raise TimeoutError("receiving: timeout")
except socket.error:
x=sys.exc_info()[1]
err=getattr(x, "errno", x.args[0])
if err not in ERRNO_RETRIES:
#################HERE!!###################
raise ConnectionClosedError("receiving: connection lost: "+str(x))
time.sleep(0.00001+retrydelay) # a slight delay to wait before retrying
retrydelay=__nextRetrydelay(retrydelay)
Would really appreciate some direction here. Thanks in advance!

New Topic/Question
Reply



MultiQuote



|