Bug in recv wsgiserver

6 views
Skip to first unread message

RichardC

unread,
Nov 8, 2008, 3:28:23 PM11/8/08
to cherrypy-devel
I think I've found a bug in wsgiserver. I can't figure out how to get
an account in Trac so I can create a ticket, so here are the details.

I've been working with CherryPy for a few months under linux and have
seen this maybe two or three times. So it's extremely intermittent.

File "/home/richardc/projects/market/python/lib/python2.5/site-
packages/cherrypy/wsgiserver/__init__.py", line 968, in communicate
req.parse_request()
File "/home/richardc/projects/market/python/lib/python2.5/site-
packages/cherrypy/wsgiserver/__init__.py", line 304, in parse_request
self._parse_request()
File "/home/richardc/projects/market/python/lib/python2.5/site-
packages/cherrypy/wsgiserver/__init__.py", line 317, in _parse_request
request_line = self.rfile.readline()
File "/home/richardc/projects/market/python/lib/python2.5/site-
packages/cherrypy/wsgiserver/__init__.py", line 212, in readline
data = self.rfile.readline(256)
File "/home/richardc/projects/market/python/lib/python2.5/site-
packages/cherrypy/wsgiserver/__init__.py", line 822, in readline
data = self.recv(self._rbufsize)
File "/home/richardc/projects/market/python/lib/python2.5/site-
packages/cherrypy/wsgiserver/__init__.py", line 724, in recv
return self._sock.recv(size)
error: (4, 'Interrupted system call')

The recv function loops when an exception with an errno in
sock_errors_nonblocking is raised:

def recv(self, size):
while True:
try:
return self._sock.recv(size)
except socket.error, e:
if e.args[0] not in socket_errors_nonblocking:
raise

However socket_errors_nonblocking does not contain EINTR which my
stacktrace shows occurs from time to time.

socket_errors_nonblocking = plat_specific_errors(
'EAGAIN', 'EWOULDBLOCK', 'WSAEWOULDBLOCK')

sock_errors_nonblocking should probably be initialised as:

socket_errors_nonblocking = plat_specific_errors(
'EAGAIN', 'EWOULDBLOCK', 'WSAEWOULDBLOCK', 'EINTR', 'WSAEINTR')

Something similar may need to be done for sending data as well.

Robert Brewer

unread,
Nov 8, 2008, 3:51:37 PM11/8/08
to cherryp...@googlegroups.com
RichardC wrote:
> I think I've found a bug in wsgiserver. I can't figure out how to get
> an account in Trac so I can create a ticket, so here are the details.
> ...

> return self._sock.recv(size)
> error: (4, 'Interrupted system call')

There is a guest name/pass on every page. ;) I've filed your ticket at
http://www.cherrypy.org/ticket/877.


Robert Brewer
fuma...@aminus.org

Richard Collins

unread,
Nov 8, 2008, 3:56:16 PM11/8/08
to cherryp...@googlegroups.com
I need glasses. Thanks.
Reply all
Reply to author
Forward
0 new messages