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

select.epoll.unregister(fd) should not ignore EBADF #83420

Closed
vstinner opened this issue Jan 6, 2020 · 2 comments
Closed

select.epoll.unregister(fd) should not ignore EBADF #83420

vstinner opened this issue Jan 6, 2020 · 2 comments
Labels
3.9 only security fixes stdlib Python modules in the Lib dir

Comments

@vstinner
Copy link
Member

vstinner commented Jan 6, 2020

BPO 39239
Nosy @vstinner, @tiran
PRs
  • bpo-39239: epoll.unregister() no longer ignores EBADF #17882
  • 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 2020-01-07.20:41:57.629>
    created_at = <Date 2020-01-06.23:34:48.175>
    labels = ['library', '3.9']
    title = 'select.epoll.unregister(fd) should not ignore EBADF'
    updated_at = <Date 2020-01-07.20:41:57.629>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-01-07.20:41:57.629>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-01-07.20:41:57.629>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2020-01-06.23:34:48.175>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39239
    keywords = ['patch']
    message_count = 2.0
    messages = ['359481', '359511']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'christian.heimes']
    pr_nums = ['17882']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue39239'
    versions = ['Python 3.9']

    @vstinner
    Copy link
    Member Author

    vstinner commented Jan 6, 2020

    The select.epoll.unregister(fd) method currently ignores EBADF error if the file descriptor fd is invalid.

    I'm surprised by this undocumented behavior:
    https://docs.python.org/dev/library/select.html#select.epoll.unregister

    This behavior may lead to bugs if the file descriptor number has been recycled in the meanwhile. I'm not sure that it's a good idea to silently ignore the error.

    See bpo-18748 for a similar issue: "io.IOBase destructor silence I/O error on close() by default".

    Note: The method also ignores EBADF error if the epoll file descriptor has been closed.

    The behavior is as old as the implementation of select.epoll, bpo-1657:

    commit 0e9ab5f
    Author: Christian Heimes <christian@cheimes.de>
    Date: Fri Mar 21 23:49:44 2008 +0000

    Applied patch bpo-1657 epoll and kqueue wrappers for the select module
    The patch adds wrappers for the Linux epoll syscalls and the BSD kqueue syscalls. Thanks to Thomas Herve and the Twisted people for their support a
    

    nd help.
    TODO: Finish documentation documentation

    Thomas Herve wrote a first implementation in bpo-1675118, but it seems like it was Christian Heimes who wrote the unregister() method.

    @vstinner vstinner added 3.9 only security fixes stdlib Python modules in the Lib dir labels Jan 6, 2020
    @vstinner
    Copy link
    Member Author

    vstinner commented Jan 7, 2020

    New changeset 5b23f76 by Victor Stinner in branch 'master':
    bpo-39239: epoll.unregister() no longer ignores EBADF (GH-17882)
    5b23f76

    @vstinner vstinner closed this as completed Jan 7, 2020
    @vstinner vstinner closed this as completed Jan 7, 2020
    @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
    3.9 only security fixes stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant