Opened 10 years ago
Closed 10 years ago
#13748 closed defect (fixed)
Fix sig_block() doctest
Reported by: | David Roe | Owned by: | Jeroen Demeyer |
---|---|---|---|
Priority: | major | Milestone: | sage-5.6 |
Component: | c_lib | Keywords: | |
Cc: | Keshav Kini, R. Andrew Ohana, John Palmieri, Jeroen Demeyer | Merged in: | sage-5.6.beta3 |
Authors: | Jeroen Demeyer | Reviewers: | Volker Braun |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The following problem arose while working on #12415. Put the following code in your ~/.sage/init.sage
:
import multiprocessing class Task(multiprocessing.Process): def run(self): sage_namespace = dict(sage.all_cmdline.__dict__) exec compile("from sage.tests.interrupt import *","","single",0,1) in sage_namespace exec compile("test_sig_block()","","single",0,1) in sage_namespace exec compile("sig_on_count()","","single",0,1) in sage_namespace Task().start()
It will result in the following being printed (though your Sage process survives since the segfault occurs in a chile process):
42 0 ------------------------------------------------------------------------ Unhandled SIGSEGV: A segmentation fault occurred in Sage. This probably occurred because a *compiled* component of Sage has a bug in it and is not properly wrapped with sig_on(), sig_off(). You might want to run Sage under gdb with 'sage -gdb' to debug this. Sage will now terminate. ------------------------------------------------------------------------
Typing it in to a running Sage session does not cause the same failure.
Attachments (1)
Change History (7)
comment:1 Changed 10 years ago by
Changed 10 years ago by
Attachment: | 13748_fix_sig_block_test.patch added |
---|
comment:2 Changed 10 years ago by
Apparently, it is illegal to exit a try
block while sig_on()
is in effect.
Patch (which also adds some debug code for sig_block()
/sig_unblock()
) needs review.
comment:3 Changed 10 years ago by
Authors: | → Jeroen Demeyer |
---|---|
Status: | new → needs_review |
comment:4 Changed 10 years ago by
Summary: | multiprocessing and sig_block don't interact well → Fix sig_block() doctest |
---|
comment:5 Changed 10 years ago by
Reviewers: | → Volker Braun |
---|---|
Status: | needs_review → positive_review |
I suppose that it does confuse something on the Python heap when you suddenly jump back into the try/except block?
Patch looks good to me.
comment:6 Changed 10 years ago by
Merged in: | → sage-5.6.beta3 |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
I found the culprit. Putting all the code inside
try:/except:
instead of justsig_on()
fixes the problem.