Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad OOB data management when using asyncore with select.poll() #45882

Closed
giampaolo opened this issue Dec 2, 2007 · 5 comments
Closed

Bad OOB data management when using asyncore with select.poll() #45882

giampaolo opened this issue Dec 2, 2007 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@giampaolo
Copy link
Contributor

BPO 1541
Nosy @akuchling, @birkenfeld, @josiahcarlson, @giampaolo
Superseder
  • bpo-4501: asyncore's urgent data management and connection closed events are broken when using poll()
  • Files
  • asyncore.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/josiahcarlson'
    closed_at = <Date 2009-04-29.07:19:38.421>
    created_at = <Date 2007-12-02.17:54:16.835>
    labels = ['type-bug', 'library']
    title = 'Bad OOB data management when using asyncore with select.poll()'
    updated_at = <Date 2009-04-29.07:19:38.419>
    user = 'https://github.com/giampaolo'

    bugs.python.org fields:

    activity = <Date 2009-04-29.07:19:38.419>
    actor = 'georg.brandl'
    assignee = 'josiahcarlson'
    closed = True
    closed_date = <Date 2009-04-29.07:19:38.421>
    closer = 'georg.brandl'
    components = ['Library (Lib)']
    creation = <Date 2007-12-02.17:54:16.835>
    creator = 'giampaolo.rodola'
    dependencies = []
    files = ['8854']
    hgrepos = []
    issue_num = 1541
    keywords = ['patch']
    message_count = 5.0
    messages = ['58093', '74167', '74170', '76831', '86779']
    nosy_count = 5.0
    nosy_names = ['akuchling', 'georg.brandl', 'josiahcarlson', 'giampaolo.rodola', 'josiah.carlson']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = None
    status = 'closed'
    superseder = '4501'
    type = 'behavior'
    url = 'https://bugs.python.org/issue1541'
    versions = ['Python 2.5']

    @giampaolo
    Copy link
    Contributor Author

    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
    instead.
    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:
    http://www.squarebox.co.uk/cgi-squarebox/manServer/usr/share/man/man0p/poll.h.0p
    ...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):
                obj.handle_expt_event()

    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.

    @giampaolo giampaolo added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Dec 2, 2007
    @akuchling akuchling self-assigned this Jan 28, 2008
    @josiahcarlson
    Copy link
    Mannequin

    josiahcarlson mannequin commented Oct 2, 2008

    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 .

    @josiahcarlson josiahcarlson mannequin assigned josiahcarlson and unassigned akuchling Oct 2, 2008
    @josiahcarlson
    Copy link
    Mannequin

    josiahcarlson mannequin commented Oct 2, 2008

    3.0 is a no-go, no non-documentation changes allowed.

    @giampaolo
    Copy link
    Contributor Author

    This is a duplicate of bpo-4501 which provides a better patch.

    @birkenfeld
    Copy link
    Member

    Setting bpo-4501 as superseder.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants