Opened 5 years ago
Last modified 18 months ago
#16788 needs_work defect
segfault in numerical_integral()
Reported by:  rws  Owned by:  

Priority:  major  Milestone:  sage8.4 
Component:  calculus  Keywords:  integral, numerics, crash 
Cc:  kcrisman  Merged in:  
Authors:  Ralf Stephan  Reviewers:  Marc Mezzarobba 
Report Upstream:  N/A  Work issues:  
Branch:  u/chapoton/16788 (Commits)  Commit:  87332f3f7126c1d4555f0064efb6e181a0cc8ccb 
Dependencies:  Stopgaps: 
Description (last modified by )
sage: numerical_integral(sin(x^2)/(x^2), 1, infinity, max_points=10^10)  SignalError Traceback (most recent call last) <ipythoninput7a164db8ca706> in <module>() > 1 numerical_integral(sin(x**Integer(2))/(x**Integer(2)), Integer(1), infinity, max_points=Integer(10)**Integer(10)) /home/ralf/sage/local/lib/python2.7/sitepackages/sage/gsl/integration.so in sage.gsl.integration.numerical_integral (build/cythonized/sage/gsl/integration.c:2626)() /home/ralf/sage/local/lib/python2.7/sitepackages/sage/ext/c_lib.so in sage.ext.c_lib.sig_raise_exception (build/cythonized/sage/ext/c_lib.c:1208)() SignalError: Segmentation fault
Better error messages would be needed here, as well.
The segfault happens on OpenSuSE 12.3 (both 6.2 and 6.3) and SMC (Ubuntu) but not on Mac OS X 10.7
Change History (26)
comment:1 Changed 5 years ago by
 Description modified (diff)
comment:2 Changed 5 years ago by
 Priority changed from major to critical
comment:3 Changed 5 years ago by
 Milestone changed from sage6.3 to sage6.4
comment:4 Changed 5 years ago by
 Cc kcrisman added
What platform is this on? On Mac OS X 10.7 I get (0.285725372660691, 7.519910599701474e05)
for both Sage 5.12 and 6.2.
comment:5 Changed 5 years ago by
 Description modified (diff)
comment:6 Changed 5 years ago by
What platform is this on? On Mac OS X 10.7 I get
(0.285725372660691, 7.519910599701474e05)
for both Sage 5.12 and 6.2.
This could be a good situation to ask on sagedevel; there are a wide variety of systems there and if everyone tried quickly you might get a lot of feedback. It's too bad the traceback is so short, that's not a lot of info to go on :( as usually I like tracking these things down.
On SMC, which is Ubuntu:
$ sage ┌────────────────────────────────────────────────────────────────────┐ │ Sage Version 6.3, Release Date: 20140810 │ │ Type "notebook()" for the browserbased notebook interface. │ │ Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: numerical_integral(sin(x^2)/(x^2), 1, infinity, max_points=10^10)  SignalError Traceback (most recent call last) <ipythoninput1a164db8ca706> in <module>() > 1 numerical_integral(sin(x**Integer(2))/(x**Integer(2)), Integer(1), infinity, max_points=Integer(10)**Integer(10)) /usr/local/sage/sage6.3.beta6/local/lib/python2.7/sitepackages/sage/gsl/integration.so in sage.gsl.integration.numerical_integral (build/cythonized/sage/gsl/integration.c:2626) () /usr/local/sage/sage6.3.beta6/local/lib/python2.7/sitepackages/sage/ext/c_lib.so in sage.ext.c_lib.sig_raise_exception (build/cythonized/sage/ext/c_lib.c:1208)() SignalError: Segmentation fault sage: Exiting Sage (CPU time 0m0.30s, Wall time 0m7.00s). ~$ uname a Linux compute20dc0 3.13.032generic #57Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Does yours only happen with Sage 6.3? I don't have that yet locally, though on 6.3.beta5 all is still well.
comment:7 Changed 5 years ago by
 Description modified (diff)
comment:8 Changed 5 years ago by
It still happens in 6.4rc1. Changing a,b
does not matter, so all functions gsl_integration_qag*
are affected but not the qng
method:
sage: integrate(sin(x^2)/(x^2), 1, infinity).n() 0.285736646322853 sage: numerical_integral(sin(x^2)/(x^2), 1,infinity, max_points=10^10, algorithm='qng') (nan, nan)
comment:9 Changed 5 years ago by
OK, the reason is, gsl_integration_workspace_alloc
returns NULL
which is then fed into the qag
integration. So, the code needs to catch it and give an error message.
comment:10 Changed 5 years ago by
 Branch set to u/rws/segfault_in_numerical_integral__
comment:11 Changed 5 years ago by
 Commit set to af3158aebf8b7b3a20c267d551312c2e02e06ffa
 Status changed from new to needs_review
New commits:
af3158a  16788: catch gsl error and tell the user about it

comment:12 Changed 5 years ago by
should be MemoryError
.
comment:13 Changed 5 years ago by
 Status changed from needs_review to needs_work
comment:14 Changed 5 years ago by
 Commit changed from af3158aebf8b7b3a20c267d551312c2e02e06ffa to c2bdcba31d1ebdcc907c34ec2097abe33cd75fd6
Branch pushed to git repo; I updated commit sha1. New commits:
c2bdcba  16788: fix exception type

comment:15 Changed 5 years ago by
 Status changed from needs_work to needs_review
comment:16 Changed 5 years ago by
 Status changed from needs_review to needs_info
Needs testing on 32bit.
comment:17 Changed 23 months ago by
 Branch changed from u/rws/segfault_in_numerical_integral__ to u/chapoton/16788
 Commit changed from c2bdcba31d1ebdcc907c34ec2097abe33cd75fd6 to 87332f3f7126c1d4555f0064efb6e181a0cc8ccb
 Milestone changed from sage6.4 to sage8.2
 Status changed from needs_info to needs_review
comment:19 Changed 20 months ago by
 Reviewers set to Marc Mezzarobba
 Status changed from needs_review to positive_review
comment:20 Changed 20 months ago by
 Priority changed from critical to major
comment:21 Changed 20 months ago by
On OSX:
********************************************************************** File "src/sage/calculus/integration.pyx", line 237, in sage.calculus.integration.? Failed example: numerical_integral(sin(x^2)/(x^2), 1,infinity, max_points=10^10) Expected: Traceback (most recent call last): ... MemoryError: could not allocate workspace: max_points too big Got: (0.285725372660691, 7.519910599701474e05)
comment:22 Changed 20 months ago by
 Status changed from positive_review to needs_work
comment:23 Changed 20 months ago by
Fails on 32bit, too
comment:24 Changed 20 months ago by
Well 10^10 > 2^32
so it may have been an int size problem from the start...
comment:25 Changed 20 months ago by
The OSX box is 64bit
comment:26 Changed 18 months ago by
 Milestone changed from sage8.3 to sage8.4
update milestone 8.3 > 8.4
Segfaults are always critical.