Opened 9 years ago
Closed 9 years ago
#13748 closed defect (fixed)
Fix sig_block() doctest
Reported by: | roed | Owned by: | jdemeyer |
---|---|---|---|
Priority: | major | Milestone: | sage-5.6 |
Component: | c_lib | Keywords: | |
Cc: | kini, ohanar, jhpalmieri, jdemeyer | 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 9 years ago by
Changed 9 years ago by
comment:2 Changed 9 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 9 years ago by
- Status changed from new to needs_review
comment:4 Changed 9 years ago by
- Summary changed from multiprocessing and sig_block don't interact well to Fix sig_block() doctest
comment:5 Changed 9 years ago by
- Reviewers set to Volker Braun
- Status changed from needs_review to 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 9 years ago by
- Merged in set to sage-5.6.beta3
- Resolution set to fixed
- Status changed from positive_review to closed
I found the culprit. Putting all the code inside
try:/except:
instead of justsig_on()
fixes the problem.