#13437: Clean up SIGALRM handling in p_iter_fork
-------------------------------+--------------------------------------------
Reporter: nbruin | Owner: tbd
Type: defect | Status: new
Priority: minor | Milestone: sage-5.4
Component: performance | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
-------------------------------+--------------------------------------------
Comment (by SimonKing):
Replying to [comment:5 jdemeyer]:
> Apply [attachment:13437_ALRM_no_interrupt.patch] and call
> {{{
> sage.ext.c_lib.SIGALRM_set_interruptible(0)
> }}}
> '''after every call''' to `signal.signal(SIGALRM,...)` to disable the
interrupting of system calls due to `SIGALRM` (not sure whether you want
this, though).
I applied the patch and changed sage/parallel/use_fork.py as follows (this
should cover all instances of `signal.signal(SIGALRM,...)` in that file):
{{{
diff --git a/sage/parallel/use_fork.py b/sage/parallel/use_fork.py
--- a/sage/parallel/use_fork.py
+++ b/sage/parallel/use_fork.py
@@ -11,6 +11,8 @@
# http://www.gnu.org/licenses/
################################################################################
+from sage.ext.c_lib import SIGALRM_set_interruptible
+
class p_iter_fork:
"""
A parallel iterator implemented using ``fork()``.
@@ -105,6 +107,7 @@
#and install our handler (saving the old one!)
sigalrm_orig=signal.signal(signal.SIGALRM,my_alrm_handler)
+ SIGALRM_set_interruptible(0)
try:
while len(v) > 0 or len(workers) > 0:
# Spawn up to n subprocesses
@@ -179,6 +182,7 @@
finally:
signal.signal(signal.SIGALRM,sigalrm_orig) #restore original
SIGALRM handler
+ SIGALRM_set_interruptible(0)
# Clean up all temporary files.
try:
for X in os.listdir(dir):
}}}
However, the signal 11 problem persists.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13437#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.