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:

Status badges


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

It will result in the following being printed (though your Sage process survives since the segfault occurs in a chile process):


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)

13748_fix_sig_block_test.patch (3.2 KB) - added by Jeroen Demeyer 10 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 10 years ago by Jeroen Demeyer

I found the culprit. Putting all the code inside try:/except: instead of just sig_on() fixes the problem.

Changed 10 years ago by Jeroen Demeyer

comment:2 Changed 10 years ago by Jeroen Demeyer

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 Jeroen Demeyer

Authors: Jeroen Demeyer
Status: newneeds_review

comment:4 Changed 10 years ago by Jeroen Demeyer

Summary: multiprocessing and sig_block don't interact wellFix sig_block() doctest

comment:5 Changed 10 years ago by Volker Braun

Reviewers: Volker Braun
Status: needs_reviewpositive_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 Jeroen Demeyer

Merged in: sage-5.6.beta3
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.