Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Coders

Re: [Zope-Checkins] CVS: Zope/ZServer/medusa - asyncore.py:1.13.36.1

 

 

Zope coders RSS feed   Index | Next | Previous | View Threaded


jeremy at zope

Jan 21, 2002, 10:04 AM

Post #1 of 1 (85 views)
Permalink
Re: [Zope-Checkins] CVS: Zope/ZServer/medusa - asyncore.py:1.13.36.1

>>>>> "BL" == Brian Lloyd <brian [at] zope> writes:

BL> Backported fix for bug #157: asyncore hang on Linux 2.2.

Is it possible to make these changes in the code that calls asyncore
rather than in asyncore? Sam Rushing has pushed back against making
changes to catch errors like this inside asyncore. So it's a hard
sell to get these changes into Python.

Regardless of where the changes are made, the code should check
for a wider range of error conditions and the same changes should be
made for send(). I had to fix ZEO to deal with a bunch of similar
errors. I used the code below (from ZEO/smac.py).

Jeremy

# Use the dictionary to make sure we get the minimum number of errno
# entries. We expect that EWOULDBLOCK == EAGAIN on most systems --
# or that only one is actually used.

tmp_dict = {errno.EWOULDBLOCK: 0,
errno.EAGAIN: 0,
errno.EINTR: 0,
}
expected_socket_read_errors = tuple(tmp_dict.keys())

tmp_dict = {errno.EAGAIN: 0,
errno.EWOULDBLOCK: 0,
errno.ENOBUFS: 0,
errno.EINTR: 0,
}
expected_socket_write_errors = tuple(tmp_dict.keys())
del tmp_dict

[...]

try:
d=self.recv(8096)
except socket.error, err:
if err[0] in expected_socket_read_errors:
return
raise

[...]

try:
n=self.send(v)
except socket.error, err:
if err[0] in expected_socket_write_errors:
break # we couldn't write anything
raise

Zope coders RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.