Issue #713 resolved

socket.py times out occasionally in read and in readline in python 2.4.

guest
created an issue

times out at line 359 for readline (sock.recv call): {{{ ... while True: data = self._sock.recv(self._rbufsize) if not data: break buffers.append(data) left = size - buf_len ... }}}

and times out at line 295 for read() (sock.recv call): {{{ ... while True: left = size - buf_len recv_size = max(self._rbufsize, left) data = self._sock.recv(recv_size) ... }}}

Note that read has code that attempts to adjust num_bytes passed to sock.recv. However, it looks like it should be using min and not max here: {{{ recv_size = max(self._rbufsize, left) }}}

I got stack traces indicating timeouts at both of these locations (295 and 359). I am testing a patch with this in both read and readline: {{{ ... while True: left = size - buf_len recv_size = min(self._rbufsize, left) data = self._sock.recv(recv_size) ... }}}

If this works, I'll add a comment that we should fix this in SVN. Any recommendations at this point would be appreciated. thanks, Joel joel@joelsoft.com

Comments (2)

  1. Log in to comment