Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move interrupt.pyx to package cysignals #20002

Closed
malb opened this issue Feb 2, 2016 · 43 comments
Closed

Move interrupt.pyx to package cysignals #20002

malb opened this issue Feb 2, 2016 · 43 comments

Comments

@malb
Copy link
Member

malb commented Feb 2, 2016

Move Sage’s interrupt handling to a separate package: https://github.com/sagemath/cysignals

See also https://groups.google.com/d/topic/sage-devel/oA9NsF26eOA/discussion for a discussion. We need one trivial Cython patch, see cython/cython#483

Tarball: https://github.com/sagemath/cysignals/releases/download/1.0rc2/cysignals-1.0rc2.tar.bz2

Upstream: Reported upstream. No feedback yet.

CC: @jdemeyer @videlec @kiwifb @vbraun

Component: packages: standard

Author: Jeroen Demeyer

Branch/Commit: 4677a93

Reviewer: Martin Albrecht

Issue created by migration from https://trac.sagemath.org/ticket/20002

@malb malb added this to the sage-7.1 milestone Feb 2, 2016
@videlec
Copy link
Contributor

videlec commented Feb 2, 2016

comment:1

I am interested, partly because of pplpy.

@jdemeyer
Copy link

jdemeyer commented Feb 4, 2016

comment:2

This is certainly something that I would like to work on, I think it fits very well with OpenDreamKit/OpenDreamKit#52.

@malb

This comment has been minimized.

@jdemeyer
Copy link

jdemeyer commented Feb 6, 2016

comment:4

Cool! I guess the next step is to figure out how to actually make this signals.pyx available to external packages (you need to install the .pxd, .pxi and .h files).

I think it would be very useful to have an example package using signals.pyx. Both as documentation, but also as an additional test.

@malb
Copy link
Member Author

malb commented Feb 7, 2016

comment:5

I created a cysignals branch for fpylll which uses the new cysignals.

@malb

This comment has been minimized.

@jdemeyer
Copy link

Author: Jeroen Demeyer

@jdemeyer

This comment has been minimized.

@jdemeyer jdemeyer changed the title stand-alone interrupt.pyx Move interrupt.pyx to package cysignals Feb 10, 2016
@jdemeyer
Copy link

Dependencies: #20021

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

Upstream: Reported upstream. No feedback yet.

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 11, 2016

Commit: 434b272

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 11, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

aee6a5fCheck that sig_on()/sig_off() works in .spyx files
434b272cysignals depends on PARI

@jdemeyer
Copy link

comment:15

@vbraun: please test on buildbots.

@malb
Copy link
Member Author

malb commented Feb 11, 2016

comment:16

Couldn't we use the include_path=sys.path trick to avoid patching Cython, just in case they don't accept the pull request?

@jdemeyer
Copy link

comment:17

Replying to @malb:

Couldn't we use the include_path=sys.path trick to avoid patching Cython, just in case they don't accept the pull request?

The problem is that we have to support:

  1. the Sage library
  2. the cython(...) command
  3. the %cython notebook magic
  4. ./sage somefile.spyx
  5. external spkgs using cysignals

Instead of patching all these, I think it is much cleaner to apply just the Cython patch.

@malb
Copy link
Member Author

malb commented Feb 11, 2016

comment:18

Makes sense to me.

@jdemeyer
Copy link

Changed dependencies from #20021 to none

@malb
Copy link
Member Author

malb commented Feb 15, 2016

comment:20

Building a fresh Sage installation and running make ptestlong works on 64-bit Debian/GNU Linux.

@malb
Copy link
Member Author

malb commented Feb 15, 2016

comment:21
  • What is our convention for dependencies in SPKG.txt, shall we mention Pari?
  • I'm no fan of "init_interrupts -> init_cysignals". Why not fix up cysignals if that's needed?

@jdemeyer

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 18, 2016

Changed commit from 741db03 to c6fdc05

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 18, 2016

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

c6fdc05cysignals version 1.0rc1

@vbraun
Copy link
Member

vbraun commented Feb 18, 2016

comment:35

The test is now hanging for half an hour on my desktop:

buildsl+ 11539  0.0  0.0 117516  3068 ?        SN   Feb18   0:00 bash ./install start
buildsl+ 11568  0.0  0.0 115080  2948 ?        SN   Feb18   0:00 make -j8 start
buildsl+ 11576  0.0  0.0 116776  4588 ?        SN   Feb18   0:00 make -j8 all-sage
vbraun   13964  0.0  0.0 117000  2256 pts/4    S+   00:30   0:00 grep --color=auto buildsl
buildsl+ 24718  0.0  0.0 117512  3144 ?        SN   Feb18   0:00 bash /mnt/disk/home/buildslave-sage/slave/sage_git/build/build/bin/sage-logger sage-spkg cysignals-1.0rc1 /mnt/disk/home/buildslave-sage/slave/sage_git/build/logs/pkgs/cysignals-1.0rc1.log
buildsl+ 24735  0.0  0.0 117512  1828 ?        SN   Feb18   0:00 bash /mnt/disk/home/buildslave-sage/slave/sage_git/build/build/bin/sage-logger sage-spkg cysignals-1.0rc1 /mnt/disk/home/buildslave-sage/slave/sage_git/build/logs/pkgs/cysignals-1.0rc1.log
buildsl+ 24737  0.0  0.0 117512   220 ?        SN   Feb18   0:00 bash /mnt/disk/home/buildslave-sage/slave/sage_git/build/build/bin/sage-logger sage-spkg cysignals-1.0rc1 /mnt/disk/home/buildslave-sage/slave/sage_git/build/logs/pkgs/cysignals-1.0rc1.log
buildsl+ 24739  0.0  0.0 112180  1856 ?        SN   Feb18   0:00 tee -a /mnt/disk/home/buildslave-sage/slave/sage_git/build/logs/pkgs/cysignals-1.0rc1.log
buildsl+ 24740  0.0  0.0 117648  3120 ?        SN   Feb18   0:00 bash /mnt/disk/home/buildslave-sage/slave/sage_git/build/build/bin/sage-spkg cysignals-1.0rc1
buildsl+ 25822  0.0  0.0   9636  2456 ?        SN   Feb18   0:00 bash ./spkg-check
buildsl+ 25823  0.0  0.0   6720  1980 ?        SN   Feb18   0:00 make check
buildsl+ 25828  0.1  0.0 116652 18112 ?        SN   Feb18   0:08 python -m doctest src/cysignals/alarm.pyx src/cysignals/signals.pyx src/cysignals/tests.pyx

After killing it

cd example && python setup.py build
Compiling cysignals_example.pyx because it changed.
[1/1] Cythonizing cysignals_example.pyx
running build
running build_ext
building 'cysignals_example' extension
creating build
creating build/temp.linux-x86_64-2.7-pydebug
gcc -fno-strict-aliasing -g -O2 -g -O0 -Wall -Wno-unused -fPIC -I/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/cysignals -I/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/include/python2.7 -c cysignals_example.c -o build/temp.linux-x86_64-2.7-pydebug/cysignals_example.o
creating build/lib.linux-x86_64-2.7-pydebug
gcc -pthread -shared -L/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib -Wl,-rpath,/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib -L/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib -Wl,-rpath,/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib build/temp.linux-x86_64-2.7-pydebug/cysignals_example.o -L/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib -lpython2.7 -o build/lib.linux-x86_64-2.7-pydebug/cysignals_example.so -lpari -Ddummy
Makefile:40: recipe for target 'check-doctest' failed
make[3]: *** [check-doctest] Terminated
make[3]: Target 'check' not remade because of errors.
make[3]: Leaving directory '/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/var/tmp/sage/build/cysignals-1.0rc1/src'

GDB

(gdb) bt
#0  0x00007fb1ed0f24ec in __lll_lock_wait_private () from /lib64/libc.so.6
#1  0x00007fb1ed05f863 in ptmalloc_lock_all () from /lib64/libc.so.6
#2  0x00007fb1ed0aa832 in fork () from /lib64/libc.so.6
#3  0x00007fb1e786b957 in signal_pid_after_delay (signum=2, killpid=16455, ms=200, 
    interval=0, n=1) at src/cysignals/tests_helper.c:66
#4  0x00007fb1e7875934 in __pyx_pf_9cysignals_5tests_70test_signal_during_malloc (
    __pyx_self=0x0, __pyx_v_delay=200) at build/src/cysignals/tests.c:7948
#5  0x00007fb1e78758a1 in __pyx_pw_9cysignals_5tests_71test_signal_during_malloc (
    __pyx_self=0x0, __pyx_args=0x7fb1ee2eb060, __pyx_kwds=0x0)
    at build/src/cysignals/tests.c:7894
#6  0x00007fb1edd7d798 in PyCFunction_Call (func=0x7fb1e7828678, arg=0x7fb1ee2eb060, kw=0x0)
    at Objects/methodobject.c:85
#7  0x00007fb1ede23bf6 in call_function (pp_stack=0x7ffc6fbe3110, oparg=0)
    at Python/ceval.c:4035
#8  0x00007fb1ede1e642 in PyEval_EvalFrameEx (f=0x7fb1e90727e0, throwflag=0)
    at Python/ceval.c:2681
#9  0x00007fb1ede2110b in PyEval_EvalCodeEx (co=0x7fb1e7844460, globals=0x7fb1e783fe78, 
    locals=0x7fb1e783fe78, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, 
    closure=0x0) at Python/ceval.c:3267
#10 0x00007fb1ede16998 in PyEval_EvalCode (co=0x7fb1e7844460, globals=0x7fb1e783fe78, 
    locals=0x7fb1e783fe78) at Python/ceval.c:669
#11 0x00007fb1ede2671b in exec_statement (f=0x2054750, prog=0x7fb1e7844460, 
    globals=0x7fb1e783fe78, locals=0x7fb1e783fe78) at Python/ceval.c:4732
#12 0x00007fb1ede1acea in PyEval_EvalFrameEx (f=0x2054750, throwflag=0) at Python/ceval.c:1883
#13 0x00007fb1ede2110b in PyEval_EvalCodeEx (co=0x7fb1ecd59b40, globals=0x7fb1ee2df958, 
    locals=0x0, args=0x2050a28, argcount=4, kws=0x2050a48, kwcount=0, defs=0x0, defcount=0, 
    closure=0x0) at Python/ceval.c:3267
#14 0x00007fb1ede24233 in fast_function (func=0x7fb1e9076ae0, pp_stack=0x7ffc6fbe3a20, n=4, 
    na=4, nk=0) at Python/ceval.c:4131
#15 0x00007fb1ede23e00 in call_function (pp_stack=0x7ffc6fbe3a20, oparg=3)
    at Python/ceval.c:4056
---Type <return> to continue, or q <return> to quit---
#16 0x00007fb1ede1e642 in PyEval_EvalFrameEx (f=0x2050860, throwflag=0) at Python/ceval.c:2681
#17 0x00007fb1ede2110b in PyEval_EvalCodeEx (co=0x7fb1ecd59d50, globals=0x7fb1ee2df958, 
    locals=0x0, args=0x203fe20, argcount=2, kws=0x203fe30, kwcount=0, defs=0x7fb1e9075c88, 
    defcount=3, closure=0x0) at Python/ceval.c:3267
#18 0x00007fb1ede24233 in fast_function (func=0x7fb1e9076cd8, pp_stack=0x7ffc6fbe3ee0, n=2, 
    na=2, nk=0) at Python/ceval.c:4131
#19 0x00007fb1ede23e00 in call_function (pp_stack=0x7ffc6fbe3ee0, oparg=1)
    at Python/ceval.c:4056
#20 0x00007fb1ede1e642 in PyEval_EvalFrameEx (f=0x203fc20, throwflag=0) at Python/ceval.c:2681
#21 0x00007fb1ede2110b in PyEval_EvalCodeEx (co=0x7fb1ec8eda90, globals=0x7fb1ee2df958, 
    locals=0x0, args=0x1fa72a8, argcount=1, kws=0x1fa72b0, kwcount=1, defs=0x7fb1eba93988, 
    defcount=11, closure=0x0) at Python/ceval.c:3267
#22 0x00007fb1ede24233 in fast_function (func=0x7fb1e90795a0, pp_stack=0x7ffc6fbe43a0, n=3, 
    na=1, nk=1) at Python/ceval.c:4131
#23 0x00007fb1ede23e00 in call_function (pp_stack=0x7ffc6fbe43a0, oparg=257)
    at Python/ceval.c:4056
#24 0x00007fb1ede1e642 in PyEval_EvalFrameEx (f=0x1fa70d0, throwflag=0) at Python/ceval.c:2681
#25 0x00007fb1ede24119 in fast_function (func=0x7fb1e907be28, pp_stack=0x7ffc6fbe46d0, n=0, 
    na=0, nk=0) at Python/ceval.c:4121
#26 0x00007fb1ede23e00 in call_function (pp_stack=0x7ffc6fbe46d0, oparg=0)
    at Python/ceval.c:4056
#27 0x00007fb1ede1e642 in PyEval_EvalFrameEx (f=0x1e551a0, throwflag=0) at Python/ceval.c:2681
#28 0x00007fb1ede2110b in PyEval_EvalCodeEx (co=0x7fb1ec8f7d50, globals=0x7fb1ee2df958, 
    locals=0x7fb1ee2df958, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, 
    closure=0x0) at Python/ceval.c:3267
#29 0x00007fb1ede16998 in PyEval_EvalCode (co=0x7fb1ec8f7d50, globals=0x7fb1ee2df958, 
    locals=0x7fb1ee2df958) at Python/ceval.c:669
#30 0x00007fb1ede2671b in exec_statement (f=0x1f8cb20, prog=0x7fb1ec8f7d50, 
    globals=0x7fb1ee2df958, locals=0x7fb1ee2df958) at Python/ceval.c:4732
#31 0x00007fb1ede1acea in PyEval_EvalFrameEx (f=0x1f8cb20, throwflag=0) at Python/ceval.c:1883
#32 0x00007fb1ede2110b in PyEval_EvalCodeEx (co=0x7fb1ecd62930, globals=0x7fb1ecd806c8, 
---Type <return> to continue, or q <return> to quit---
    locals=0x0, args=0x1ede0c8, argcount=7, kws=0x1ede100, kwcount=0, defs=0x7fb1ecd65aa8, 
    defcount=5, closure=0x0) at Python/ceval.c:3267
#33 0x00007fb1ede24233 in fast_function (func=0x7fb1ecd8d300, pp_stack=0x7ffc6fbe4fe0, n=7, 
    na=7, nk=0) at Python/ceval.c:4131
#34 0x00007fb1ede23e00 in call_function (pp_stack=0x7ffc6fbe4fe0, oparg=7)
    at Python/ceval.c:4056
#35 0x00007fb1ede1e642 in PyEval_EvalFrameEx (f=0x1eddef0, throwflag=0) at Python/ceval.c:2681
#36 0x00007fb1ede2110b in PyEval_EvalCodeEx (co=0x7fb1ecd7e1a0, globals=0x7fb1ecd806c8, 
    locals=0x0, args=0x7fb1ecda4da8, argcount=2, kws=0x0, kwcount=0, defs=0x7fb1ecd85e18, 
    defcount=1, closure=0x0) at Python/ceval.c:3267
#37 0x00007fb1edd5996f in function_call (func=0x7fb1ecd90b88, arg=0x7fb1ecda4d80, kw=0x0)
    at Objects/funcobject.c:526
#38 0x00007fb1edd19a7c in PyObject_Call (func=0x7fb1ecd90b88, arg=0x7fb1ecda4d80, kw=0x0)
    at Objects/abstract.c:2529
#39 0x00007fb1ede6e49c in RunModule (module=0x1e55010 "doctest", set_argv0=1)
    at Modules/main.c:192
#40 0x00007fb1ede6f42b in Py_Main (argc=6, argv=0x7ffc6fbe55c8) at Modules/main.c:587
#41 0x0000000000400846 in main (argc=6, argv=0x7ffc6fbe55c8) at ./Modules/python.c:23

Retried and hangs again at same spot.

This is a debug Python build (SAGE_DEBUG=yes)

@kiwifb
Copy link
Member

kiwifb commented Feb 19, 2016

comment:36

Considering the change between rc0 and rc1 it is very strange if it didn't happen before.

@jdemeyer
Copy link

comment:37

It's also surprising that it doesn't happen with the interrupt code currently in Sage... it's the same code as in cysignals.

@jdemeyer
Copy link

comment:38

The malloc() problem is genuine. I will update cysignals.

@jdemeyer

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 19, 2016

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

4677a93cysignals version 1.0rc2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 19, 2016

Changed commit from c6fdc05 to 4677a93

@jdemeyer
Copy link

comment:42

I disabled the failing malloc() test. Eventually we should move sage_malloc() and friends to cysignals too and re-enable the test.

@jdemeyer
Copy link

comment:43

needs review...

@kiwifb
Copy link
Member

kiwifb commented Feb 22, 2016

comment:44

There, let's put it on one more time.

@vbraun
Copy link
Member

vbraun commented Feb 23, 2016

Changed branch from u/jdemeyer/move_interrupt_pyx_to_package_cysignals to 4677a93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants