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

PEP 475: handle EINTR in the signal module #67903

Closed
vstinner opened this issue Mar 20, 2015 · 8 comments
Closed

PEP 475: handle EINTR in the signal module #67903

vstinner opened this issue Mar 20, 2015 · 8 comments

Comments

@vstinner
Copy link
Member

BPO 23715
Nosy @vstinner
Files
  • sigtimedwait_eintr.patch
  • signal_eintr.patch
  • 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 2015-03-20.12:10:39.245>
    created_at = <Date 2015-03-20.01:13:29.026>
    labels = []
    title = 'PEP 475: handle EINTR in the signal module'
    updated_at = <Date 2015-03-27.13:36:01.527>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2015-03-27.13:36:01.527>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-03-20.12:10:39.245>
    closer = 'vstinner'
    components = []
    creation = <Date 2015-03-20.01:13:29.026>
    creator = 'vstinner'
    dependencies = []
    files = ['38583', '38588']
    hgrepos = []
    issue_num = 23715
    keywords = ['patch']
    message_count = 8.0
    messages = ['238595', '238596', '238620', '238651', '238656', '238659', '238663', '239403']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue23715'
    versions = ['Python 3.5']

    @vstinner
    Copy link
    Member Author

    Attached patch changes signal.sigtimedwait() to retry if sigtimedwait() failed with EINTR and the signal handler didn't raise an exception.

    @vstinner
    Copy link
    Member Author

    It looks like signal.sigwaitinfo() can also fail with InterruptedError. It should also be modified.

    @vstinner vstinner changed the title PEP 475: signal.sigtimedwait() must retry if sigtimedwait() failed with EINTR PEP 475: handle EINTR in the signal module Mar 20, 2015
    @vstinner
    Copy link
    Member Author

    signal_eintr.py: More complete patch, modify also signal.sigwaitinfo().

    --

    I don't think that other signal functions need to be modified to handle EINTR.

    POSIX manual pages:

    • "The pthread_sigmask() function shall not return an error code of [EINTR]."
    • "The pthread_kill() function shall not return an error code of [EINTR]."

    pause() fails with EINTR when it receives a signal, but signal.pause() doesn't raise InterruptedError in this case, it only returns None, because we expect a signal.

    I tested: signal.sigwait([]) doesn't fail with EINTR with a signal is received. No need to modify this function.

    On Linux, signal.set_wakeup_fd() doesn't fail with InterruptedError.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 20, 2015

    New changeset 33a6e2587aad by Victor Stinner in branch 'default':
    Issue bpo-23715: signal.sigwaitinfo() and signal.sigtimedwait() are now retried
    https://hg.python.org/cpython/rev/33a6e2587aad

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 20, 2015

    New changeset 8f9925a02fe7 by Victor Stinner in branch 'default':
    Issue bpo-23715: Enhance test.script_helper to investigate test_eintr failure
    https://hg.python.org/cpython/rev/8f9925a02fe7

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 20, 2015

    New changeset 79aed09a9fa5 by Victor Stinner in branch 'default':
    Issue bpo-23715: Fix test_eintr, skip tests on signal.sigwaitinfo() and
    https://hg.python.org/cpython/rev/79aed09a9fa5

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 20, 2015

    New changeset ed8c2a4a6d3d by Victor Stinner in branch 'default':
    Issue bpo-23715: Fix test_script_helper
    https://hg.python.org/cpython/rev/ed8c2a4a6d3d

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 27, 2015

    New changeset 35bc15fa4930 by Victor Stinner in branch 'default':
    Issue bpo-23715: Fix test_sigtimedwait() of test_eintr
    https://hg.python.org/cpython/rev/35bc15fa4930

    @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
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant