Skip to content

PEP 475: handle EINTR in the signal module #67903

Closed

Description

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

    Activity

    1. vstinner commented on Mar 20, 2015

      @vstinner
      MemberAuthor

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

    2. vstinner commented on Mar 20, 2015

      @vstinner
      MemberAuthor

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

    3. changed the title [-]PEP 475: signal.sigtimedwait() must retry if sigtimedwait() failed with EINTR[/-] [+]PEP 475: handle EINTR in the signal module[/+] on Mar 20, 2015
    4. vstinner commented on Mar 20, 2015

      @vstinner
      MemberAuthor

      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.

    5. python-dev commented on Mar 20, 2015

      python-devmannequin
      Mannequin

      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

    6. python-dev commented on Mar 20, 2015

      python-devmannequin
      Mannequin

      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

    7. python-dev commented on Mar 20, 2015

      python-devmannequin
      Mannequin

      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

    8. python-dev commented on Mar 20, 2015

      python-devmannequin
      Mannequin

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

    9. python-dev commented on Mar 27, 2015

      python-devmannequin
      Mannequin

      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

    10. 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

    No one assigned

      Labels

      No labels
      No labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions