[Python-bugs-list] [ python-Bugs-453099 ] select in asyncore not defensive

noreply@sourceforge.net noreply@sourceforge.net
Mon, 29 Oct 2001 08:33:59 -0800


Bugs item #453099, was opened at 2001-08-19 15:24
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=453099&group_id=5470

Category: Python Library
Group: Python 2.1.1
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Jeremy Hylton (jhylton)
Summary: select in asyncore not defensive

Initial Comment:
The poll method in asyncore.py does not wrap the
select.select call on line 86 in a try/except block to
test for EINTR/EWOULDBLOCK and then try the select call
again. This was brought to my attention during the
perusal of the Zope-dev list. Seems like the person who
originally reported the symptom did not open a bug so I
thought I would.

Platform: SunOS 5.8/Sparc
Python version: 2.1.1
Zope version: 2.4.0

Thanks.

Here is the mail from a person on the Zope-dev mailing
list:

I am moving this thread over from the zope list in the
hope that someone here may have more insight into the
nature of this problem, and perhaps how to go about 
better diagnosing/fixing the problem.

To sum up:  Under apparently random circumstances and 
rather mild amounts of traffic, Zope is crashing and
printing the Traceback below to the console. This is
Zope-2.4.0, Python-2.1.1 on SunOS 5.8/Sparc.

Traceback (most recent call last):
  File "/u01/zope/Zope-2.4.0-src/z2.py", line 774, in ?
   asyncore.loop()
  File "/u01/zope//lib/python2.1/asyncore.py", line
194, in loop
    poll_fun (timeout, map)
  File "/u01/zope//lib/python2.1/asyncore.py", line 86,
in poll
    r,w,e = select.select (r,w,e, timeout)
  select.error: (4, 'Interrupted system call')



----------------------------------------------------------------------

>Comment By: Jeremy Hylton (jhylton)
Date: 2001-10-29 08:33

Message:
Logged In: YES 
user_id=31392

Fixed in rev 1 .25 of asyncore.py


----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2001-09-11 10:45

Message:
Logged In: YES 
user_id=31392

I thkn the select() and poll() calls should be defensive and
be resumed as long as a timeout was specified and not yet
exceeded.  I'll check with Sam and see what he things.


----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-08-20 09:57

Message:
Logged In: YES 
user_id=12800

Assigning to Jeremy.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-08-19 15:47

Message:
Logged In: NO 

Sorry, the user's email is jziniti@speakeasy.org.

EWOULDBLOCK was reported by that user for a different method
in asyncore called accept though it seems that EWOULDBLOCK
is being handled correctly in accept. It seems that the user
did add the try/except block around the select call on line
86 which resulted in later call to accept() throwing
EWOULDBLOCK. The trace is as follows:

system.error 4((4, 'Interrupted system call'))
------
2001-08-16T13:16:01 ERROR(200) ZServer uncaptured python
exception, closing channel <__repr__ (self) failed for
object at dee7bc (addr='/tmp/zope.soc')>
(exceptions.TypeError:unpack non-sequence
[/u01/zope/lib/python2.1/asyncore.py|poll|101]
[/u01/zope/lib/python2.1/asyncore.py|handle_read_event|383]
[/u01/zope/Zope-2.4.0-src/ZServer/FCGIServer.py|handle_accept|697])
------
2001-08-16T13:16:01 ERROR(200) ZServer uncaptured python
exception, closing channel <__repr__ (self) failed for
object at dec4bc
(addr='/u01/zope/Zope-2.4.0-src/var/pcgi.soc')>
(exceptions.TypeError:unpack non-sequence
[/u01/zope/lib/python2.1/asyncore.py|poll|101]
[/u01/zope/lib/python2.1/asyncore.py|handle_read_event|383]
[/u01/zope/Zope-2.4.0-src/ZServer/PCGIServer.py|handle_accept|380])
------
2001-08-16T13:16:01 ERROR(200) ZServer uncaptured python
exception, closing channel <FTPServer listening :8021 at
debcec> (exceptions.TypeError:unpack non-sequence
[/u01/zope/lib/python2.1/asyncore.py|poll|101]
[/u01/zope/lib/python2.1/asyncore.py|handle_read_event|383]
[/u01/zope/Zope-2.4.0-src/ZServer/FTPServer.py|handle_accept|694])
------
2001-08-16T13:16:01 PROBLEM(100) ZServer warning: server
accept() threw EWOULDBLOCK
------
2001-08-16T13:16:01 ERROR(200) ZServer uncaptured python
exception, closing channel <select-trigger (pipe) at 248024>
(exceptions.OSError:[Errno 11] Resource temporarily
unavailable [/u01/zope/lib/python2.1/asyncore.py|poll|101]
[/u01/zope/lib/python2.1/asyncore.py|handle_read_event|389]
[/u01/zope/Zope-2.4.0-src/ZServer/medusa/thread/select_trigger.py|handle_read|77]
[/u01/zope/lib/python2.1/asyncore.py|recv|341]
[/u01/zope/lib/python2.1/asyncore.py|recv|523])


Thanks.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=453099&group_id=5470