[issue10878] asyncore does not react properly on close()
Teodor Georgiev
report at bugs.python.org
Mon Jan 10 12:44:37 CET 2011
Teodor Georgiev <lv_tokata at yahoo.com> added the comment:
Precisely, I traced down the problem by putting a simple "breakpoint"
in asyncore.py:
def poll(timeout=0.0, map=None):
if map is None:
map = socket_map
if map:
r = []; w = []; e = []
for fd, obj in map.items():
is_r = obj.readable()
print "Readable??? -->" , is_r
is_w = obj.writable()
if is_r:
r.append(fd)
if is_w:
w.append(fd)
if is_r or is_w:
e.append(fd)
if [] == r == w == e:
time.sleep(timeout)
return
print r,w,e
try:
r, w, e = select.select(r, w, e, timeout)
except select.error, err:
if err.args[0] != EINTR:
raise
else:
return
And here it comes:
[5] [5] [5]
Readable??? --> True
[5] [5] [5]
Readable??? --> True
[5] [5] [5]
Readable??? --> False
[] [5] [5]
Traceback (most recent call last):
File "./dlms_client.py", line 136, in <module>
asyncore.loop(timeout=0.8)
File "/usr/lib/python2.6/asyncore.py", line 213, in loop
poll_fun(timeout)
File "/usr/lib/python2.6/asyncore.py", line 146, in poll
raise
File "/usr/lib/python2.6/asyncore.py", line 143, in poll
r, w, e = select.select(r, w, e, timeout)
select.error: (9, 'Bad file descriptor')
So, in order this to work, on first sight all r,w,e must not point to
a socket that has been already closed. Now I am going to think for a workaround at least.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10878>
_______________________________________
More information about the Python-bugs-list
mailing list