Opened 6 years ago

Last modified 5 years ago

#14639 new defect

Handling of SIGCHLD within sage

Reported by: Snark Owned by: mvngu
Priority: major Milestone: sage-6.4
Component: doctest coverage Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

It has been noted at #14636 that sage's handling of the SIGCHLD signal is prone to breakage. To doctest whether things are correct, Jeroen Demeyer proposed to add the following to sage/tests/interrupt.pyx:

"""
Show that `SIGCHLD` is completely ignored by default. If the process
`p` finishes, there should be no `SIGCHLD` signal, so ``select()`` will
simply time out::

    sage: from select import select
    sage: import subprocess

    sage: p = subprocess.Popen(["sleep", "1"])  # long time
    sage: select([], [], [], 1.5)               # long time
    ([], [], [])
    sage: p.poll()                              # long time
    0

We now do the same but after installing a dummy `SIGCHLD`
handler::

    sage: import signal
    sage: def dummy_handler(a,b):
    ....:    pass
    sage: signal.signal(signal.SIGCHLD, dummy_handler)  # random
    sage: p = subprocess.Popen(["sleep", "1"])  # long time
    sage: select([], [], [], 1.5)               # long time
    Traceback (most recent call last):
    ...
    error: (4, 'Interrupted system call')
    sage: p.poll()                              # long time
    0

Reset the `SIGCHLD` handler::

    sage: signal.signal(signal.SIGCHLD, signal.SIG_IGN)  # random
"""

Change History (4)

comment:1 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:2 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:3 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:4 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.