#33706 closed defect (fixed)
GIAC kills process 1 in ctrl_c_signal_handler
Reported by:  Matthias Köppe  Owned by:  

Priority:  blocker  Milestone:  sage9.6 
Component:  doctest framework  Keywords:  
Cc:  Tobias Diez, Michael Orlitzky, Bernard Parisse, Gonzalo Tornaría, Volker Braun, Dima Pasechnik  Merged in:  
Authors:  Matthias Koeppe  Reviewers:  Volker Braun 
Report Upstream:  N/A  Work issues:  
Branch:  ecd3895 (Commits, GitHub, GitLab)  Commit:  
Dependencies:  Stopgaps: 
Description (last modified by )
On ubuntujammystandard
(https://github.com/sagemath/sage/runs/5962279659)
sage t randomseed=156404901056981760924144629149815074678 src/sage/tests/cmdline.py [216 tests, 73.54 s]  All tests passed!  Total time for all tests: 3739.0 seconds cpu time: 6427.0 seconds cumulative wall time: 10155.6 seconds Features detected for doctesting: gfan,nauty,palp,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.plot,sage.rings.number_field,sage.rings.padics,sage.rings.real_double,sage.symbolic,sagemath_doc_html,sphinx ============================= test session starts ============================== platform linux  Python 3.10.4, pytest7.1.1, pluggy1.0.0 rootdir: /sage/src, configfile: tox.ini collected 26 items / 104 skipped src/sage/manifolds/differentiable/symplectic_form_test.py .............. [ 53%] ........ [ 84%] src/sage/manifolds/differentiable/examples/symplectic_space_test.py .... [100%] ================= 26 passed, 104 skipped in 102.79s (0:01:42) ================== The command '/bin/sh c make SAGE_SPKG="sagespkg y o" ${USE_MAKEFLAGS} ${TARGETS_OPTIONAL}  echo "(error ignored)"' returned a nonzero code: 130
Likewise on gitpodstandard
, debianbookwormstandard
, linuxmint20.1standard
.
On linuxmint19standard
(https://github.com/sagemath/sage/runs/5962280173?check_suite_focus=true), the exit code is 2.
Change History (22)
comment:1 Changed 8 months ago by
Description:  modified (diff) 

comment:3 Changed 8 months ago by
Cc:  Michael Orlitzky added 

Summary:  sage t: Bad exit code from pytest → sage t src/sage/calculus/calculus.py: Exit code 130 
The problem can be reproduced about 1 in 5 times using /bin/bash c './sage t src/sage/calculus/calculus.py'
.
A giac
process sends SIGINT to the whole process group, sometimes succeeding to take down the calling bash
, which then gives exit code 130.
comment:5 Changed 8 months ago by
An easy way to reproduce: while true; do /bin/bash c './sage t src/sage/calculus/calculus.py'; done
 this infinite loop ends in a finite number of iterations
comment:6 followup: 7 Changed 8 months ago by
With binary search I have obtained the following simple reproducer:
while true; do ./sage c "k, n = var('k,n'); from sage.calculus.calculus import symbolic_sum; print(symbolic_sum(1/(1+k^2), k, oo, oo, algorithm = 'giac')); print(gp.eval('intnum(x=17,42,exp(x^2)*log(x))'))"; done
comment:7 followups: 11 13 Changed 8 months ago by
Even simpler:
while true; do ./sage c "print(giac.eval('1')); print(gp.eval('2'))"; done
comment:8 Changed 8 months ago by
gp
can also be replaced with maxima
or singular
with same results.
Some stracing:
$ while true; do rm f STRAC*; strace ff o STRACE ./sage c "print(giac.eval('1')); print(gp.eval('2'))"; done 1 2 gitpod ~/sage $ echo $? 130 $ grep kill STRA* ... STRACE.99696:kill(1, SIGINT) = 0 ... STRACE.99732:kill(99700, SIGCONT) = 0 STRACE.99732:kill(99700, SIGINT) = 1 ESRCH (No such process) STRACE.99733:kill(99696, SIGCONT) = 0 STRACE.99733:kill(99696, SIGINT) = 0 STRACE.99733:kill(99696, SIGHUP) = 1 ESRCH (No such process)
99696 is the giac
process.
comment:9 Changed 8 months ago by
Cc:  Bernard Parisse added 

Summary:  sage t src/sage/calculus/calculus.py: Exit code 130 → GIAC kills process 1 in ctrl_c_signal_handler 
@parisse
This is happening in https://github.com/geogebra/giac/blob/c2058a0c8921af8a762f6fbede1354b974bf5a70/src/giac/cpp/global.cc#L3761 (although we are still on GIAC 1.6). Somehow child_id
is 1 and it ends up killing the whole process group with SIGINT.
comment:10 Changed 8 months ago by
Cc:  Gonzalo Tornaría added 

comment:11 Changed 8 months ago by
Replying to mkoeppe:
Even simpler:
while true; do ./sage c "print(giac.eval('1')); print(gp.eval('2'))"; done
for me that loop never ends when giac is 1.7.0.47
comment:12 Changed 8 months ago by
I'll try with the upgrade ticket #31563 on this platform. Unfortunately the upgrade is stuck
comment:13 Changed 8 months ago by
Replying to mkoeppe:
Even simpler:
while true; do ./sage c "print(giac.eval('1')); print(gp.eval('2'))"; done
No failure here, tested with giac 1.7.053 or 1.9.05.
comment:14 Changed 8 months ago by
Branch:  → u/mkoeppe/giac_kills_process_1_in_ctrl_c_signal_handler 

comment:15 Changed 8 months ago by
Authors:  → Matthias Koeppe 

Cc:  Volker Braun added 
Commit:  → ecd3895717f1e6434771b670fb710a29613c0855 
Priority:  critical → blocker 
Status:  new → needs_review 
New commits:
ecd3895  build/pkgs/giac/patches/0001srcglobal.ccDonotsendSIGINTtoprocess1.patch: New

comment:16 Changed 8 months ago by
We won't be able to do the upgrade for Sage 9.6 because Cygwin support is unresolved. So here is a hotfix.
comment:17 Changed 8 months ago by
Cc:  Dima Pasechnik added 

comment:18 Changed 8 months ago by
Reviewers:  → Volker Braun 

Status:  needs_review → positive_review 
comment:20 Changed 8 months ago by
Branch:  u/mkoeppe/giac_kills_process_1_in_ctrl_c_signal_handler → ecd3895717f1e6434771b670fb710a29613c0855 

Resolution:  → fixed 
Status:  positive_review → closed 
comment:21 Changed 7 months ago by
Commit:  ecd3895717f1e6434771b670fb710a29613c0855 

This (unsurprisingly) still happens in 9.6.rc3 on systems where the system giac is used: ubuntujammystandard
(https://github.com/sagemath/sage/runs/6236167662, 1.7.0.39+dfsg21build2) and debiansidstandard
.
The exit code 130 from the shell is rather mysterious. Not sure if it really has anything to do with pytest.
It appears to be nondeterministic. I have reproduced it in the container after adding some
print
calls tosrc/bin/sageruntests
to see what the return values of the Sage doctester and pytest are.I think it may be specific to the shell that is used on the systems where the failure was observed.