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

handle_close called twice in poll2 #57581

Closed
xdegaye mannequin opened this issue Nov 8, 2011 · 2 comments
Closed

handle_close called twice in poll2 #57581

xdegaye mannequin opened this issue Nov 8, 2011 · 2 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Nov 8, 2011

BPO 13372
Nosy @giampaolo, @xdegaye
Superseder
  • bpo-45552: Close asyncore/asynchat/smtpd issues and list them here
  • Files
  • handle_close.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 = None
    closed_at = <Date 2021-10-21.11:31:21.822>
    created_at = <Date 2011-11-08.17:32:12.491>
    labels = ['type-bug', 'library']
    title = 'handle_close called twice in poll2'
    updated_at = <Date 2021-10-21.11:31:21.822>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2021-10-21.11:31:21.822>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-21.11:31:21.822>
    closer = 'iritkatriel'
    components = ['Library (Lib)']
    creation = <Date 2011-11-08.17:32:12.491>
    creator = 'xdegaye'
    dependencies = []
    files = ['23634']
    hgrepos = []
    issue_num = 13372
    keywords = ['patch']
    message_count = 2.0
    messages = ['147311', '221136']
    nosy_count = 4.0
    nosy_names = ['giampaolo.rodola', 'stutzbach', 'neologix', 'xdegaye']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = '45552'
    type = 'behavior'
    url = 'https://bugs.python.org/issue13372'
    versions = ['Python 3.4', 'Python 3.5']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 8, 2011

    When use_poll is True, test_handle_close in test_asyncore.py invokes
    twice the handle_close() method.

    The attached patch:

    modifies test_handle_close so that it fails when handle_close() is
    called more than once
    
    includes a fix that makes readwrite() behave like poll(): check
    that the dispatcher instance is still in the socket map, before
    calling the handle_xxx methods
    

    @xdegaye xdegaye mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Nov 8, 2011
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jun 21, 2014

    To me the patched code in readwrite seems cut and paste. Could it be written something like this?

    have_fileno = not map or obj._fileno in map
    if have_fileno and flags & select.POLLIN:
        obj.handle_read_event()
    if have_fileno and flags & select.POLLOUT:
        obj.handle_write_event()
    if have_fileno and flags & select.POLLPRI:
        obj.handle_expt_event()
    if (have_fileno and flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
         obj.handle_close()

    @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

    1 participant