[issue13310] asyncore handling of out-of-band data fails
Xavier de Gaye
report at bugs.python.org
Tue Nov 1 17:04:40 CET 2011
New submission from Xavier de Gaye <xdegaye at gmail.com>:
Add the following lines to test_handle_expt (this makes sense, a
dispatcher instance is supposed to implement handle_read and call recv
in order to detect that the remote end has closed the socket):
--- a/Lib/test/test_asyncore.py
+++ b/Lib/test/test_asyncore.py
@@ -677,6 +677,9 @@
def handle_expt(self):
self.flag = True
+ def handle_read(self):
+ self.recv(1)
+
class TestHandler(BaseTestHandler):
def __init__(self, conn):
BaseTestHandler.__init__(self, conn)
With these lines added, the test now fails on linux with Python 3.3,
see the following backtrace: select (an poll) returns a read event and
an exceptional condition for the socket, but there is no normal data
to read, only out-of-band data.
The attached patch fixes the problem.
======================================================================
ERROR: test_handle_expt (test.test_asyncore.TestAPI_UseIPv4Poll)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/path_to/src/cpython/cpython-hg-default/Lib/test/test_asyncore.py", line 690, in test_handle_expt
self.loop_waiting_for_flag(client)
File "/path_to/src/cpython/cpython-hg-default/Lib/test/test_asyncore.py", line 523, in loop_waiting_for_flag
asyncore.loop(timeout=0.01, count=1, use_poll=self.use_poll)
File "/path_to/src/cpython/cpython-hg-default/Lib/asyncore.py", line 215, in loop
poll_fun(timeout, map)
File "/path_to/src/cpython/cpython-hg-default/Lib/asyncore.py", line 196, in poll2
readwrite(obj, flags)
File "/path_to/src/cpython/cpython-hg-default/Lib/asyncore.py", line 117, in readwrite
obj.handle_error()
File "/path_to/src/cpython/cpython-hg-default/Lib/asyncore.py", line 108, in readwrite
obj.handle_read_event()
File "/path_to/src/cpython/cpython-hg-default/Lib/asyncore.py", line 439, in handle_read_event
self.handle_read()
File "/path_to/src/cpython/cpython-hg-default/Lib/test/test_asyncore.py", line 681, in handle_read
self.recv(1)
File "/path_to/src/cpython/cpython-hg-default/Lib/asyncore.py", line 379, in recv
data = self.socket.recv(buffer_size)
BlockingIOError: [Errno 11] Resource temporarily unavailable
----------
components: Library (Lib)
files: handle_expt.diff
keywords: patch
messages: 146783
nosy: xdegaye
priority: normal
severity: normal
status: open
title: asyncore handling of out-of-band data fails
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file23580/handle_expt.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13310>
_______________________________________
More information about the Python-bugs-list
mailing list