Ticket #713 (defect)
Opened 1 year ago
Last modified 7 months ago
socket.py times out occasionally in read and in readline in python 2.4.
Status: closed (fixed)
| Reported by: | guest | Assigned to: | rdelon |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | CherryPy code | Keywords: | |
| Cc: |
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
Change History
03/17/08 15:18:15: Modified by fumanchu
- status changed from new to closed.
- resolution set to fixed.
- milestone set to 3.1.


This was fixed in [1915] via a custom fileobject class for nonblocking sockets.