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:

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 jdemeyer 9 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 9 years ago by jdemeyer

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

Changed 9 years ago by jdemeyer

comment:2 Changed 9 years ago by jdemeyer

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 jdemeyer

  • Authors set to Jeroen Demeyer
  • Status changed from new to needs_review

comment:4 Changed 9 years ago by jdemeyer

  • Summary changed from multiprocessing and sig_block don't interact well to Fix sig_block() doctest

comment:5 Changed 9 years ago by vbraun

  • 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 jdemeyer

  • Merged in set to sage-5.6.beta3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.