conda-forge / sage-feedstock

A conda-smithy repository for sage.
BSD 3-Clause "New" or "Revised" License
7 stars 11 forks source link

Segfault when computing resultant #69

Closed unhyperbolic closed 2 years ago

unhyperbolic commented 2 years ago

The following code:

Rx = PolynomialRing(RationalField(), 'x') R = PolynomialRing(Rx, 'y') R('-y^2 + x^2 - x + 1').resultant(R('(2x - 1)y'))

results in a segfault in

> * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
>   * frame #0: 0x00007fff203b84c2 libsystem_kernel.dylib`__kill + 10
>     frame #1: 0x000000010ffd40ac libpari-gmp-tls.dylib`pari_err + 4940
>     frame #2: 0x000000010fca26ec libpari-gmp-tls.dylib`_gtopoly + 172
>     frame #3: 0x00000001169ec422 gen.cpython-39-darwin.so`__pyx_pf_7cypari2_3gen_8Gen_base_14Polrev + 178
>     frame #4: 0x000000010f7b450c signals.cpython-39-darwin.so`__Pyx_CyFunction_CallAsMethod + 92
>     frame #5: 0x0000000118534c77 polynomial_element.cpython-39-darwin.so`__Pyx_PyObject_Call2Args + 215
>     frame #6: 0x00000001185972cf polynomial_element.cpython-39-darwin.so`__pyx_pw_4sage_5rings_10polynomial_18polynomial_element_10Polynomial_221_pari_with_name + 1071
>     frame #7: 0x000000010f0b1f24 python`cfunction_call + 52
>     frame #8: 0x0000000118534ea3 polynomial_element.cpython-39-darwin.so`__Pyx_PyObject_CallOneArg + 339
>     frame #9: 0x00000001185967a2 polynomial_element.cpython-39-darwin.so`__pyx_pw_4sage_5rings_10polynomial_18polynomial_element_10Polynomial_217__pari__ + 386
>     frame #10: 0x0000000118535904 polynomial_element.cpython-39-darwin.so`__Pyx_PyObject_CallNoArg + 132
>     frame #11: 0x0000000118598497 polynomial_element.cpython-39-darwin.so`__pyx_pw_4sage_5rings_10polynomial_18polynomial_element_10Polynomial_231resultant + 551
>     frame #12: 0x000000010f060bd5 python`method_vectorcall_O + 117
>     frame #13: 0x00000001108491d4 element.cpython-39-darwin.so`__pyx_pw_4sage_9structure_7element_12coerce_binop_1new_method + 1208
>     frame #14: 0x000000010f051288 python`_PyObject_MakeTpCall + 136
>     frame #15: 0x000000010f055d9e python`method_vectorcall + 686
>     frame #16: 0x000000010f186e4f python`call_function + 175
> 

with SageMath-9.3 and pari 2.13.2-h491590d_1_pthread but works fine with pari 2.11.4-h797e938_2 using python 3.9.9 on Mac OS 11.5.2 x86_64. Note that this also failed in my conda environment with SageMath-9.4, but worked fine with the one with SageMath-9.2.

More precisely: I get the crash when creating a conda environment with SageMath-9.3. I can then fix the crash or re-create the crash by changing with conda environment with "conda install pari==2.11.4" or "conda install 2.13.2".

Those commands change the packages as follows:

added / updated specs:

  • pari==2.11.4

The following packages will be DOWNGRADED:

cypari2 2.1.2-py39hbeebeb8_3 --> 2.1.2-py39he58a9ab_0 cysignals 1.11.2-py39h7972417_0 --> 1.10.3-py39h520947a_0 eclib 20210503-h06317ce_2 --> 20210503-h5af3530_0 giac 1.6.0.47-h3e19eb6_2 --> 1.6.0.47-h5514456_0 lcalc 1.23-he3dd645_1006 --> 1.23-h3e22c04_1004 pari 2.13.2-h491590d_1_pthread --> 2.11.4-h797e938_2 sagelib 9.3-py39hf07016b_5 --> 9.3-py39h2a6771f_4

l also tried Marc Culler's Sage releases (https://github.com/3-manifolds/Sage_macOS/releases), version 9.4 and 9.5 prerelease. The crash didn't happen in either version. I think those use pari 2.13.1 and 2.13.3.

Hmmm... I noted that the downgrading that fixed the crash removed "_pthread" from the pari version. So maybe pthread support causes the crash.

isuruf commented 2 years ago

I just uploaded pari 2.13.3. Can you check?

unhyperbolic commented 2 years ago

Sadly, I still get the same crash in the following conda environment with parti 2.13.3:

Name Version Build Channel

_r-mutex 1.0.1 anacondar_1 conda-forge alabaster 0.7.12 py_0 conda-forge appnope 0.1.2 py39h6e9494a_2 conda-forge arb 2.21.1 hc148fab_0 conda-forge argon2-cffi 21.3.0 pyhd8ed1ab_0 conda-forge argon2-cffi-bindings 21.2.0 py39h89e85a6_1 conda-forge arpack 3.7.0 hefb7bc6_2 conda-forge attrs 21.4.0 pyhd8ed1ab_0 conda-forge babel 2.9.1 pyh44b312d_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge bdw-gc 8.0.4 h9a9d8cb_0 conda-forge blas-devel 3.9.0 13_osx64_openblas conda-forge bleach 3.3.1 pyhd8ed1ab_0 conda-forge brial 1.2.10 pyh8af1aa0_0 conda-forge brotli 1.0.9 h0d85af4_6 conda-forge brotli-bin 1.0.9 h0d85af4_6 conda-forge brotlipy 0.7.0 py39h89e85a6_1003 conda-forge bwidget 1.9.14 h694c41f_1 conda-forge bzip2 1.0.8 h0d85af4_4 conda-forge c-ares 1.18.1 h0d85af4_0 conda-forge ca-certificates 2021.10.8 h033912b_0 conda-forge cairo 1.16.0 he01c77b_1009 conda-forge cctools_osx-64 973.0.1 h609b070_5 conda-forge cddlib 1!0.94m h0f52abe_0 conda-forge certifi 2021.10.8 py39h6e9494a_1 conda-forge cffi 1.15.0 py39he338e87_0 conda-forge charset-normalizer 2.0.10 pyhd8ed1ab_0 conda-forge clang 12.0.1 h694c41f_4 conda-forge clang-12 12.0.1 default_he082bbe_4 conda-forge clang_osx-64 12.0.1 h633439f_6 conda-forge clangxx 12.0.1 default_he082bbe_4 conda-forge clangxx_osx-64 12.0.1 hdb584c0_6 conda-forge cliquer 1.22 hbcb3906_0 conda-forge colorama 0.4.4 pyh9f0ad1d_0 conda-forge compiler-rt 12.0.1 he01351e_0 conda-forge compiler-rt_osx-64 12.0.1 hd3f61c9_0 conda-forge cryptography 36.0.1 py39h209aa08_0 conda-forge curl 7.81.0 hf45b732_0 conda-forge cvxopt 1.2.7 py39h3314f5d_1 conda-forge cycler 0.11.0 pyhd8ed1ab_0 conda-forge cypari2 2.1.2 py39hbeebeb8_3 conda-forge cysignals 1.11.2 py39h7972417_0 conda-forge cython 0.29.27 py39h9fcab8e_0 conda-forge decorator 4.4.2 py_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge docutils 0.17.1 py39h6e9494a_1 conda-forge dsdp 5.8 h6e329d1_1203 conda-forge ecl 21.2.1 hcd14dc1_1 conda-forge eclib 20210625 hdcab1d1_4 conda-forge ecm 7.0.4 h343d7f2_1002 conda-forge entrypoints 0.3 pyhd8ed1ab_1003 conda-forge expat 2.4.3 he49afe7_0 conda-forge fflas-ffpack 2.4.3 h026fd7e_2 conda-forge fftw 3.3.10 nompi_hf082fe4_102 conda-forge flintqs 1.0 ha6586c5_1001 conda-forge flit-core 3.6.0 pyhd8ed1ab_0 conda-forge font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge font-ttf-inconsolata 3.000 h77eed37_0 conda-forge font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge font-ttf-ubuntu 0.83 hab24e00_0 conda-forge fontconfig 2.13.94 h10f422b_0 conda-forge fonts-conda-ecosystem 1 0 conda-forge fonts-conda-forge 1 0 conda-forge fonttools 4.29.0 py39h89e85a6_0 conda-forge fplll 5.4.1 h1dc45ce_0 conda-forge fpylll 0.5.6 py39h9f12b3e_1 conda-forge freetype 2.10.4 h4cff582_1 conda-forge fribidi 1.0.10 hbcb3906_0 conda-forge future 0.18.2 py39h6e9494a_4 conda-forge fxrays 1.3.5 pypi_0 pypi gap-core 4.11.1 h4855eeb_2 conda-forge gap-defaults 4.11.1 h694c41f_2 conda-forge gettext 0.19.8.1 hd1a6beb_1008 conda-forge gf2x 1.3.0 h0959a2e_1 conda-forge gfan 0.6.2 hd793b56_1003 conda-forge gfortran_impl_osx-64 9.3.0 h9cc0e5e_23 conda-forge gfortran_osx-64 9.3.0 h18f7dce_15 conda-forge giac 1.6.0.47 h6fe0c01_3 conda-forge giflib 5.2.1 hbcb3906_2 conda-forge givaro 4.1.1 h9bcddcd_2 conda-forge glpk 4.65 h0f52abe_1004 conda-forge gmp 6.2.1 h2e338ed_0 conda-forge gmpy2 2.1.2 py39hab8a6df_0 conda-forge graphite2 1.3.13 h2e338ed_1001 conda-forge gsl 2.7 h93259b0_0 conda-forge harfbuzz 3.2.0 h447b35c_0 conda-forge icu 69.1 he49afe7_0 conda-forge idna 3.3 pyhd8ed1ab_0 conda-forge igraph 0.9.6 ha5be149_0 conda-forge imagesize 1.3.0 pyhd8ed1ab_0 conda-forge iml 1.0.5 h64b42ca_1003 conda-forge importlib-metadata 4.10.1 py39h6e9494a_0 conda-forge ipykernel 5.5.5 py39h71a6800_0 conda-forge ipython 7.31.1 py39h6e9494a_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge ipywidgets 7.6.5 pyhd8ed1ab_0 conda-forge isl 0.22.1 hb1e8313_2 conda-forge jbig 2.1 h0d85af4_2003 conda-forge jedi 0.18.1 py39h6e9494a_0 conda-forge jinja2 3.0.3 pyhd8ed1ab_0 conda-forge jmol 14.32.9 h694c41f_0 conda-forge jpeg 9e h0d85af4_0 conda-forge jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge jupyter_core 4.9.1 py39h6e9494a_1 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge jupyterlab_widgets 1.0.2 pyhd8ed1ab_0 conda-forge kiwisolver 1.3.2 py39hf018cea_1 conda-forge knot-floer-homology 1.1 pypi_0 pypi krb5 1.19.2 hcfbf3a7_3 conda-forge lcalc 1.23 he3dd645_1006 conda-forge lcms2 2.12 h577c468_0 conda-forge ld64_osx-64 609 hc6b1d1e_5 conda-forge lerc 3.0 he49afe7_0 conda-forge libblas 3.9.0 13_osx64_openblas conda-forge libbraiding 1.1 h2e338ed_0 conda-forge libbrial 1.2.10 h90380fc_0 conda-forge libbrotlicommon 1.0.9 h0d85af4_6 conda-forge libbrotlidec 1.0.9 h0d85af4_6 conda-forge libbrotlienc 1.0.9 h0d85af4_6 conda-forge libcblas 3.9.0 13_osx64_openblas conda-forge libclang-cpp12 12.0.1 default_he082bbe_4 conda-forge libcurl 7.81.0 hf45b732_0 conda-forge libcxx 12.0.1 habf9029_1 conda-forge libdeflate 1.8 h0d85af4_0 conda-forge libedit 3.1.20191231 h0678c8f_2 conda-forge libev 4.33 haf1e3a3_1 conda-forge libffi 3.4.2 h0d85af4_5 conda-forge libflint 2.8.4 hd3cc997_ntl_100 conda-forge libgd 2.3.3 hb8742e1_1 conda-forge libgfortran 5.0.0 9_3_0_h6c81a4c_23 conda-forge libgfortran-devel_osx-64 9.3.0 h6c81a4c_23 conda-forge libgfortran5 9.3.0 h6c81a4c_23 conda-forge libglib 2.70.2 hf1fb8c0_1 conda-forge libhomfly 1.02r6 hc929b4f_0 conda-forge libiconv 1.16 haf1e3a3_0 conda-forge liblapack 3.9.0 13_osx64_openblas conda-forge liblapacke 3.9.0 13_osx64_openblas conda-forge libllvm12 12.0.1 hd011deb_2 conda-forge libnghttp2 1.46.0 h6f36284_0 conda-forge libopenblas 0.3.18 openmp_h3351f45_0 conda-forge libpng 1.6.37 h7cec526_2 conda-forge libsodium 1.0.18 hbcb3906_1 conda-forge libssh2 1.10.0 h52ee1ee_2 conda-forge libtiff 4.3.0 hd146c10_2 conda-forge libwebp 1.2.2 h28dabe5_0 conda-forge libwebp-base 1.2.2 h0d85af4_1 conda-forge libxml2 2.9.12 h7e28ab6_1 conda-forge libzlib 1.2.11 h9173be1_1013 conda-forge linbox 1.6.3 h9ed2ecd_6 conda-forge llvm-openmp 12.0.1 hda6cdc1_1 conda-forge llvm-tools 12.0.1 hd011deb_2 conda-forge lrcalc 1.2 h2e338ed_1000 conda-forge lz4-c 1.9.3 he49afe7_1 conda-forge m4ri 20140914 h3f75d11_1005 conda-forge m4rie 20150908 h3f75d11_1001 conda-forge make 4.3 h22f3db7_1 conda-forge markupsafe 2.0.1 py39h89e85a6_1 conda-forge matplotlib-base 3.5.1 py39hb07454d_0 conda-forge matplotlib-inline 0.1.3 pyhd8ed1ab_0 conda-forge maxima 5.45.0 hd029580_2 conda-forge memory-allocator 0.1.2 py39h89e85a6_0 conda-forge metis 5.1.0 h2e338ed_1006 conda-forge mistune 0.8.4 py39h89e85a6_1005 conda-forge mpc 1.2.1 hbb51d92_0 conda-forge mpfi 1.5.4 h52b28e3_1001 conda-forge mpfr 4.1.0 h0f52abe_1 conda-forge mpmath 1.2.1 pyhd8ed1ab_0 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge nauty 2.7.2 h0d85af4_0 conda-forge nbclient 0.5.10 pyhd8ed1ab_1 conda-forge nbconvert 6.4.1 py39h6e9494a_0 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge ncurses 6.2 h2e338ed_4 conda-forge nest-asyncio 1.5.4 pyhd8ed1ab_0 conda-forge networkx 2.6.3 pyhd8ed1ab_1 conda-forge notebook 6.4.8 pyha770c72_0 conda-forge ntl 11.4.3 h0ab3c2f_1 conda-forge numpy 1.22.1 py39h9d9ce41_0 conda-forge olefile 0.46 pyh9f0ad1d_1 conda-forge openblas 0.3.18 openmp_h12da7db_0 conda-forge openjdk 11.0.9.1 hcf210ce_1 conda-forge openjpeg 2.4.0 h6e7aa92_1 conda-forge openssl 1.1.1l h0d85af4_0 conda-forge packaging 21.3 pyhd8ed1ab_0 conda-forge palp 2.20 hbcb3906_0 conda-forge pandas 1.4.0 py39h4d6be9b_0 conda-forge pandoc 2.17.0.1 h694c41f_1 conda-forge pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge pango 1.50.3 h7f27720_0 conda-forge pari 2.13.3 h491590d_1_pthread conda-forge pari-galdata 0.0.20180411 0 conda-forge pari-seadata-small 0.0.20090618 0 conda-forge parso 0.8.3 pyhd8ed1ab_0 conda-forge pcre 8.45 he49afe7_0 conda-forge pcre2 10.37 ha16e1b2_0 conda-forge perl 5.32.1 1_h0d85af4_perl5 conda-forge pexpect 4.8.0 pyh9f0ad1d_2 conda-forge pickleshare 0.7.5 py_1003 conda-forge pillow 8.4.0 py39he9bb72f_0 conda-forge pip 22.0.2 pyhd8ed1ab_0 conda-forge pixman 0.40.0 hbcb3906_0 conda-forge pkg-config 0.29.2 h31203cd_1008 conda-forge pkgconfig 1.5.5 py39h6e9494a_1 conda-forge planarity 3.0.0.5 hbcb3906_1002 conda-forge plink 2.4.1 pypi_0 pypi ppl 1.2 h88b529c_1004 conda-forge pplpy 0.8.6 py39hcbd3d1b_1 conda-forge prometheus_client 0.13.1 pyhd8ed1ab_0 conda-forge prompt-toolkit 3.0.26 pyha770c72_0 conda-forge prompt_toolkit 3.0.26 hd8ed1ab_0 conda-forge psutil 5.9.0 py39h89e85a6_0 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pygments 2.11.2 pyhd8ed1ab_0 conda-forge pynac 0.7.29 py39hc4f3171_2 conda-forge pyopenssl 22.0.0 pyhd8ed1ab_0 conda-forge pyparsing 2.4.7 pyhd8ed1ab_1 conda-forge pypng 0.0.21 pypi_0 pypi pyrsistent 0.18.1 py39h89e85a6_0 conda-forge pysocks 1.7.1 py39h6e9494a_4 conda-forge python 3.9.9 h1248fe1_0_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-tzdata 2021.5 pyhd8ed1ab_0 conda-forge python_abi 3.9 2_cp39 conda-forge pytz 2021.3 pyhd8ed1ab_0 conda-forge pytz-deprecation-shim 0.1.0.post0 py39h6e9494a_1 conda-forge pyzmq 22.3.0 py39h7fec2f1_1 conda-forge qd 2.3.22 h2beb688_1004 conda-forge r-base 4.1.2 hbd3716f_1 conda-forge ratpoints 2.1.3 h3cb5acd_1002 conda-forge readline 8.1 h05e3726_0 conda-forge requests 2.27.1 pyhd8ed1ab_0 conda-forge rpy2 3.4.5 py39r41hc89836e_3 conda-forge rubiks 20070912 h370ebc4_1001 conda-forge rw 0.9 h0d85af4_0 conda-forge sage 9.4 hd8ed1ab_0 conda-forge sage-docbuild 9.4 pypi_0 pypi sagelib 9.4 py39hb5a7a70_1 conda-forge sagemath-db-combinatorial-designs 20140630 1 conda-forge sagemath-db-conway-polynomials 0.5.0 h033912b_1 conda-forge sagemath-db-elliptic-curves 0.8.1 hecc5488_0 conda-forge sagemath-db-graphs 20210214 hd8ed1ab_0 conda-forge sagemath-db-polytopes 20170220 1 conda-forge sagemath-standard 9.4 pypi_0 pypi sagetex 3.6 pyhd8ed1ab_0 conda-forge scipy 1.7.3 py39h056f1c0_0 conda-forge send2trash 1.8.0 pyhd8ed1ab_0 conda-forge setuptools 60.5.0 py39h6e9494a_0 conda-forge sigtool 0.1.3 h57ddcff_0 conda-forge simplegeneric 0.8.1 py_1 conda-forge singular 4.2.0.p3 h6475a08_2 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snappy 3.0.4a3 pypi_0 pypi snappy-manifolds 1.1.2 pypi_0 pypi snowballstemmer 2.2.0 pyhd8ed1ab_0 conda-forge spherogram 2.1 pypi_0 pypi sphinx 4.4.0 pyh6c4a22f_1 conda-forge sphinxcontrib-applehelp 1.0.2 py_0 conda-forge sphinxcontrib-devhelp 1.0.2 py_0 conda-forge sphinxcontrib-htmlhelp 2.0.0 pyhd8ed1ab_0 conda-forge sphinxcontrib-jsmath 1.0.1 py_0 conda-forge sphinxcontrib-qthelp 1.0.3 py_0 conda-forge sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_1 conda-forge sqlite 3.37.0 h23a322b_0 conda-forge suitesparse 5.10.1 h7aff33d_1 conda-forge symmetrica 2.0 h2e338ed_1007 conda-forge sympow 2.023.6 h9b7075a_2 conda-forge sympy 1.9 py39h6e9494a_1 conda-forge tachyon 0.99b6 h2e86ede_1001 conda-forge tapi 1100.0.11 h9ce4665_0 conda-forge tbb 2021.5.0 h940c156_0 conda-forge terminado 0.13.1 py39h6e9494a_0 conda-forge testpath 0.5.0 pyhd8ed1ab_0 conda-forge three.js 122 hd8ed1ab_1 conda-forge tk 8.6.11 h5dbffcc_1 conda-forge tktable 2.10 h49f0cf7_3 conda-forge tornado 6.1 py39h89e85a6_2 conda-forge traitlets 5.1.1 pyhd8ed1ab_0 conda-forge tzdata 2021e he74cb21_0 conda-forge tzlocal 4.1 py39h6e9494a_1 conda-forge unicodedata2 14.0.0 py39h89e85a6_0 conda-forge urllib3 1.26.8 pyhd8ed1ab_1 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.37.1 pyhd8ed1ab_0 conda-forge widgetsnbextension 3.5.2 py39h6e9494a_1 conda-forge xz 5.2.5 haf1e3a3_1 conda-forge zeromq 4.3.4 he49afe7_1 conda-forge zipp 3.7.0 pyhd8ed1ab_0 conda-forge zlib 1.2.11 h9173be1_1013 conda-forge zn_poly 0.9.2 h0f52abe_0 conda-forge zstd 1.5.2 h582d3a0_0 conda-forge

unhyperbolic commented 2 years ago

Just installed sage-9.5 with conda create -n sage-new sage ipython python==3.9.9 and the crash is still there :(

isuruf commented 2 years ago

Rebuilding cypari2 with latest pari fixed this. https://github.com/conda-forge/cypari2-feedstock/pull/37

isuruf commented 2 years ago

Thanks @unhyperbolic for the report

unhyperbolic commented 2 years ago

Thanks for addressing this. Should we add my example as a (doc)test to sage so that we would catch a possible regression in the future?

isuruf commented 2 years ago

Sure