Skip to content

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

Closed

Description

@giampaolo
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']

    Activity

    1. giampaolo commented on Dec 2, 2007

      @giampaolo
      ContributorAuthor

      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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Dec 2, 2007
    3. self-assigned this
      on Jan 28, 2008
    4. josiahcarlson commented on Oct 2, 2008

      josiahcarlsonmannequin
      Mannequin

      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 .

    5. josiahcarlson commented on Oct 2, 2008

      josiahcarlsonmannequin
      Mannequin

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

    6. giampaolo commented on Dec 3, 2008

      @giampaolo
      ContributorAuthor

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

    7. birkenfeld commented on Apr 29, 2009

      @birkenfeld
      Member

      Setting bpo-4501 as superseder.

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions