Ticket #2303 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

[with spkg, positive review] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86

Reported by: mabshoff Owned by: mabshoff
Priority: blocker Milestone: sage-3.0.5
Component: doctest coverage Keywords:
Cc: Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

Kate reports in  https://groups.google.com/group/sage-support/browse_thread/thread/f7bc183b6f052943/70f4b300f5be3d13#70f4b300f5be3d13

When I build 2.10.2 from source on my
x86-Linux box (pentium4-fc6) using gcc-4.2.3,
I get a 'make check' failure at

./sage -t devel/sage-main/sage/functions/special.py

sh: line 1:  3345 Illegal instruction     /home/kate/sage/sage-2.10.2-
x86-Linux/local/bin/python .doctest_special.py >.doctest/out
2>.doctest/err

A mysterious error (perphaps a memory error?) occurred, which may have
crashed doctest.
         [3.6 s]
exit code: 256

The offending line seems to be

sage: bessel_I(1,1,"scipy")
/home/kate/sage/sage-2.10.2-x86-Linux/local/bin/sage-sage: line 212:
3484 Illegal instruction     sage-ipython -c "$SAGE_STARTUP_COMMAND;"
"$@"

Kate 

Cheers,

Michael

Attachments

2303-scipy-bessel.patch Download (1.4 KB) - added by robertwb 5 years ago.

Change History

comment:1 Changed 5 years ago by mabshoff

  • Status changed from new to assigned

comment:2 Changed 5 years ago by was

If anybody can reproduce this, e.g., has a P4 computer, please post here. The temporary solution will be to disable the scipy option for bessel_l, then report this upstream (with a gdb traceback?) to scipy.

comment:3 Changed 5 years ago by jason

Using Sage 2.10.2 on this computer (Ubuntu 7.10, 32-bit):

vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Pentium(R) 4 CPU 3.80GHz
stepping        : 1
cpu MHz         : 3790.991
cache size      : 1024 KB

$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)

the doctest passes:

$ sage -t sage/devel/sage-main/sage/functions/special.py 
sage -t  sage/devel/sage-main/sage/functions/special.py     
         [7.3 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 7.3 seconds

and I get:

sage: bessel_I(1,1,"scipy")
0.565159103992000

comment:4 Changed 5 years ago by was

  • Milestone changed from sage-2.11 to sage-2.10.4

comment:5 Changed 5 years ago by mabshoff

  • Milestone changed from sage-3.0.6 to sage-3.0.5

We can finally replicate the problem:

(gdb) bt
#0  0x02e474ac in dgamln_ () from /tmp/foo/sage-3.0.4.rc0-x86-Linux-fc8/local/lib/python/site-packages/scipy/special/_cephes.so
#1  0x0028bbc9 in log () from /lib/libm.so.6
#2  0x40000000 in ?? ()

William says:

William:  here is the sage-free version to replicate the problem:
scipy.special.iv(float(1),complex(1,0))

Cheers,

Michael

Changed 5 years ago by robertwb

comment:6 Changed 5 years ago by robertwb

After discussing with William Stein, we are disabling this option. Note that if one wants to use it it is much faster to directly call scypy.special.iv.

comment:7 Changed 5 years ago by was

  • Summary changed from bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86 to [with patch; needs review] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86

comment:8 Changed 5 years ago by was

  • Summary changed from [with patch; needs review] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86 to bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86

Robert's patch is unfortunately no good because there are *dozens* of different special functions that crash from scipy. We can't release something that is this broken.

So no solution to this yet.

comment:9 Changed 5 years ago by robertwb

In that case we should probably not bother applying this ticket at all.

comment:10 Changed 5 years ago by mabshoff

Having poked around the solution might be to disabled the "-fwrapv" build option for Python. We already do that on Itanium since it caused numerous unexplained doctest failures.

Cheers,

Michael

comment:11 Changed 5 years ago by mabshoff

  • Milestone changed from sage-3.0.6 to sage-3.0.5

It is not a -fwrapv issue, but I have a patch coming up.

Cheers,

Michael

comment:12 Changed 5 years ago by mabshoff

With the new spkg the following three doctests that used to segfault all due to illegal instruction now pass:

[mabshoff@cicero sage-3.0.4-x86-Linux-fc8]$ ./sage -t  devel/sage/sage/plot/plot3d/list_plot3d.py
sage -t  devel/sage/sage/plot/plot3d/list_plot3d.py         
	 [6.3 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 6.3 seconds
[mabshoff@cicero sage-3.0.4-x86-Linux-fc8]$ ./sage -t  devel/sage/sage/finance/time_series.pyx
sage -t  devel/sage/sage/finance/time_series.pyx            
	 [15.1 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 15.1 seconds
[mabshoff@cicero sage-3.0.4-x86-Linux-fc8]$ ./sage -t devel/sage/sage/functions/special.py 
sage -t  devel/sage/sage/functions/special.py               
	 [8.2 s]
 
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 8.2 seconds

Cheers,

Michael

comment:13 Changed 5 years ago by mabshoff

  • Summary changed from bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86 to [with spkg, needs revivew] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86

comment:14 Changed 5 years ago by was

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Summary changed from [with spkg, needs revivew] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86 to [with spkg, positive review] bessel_I(1,1,"scipy") segfaults with gcc 4.2.3 on Linux x86
Note: See TracTickets for help on using tickets.