This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Bad OOB data management when using asyncore with select.poll()
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
Status: closed Resolution: out of date
Dependencies: Superseder: asyncore's urgent data management and connection closed events are broken when using poll()
View: 4501
Assigned To: josiahcarlson Nosy List: akuchling, georg.brandl, giampaolo.rodola, josiah.carlson, josiahcarlson
Priority: normal Keywords: patch

Created on 2007-12-02 17:54 by giampaolo.rodola, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
asyncore.diff giampaolo.rodola, 2007-12-02 17:54
Messages (5)
msg58093 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2007-12-02 17:54
asyncore's module readwrite() function, used when invoking
asyncore.loop(use_poll=1), erroneously calls handle_read_event() when
receiving OOB (Out Of Band) data. handle_expt_event() should be called
The patch in attachment does that.

In addition I strongly think that POLLERR, POLLHUP and POLLNVAL events
handling is incorrect too.
As far as I read from here:
...they refers to the following events:

POLLERR 	An error has occurred (revents only).
POLLHUP 	Device has been disconnected ( revents only).
POLLNVAL	Invalid fd member (revents only).

They are actually associated to handle_expt_event() and this is
incorrect since it should be called only when receiving OOB data.

        if flags & (select.POLLERR | select.POLLHUP | select.POLLNVAL):

I'm not sure what should be called instead, if handle_read_event or
handle_read or handle_error.

I tried to take a look at how Twisted manages the thing but it seems
that OOB is not even supported.
Maybe someone with more experience in using select.poll could clarify that.
msg74167 - (view) Author: Josiah Carlson (josiahcarlson) * (Python triager) Date: 2008-10-02 15:58
While handle_expt() is documented has only being called when OOB data is 
known, it has become the catch-all for "something strange is happening 
on the socket".

The reason it wasn't changed/fixed in Python 2.6 is because a new method 
would need to be added, which would break previously existing asyncore-
derived applications.

I might still be able to fix it for 3.0 .
msg74170 - (view) Author: Josiah Carlson (josiahcarlson) * (Python triager) Date: 2008-10-02 16:12
3.0 is a no-go, no non-documentation changes allowed.
msg76831 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2008-12-03 16:31
This is a duplicate of #4501 which provides a better patch.
msg86779 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-04-29 07:19
Setting #4501 as superseder.
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45882
2009-04-29 07:19:38georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg86779

superseder: asyncore's urgent data management and connection closed events are broken when using poll()
resolution: out of date
2008-12-03 16:31:40giampaolo.rodolasetmessages: + msg76831
2008-10-02 16:12:24josiahcarlsonsetmessages: + msg74170
2008-10-02 15:58:40josiahcarlsonsetassignee: akuchling -> josiahcarlson
messages: + msg74167
nosy: + josiahcarlson
2008-10-01 11:31:24giampaolo.rodolasetnosy: + josiah.carlson
2008-01-28 20:55:11akuchlingsetassignee: akuchling
nosy: + akuchling
2008-01-28 20:55:00akuchlingsetkeywords: + patch
2007-12-02 17:54:16giampaolo.rodolacreate