#12497: GeneralDiscreteDistribution can segv sage
--------------------------+-------------------------------------------------
   Reporter:  ppurka      |          Owner:  amhou                              
 
       Type:  defect      |         Status:  needs_review                       
 
   Priority:  major       |      Milestone:  sage-5.0                           
 
  Component:  statistics  |       Keywords:  segfault 
GeneralDiscreteDistribution
Work_issues:              |       Upstream:  N/A                                
 
   Reviewer:              |         Author:                                     
 
     Merged:              |   Dependencies:                                     
 
--------------------------+-------------------------------------------------
Description changed by ppurka:

Old description:

> Running the following segfaults sage.
> {{{
> GeneralDiscreteDistribution([0.1, -0.1]).get_random_element()
> }}}
> If you run it on a notebook then it segfaults sage silently in the
> background with no feedback to the nb.
> {{{
> ~/tmp> snd a.sagenb
> ----------------------------------------------------------------------
> | Sage Version 4.7.2, Release Date: 2011-10-29                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
>
> Please wait while the Sage Notebook server starts...
> ...
> notebook(directory=r'''a.sagenb''')
> The notebook files are stored in: a.sagenb
> **************************************************
> *                                                *
> * Open your web browser to http://localhost:8080 *
> *                                                *
> **************************************************
> 2012-02-11 22:11:00+0800 [-] Log opened.
> 2012-02-11 22:11:00+0800 [-] twistd 11.1.0
> (/home/punarbasu/Installations/sage-4.8/local/bin/python 2.6.4) starting
> up.
> 2012-02-11 22:11:00+0800 [-] reactor class:
> twisted.internet.pollreactor.PollReactor.
> 2012-02-11 22:11:00+0800 [-] QuietSite starting on 8080
> 2012-02-11 22:11:00+0800 [-] Starting factory <__builtin__.QuietSite
> instance at 0x4c86e18>
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] got EOF subprocess
> must have crashed...
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libcsage.so(print_backtrace+0x31)[0x7f6d900db9f1]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libcsage.so(sigdie+0x14)[0x7f6d900dba23]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libcsage.so(sage_signal_handler+0x20e)[0x7f6d900db670]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /lib64/libpthread.so.0[0x38630102e0]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libgsl.so.0(gsl_ran_discrete+0xe)[0x7f6d8a0bb82e]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/python2.6/site-
> packages/sage/gsl/probability_distribution.so(+0x6201)[0x7f6d6a8ad201]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x4d68)[0x7f6d92ba5488]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x5392)[0x7f6d92ba5ab2]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_FileExFlags+0xb0)[0x7f6d92bc8d80]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(+0xe3dde)[0x7f6d92b9ddde]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x4ecc)[0x7f6d92ba55ec]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x5392)[0x7f6d92ba5ab2]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_FileExFlags+0xb0)[0x7f6d92bc8d80]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(+0xe3dde)[0x7f6d92b9ddde]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x4ecc)[0x7f6d92ba55ec]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_InteractiveOneFlags+0x182)[0x7f6d92bc9bf2]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_InteractiveLoopFlags+0x4e)[0x7f6d92bc9dee]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_AnyFileExFlags+0x4c)[0x7f6d92bca42c]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(Py_Main+0xb65)[0x7f6d92bd8665]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /lib64/libc.so.6(__libc_start_main+0xfd)[0x386242209d]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> /home/punarbasu/Installations/sage-4.8/local/bin/python[0x4006e9]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> ------------------------------------------------------------------------
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] Unhandled SIGSEGV: A
> segmentation fault occurred in Sage.
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] This probably
> occurred because a *compiled* component of Sage has a bug
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] in it and is not
> properly wrapped with sig_on(), sig_off(). You might
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] want to run Sage
> under gdb with 'sage -gdb' to debug this.
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] Sage will now
> terminate.
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> ------------------------------------------------------------------------
> 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
> }}}
> This type of invalid input should be caught and an appropriate error
> given to the user.
>
> ----
> Apply [attachment:trac_12497-fix-sage-segv.patch] to devel/sage

New description:

 Running the following segfaults sage.
 {{{
 GeneralDiscreteDistribution([0.1, -0.1]).get_random_element()
 }}}
 If you run it on a notebook then it segfaults sage silently in the
 background with no feedback to the nb.
 {{{
 ~/tmp> snd a.sagenb
 ----------------------------------------------------------------------
 | Sage Version 4.7.2, Release Date: 2011-10-29                       |
 | Type notebook() for the GUI, and license() for information.        |
 ----------------------------------------------------------------------

 Please wait while the Sage Notebook server starts...
 ...
 notebook(directory=r'''a.sagenb''')
 The notebook files are stored in: a.sagenb
 **************************************************
 *                                                *
 * Open your web browser to http://localhost:8080 *
 *                                                *
 **************************************************
 2012-02-11 22:11:00+0800 [-] Log opened.
 2012-02-11 22:11:00+0800 [-] twistd 11.1.0
 (/home/punarbasu/Installations/sage-4.8/local/bin/python 2.6.4) starting
 up.
 2012-02-11 22:11:00+0800 [-] reactor class:
 twisted.internet.pollreactor.PollReactor.
 2012-02-11 22:11:00+0800 [-] QuietSite starting on 8080
 2012-02-11 22:11:00+0800 [-] Starting factory <__builtin__.QuietSite
 instance at 0x4c86e18>
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] got EOF subprocess
 must have crashed...
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libcsage.so(print_backtrace+0x31)[0x7f6d900db9f1]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libcsage.so(sigdie+0x14)[0x7f6d900dba23]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libcsage.so(sage_signal_handler+0x20e)[0x7f6d900db670]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 /lib64/libpthread.so.0[0x38630102e0]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libgsl.so.0(gsl_ran_discrete+0xe)[0x7f6d8a0bb82e]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 /home/punarbasu/Installations/sage-4.8/local/lib/python2.6/site-
 packages/sage/gsl/probability_distribution.so(+0x6201)[0x7f6d6a8ad201]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x4d68)[0x7f6d92ba5488]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x5392)[0x7f6d92ba5ab2]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_FileExFlags+0xb0)[0x7f6d92bc8d80]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(+0xe3dde)[0x7f6d92b9ddde]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x4ecc)[0x7f6d92ba55ec]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x5392)[0x7f6d92ba5ab2]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_FileExFlags+0xb0)[0x7f6d92bc8d80]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(+0xe3dde)[0x7f6d92b9ddde]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x4ecc)[0x7f6d92ba55ec]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x8ac)[0x7f6d92ba707c]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyEval_EvalCode+0x32)[0x7f6d92ba7152]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_InteractiveOneFlags+0x182)[0x7f6d92bc9bf2]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_InteractiveLoopFlags+0x4e)[0x7f6d92bc9dee]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(PyRun_AnyFileExFlags+0x4c)[0x7f6d92bca42c]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 
/home/punarbasu/Installations/sage-4.8/local/lib/libpython2.6.so.1.0(Py_Main+0xb65)[0x7f6d92bd8665]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 /lib64/libc.so.6(__libc_start_main+0xfd)[0x386242209d]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 /home/punarbasu/Installations/sage-4.8/local/bin/python[0x4006e9]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 ------------------------------------------------------------------------
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] Unhandled SIGSEGV: A
 segmentation fault occurred in Sage.
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] This probably occurred
 because a *compiled* component of Sage has a bug
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] in it and is not
 properly wrapped with sig_on(), sig_off(). You might
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] want to run Sage under
 gdb with 'sage -gdb' to debug this.
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1] Sage will now
 terminate.
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 ------------------------------------------------------------------------
 2012-02-11 22:15:56+0800 [HTTPChannel,17,127.0.0.1]
 }}}
 This type of invalid input should be caught and an appropriate error given
 to the user.

 ----
 Apply either

 1. [attachment:trac_12497-fix-sage-segv.patch] to devel/sage for sage-4.8

 2. [attachment:trac_12497-fix-sage-segv.2.patch] to devel/sage for
 sage-5.0beta*

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12497#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to