Opened 10 years ago

Closed 8 years ago

#11338 closed defect (duplicate)

Fix signals/interrupts in sage-doctest

Reported by: jdemeyer Owned by: tbd
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: scripts Keywords:
Cc: kini Merged in:
Authors: Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

When a doctest gets the dreaded Unhandled SIGSEGV..., the doctest script doesn't know how to handle this if the killed process is the child of /bin/sh, not /bin/sh itself. Newer versions of bash automatically do execve() instead of fork() when there is only one command to run, so the problem does not appear then. The fix is to always exec or even better, not using a shell at all. Consider sigdie.py. Running this on forking shells gives:

sage -t  "/home/jdemeyer/sigdie.py"
/home/jdemeyer/sage/sage-4.7.alpha5/local/lib/libcsage.so(print_backtrace+0x31)[0x7f66bf2dd415]
[...]
/lib/libpython2.6.so.1.0(Py_Main+0xb4e)[0x7f66c2aa4e7e]
/lib/libc.so.6(__libc_start_main+0xf4)[0x7f66c1da11c4]
python[0x400619]

------------------------------------------------------------------------
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.
------------------------------------------------------------------------
Segmentation fault

         [2.8 s]

----------------------------------------------------------------------
The following tests failed:


        sage -t  "/home/jdemeyer/sigdie.py"
Total time for all tests: 2.9 seconds

when it should give:

sage -t  "devel/sage/sage/testdoctest/sigdie.py"
The doctested process was killed by signal 11
         [6.3 s]

----------------------------------------------------------------------
The following tests failed:


        sage -t  "devel/sage/sage/testdoctest/sigdie.py" # Killed/crashed
Total time for all tests: 6.4 seconds

Another sympton is that a doctest TIME OUT kills the wrong process: it kills the shell, not the actual Python command.

Attachments (1)

sigdie.py (92 bytes) - added by jdemeyer 10 years ago.
Doctest showing the failure (1)

Download all attachments as: .zip

Change History (14)

comment:1 Changed 10 years ago by jdemeyer

  • Component changed from PLEASE CHANGE to scripts
  • Description modified (diff)
  • Summary changed from Fix signal/interrupts in sage-doctest to Fix signals/interrupts in sage-doctest
  • Type changed from PLEASE CHANGE to defect

comment:2 Changed 10 years ago by jdemeyer

  • Description modified (diff)

comment:3 Changed 10 years ago by jdemeyer

  • Description modified (diff)

Changed 10 years ago by jdemeyer

Doctest showing the failure (1)

comment:4 Changed 10 years ago by jdemeyer

  • Description modified (diff)

comment:5 Changed 10 years ago by jdemeyer

  • Description modified (diff)

comment:6 Changed 10 years ago by jdemeyer

  • Description modified (diff)

comment:7 Changed 10 years ago by jdemeyer

  • Description modified (diff)

comment:8 Changed 10 years ago by jdemeyer

  • Description modified (diff)

comment:9 Changed 9 years ago by jdemeyer

  • Description modified (diff)
  • Priority changed from major to critical

comment:10 Changed 9 years ago by kini

  • Cc kini added

comment:11 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.8 to sage-duplicate/invalid/wontfix
  • Reviewers set to Jeroen Demeyer
  • Status changed from new to needs_review

Superseded by #12415.

comment:12 Changed 8 years ago by jdemeyer

  • Status changed from needs_review to positive_review

comment:13 Changed 8 years ago by jdemeyer

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.