sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.23k stars 430 forks source link

Random test failure in sage.rings.integer #33230

Open orlitzky opened 2 years ago

orlitzky commented 2 years ago

I've been trying to track this down for some time without luck. The important ingredients seem to be,

but even then it's not always reproducible (so I can't really be sure how critical the ingredients above are). This is on an unmodified 9.5.rc3.

$ sage -t -p2 --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
Running doctests with ID 2022-01-25-11-12-37-a8e85da5.
Git branch: develop
Using --optional=build,gentoo,pip,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_jones_numfield,database_knotinfo,dvipng,ffmpeg,graphviz,imagemagick,jupymake,kenzo,latte_int,lrslib,mcqd,meataxe,pandoc,pdf2svg,plantri,pynormaliz,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.plot,sage.rings.number_field,sage.rings.real_double,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,sphinx,tdlib
Doctesting 1 file using 2 threads.
sage -t --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
**********************************************************************
File "src/sage/rings/integer.pyx", line 3006, in sage.rings.integer.Integer.divisors
Failed example:
    for i in range(20):  # long time
        try:
            alarm(RDF.random_element(1e-3, 0.5))
            _ = n.divisors()
            cancel_alarm()  # we never get here
        except AlarmInterrupt:
            pass
Exception raised:
    Traceback (most recent call last):
      File "<doctest sage.rings.integer.Integer.divisors[20]>", line 4, in <module>
        _ = n.divisors()
      File "sage/rings/integer.pyx", line 3093, in sage.rings.integer.Integer.divisors (build/cythonized/sage/rings/integer.c:20167)
        for p, e in f:
      File "/home/mjo/src/sage.git/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/structure/factorization.py", line 319, in __getitem__
        def __getitem__(self, i):
      File "src/cysignals/signals.pyx", line 310, in cysignals.signals.python_check_interrupt
    cysignals.signals.AlarmInterrupt

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/mjo/src/sage.git/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/mjo/src/sage.git/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.rings.integer.Integer.divisors[20]>", line 4, in <module>
        _ = n.divisors()
      File "src/cysignals/signals.pyx", line 310, in cysignals.signals.python_check_interrupt
    cysignals.signals.AlarmInterrupt
^CKilling test src/sage/rings/integer.pyx
----------------------------------------------------------------------
Doctests interrupted: 0/1 files tested
----------------------------------------------------------------------
Total time for all tests: 77.8 seconds
    cpu time: 0.0 seconds
    cumulative wall time: 0.0 seconds
Features detected for doctesting: 
Pytest is not installed, skip checking tests that rely on it.

Also note that the doctest is trying to catch the very exception that kills it.

CC: @kliem

Component: build

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

orlitzky commented 2 years ago
comment:1

Evidence of it randomly pass/failing, if you're into that sort of thing. Nothing happened between these commands. I just hit up and enter:

mjo@gantu ~/src/sage.git $ sage -t --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
Running doctests with ID 2022-01-25-11-14-16-4f7cf422.
Git branch: develop
Using --optional=build,gentoo,pip,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_jones_numfield,database_knotinfo,dvipng,ffmpeg,graphviz,imagemagick,jupymake,kenzo,latte_int,lrslib,mcqd,meataxe,pandoc,pdf2svg,plantri,pynormaliz,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.plot,sage.rings.number_field,sage.rings.real_double,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,sphinx,tdlib
Doctesting 1 file.
sage -t --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
    [1154 tests, 584.82 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 586.3 seconds
    cpu time: 582.4 seconds
    cumulative wall time: 584.8 seconds
Features detected for doctesting: 
Pytest is not installed, skip checking tests that rely on it.
mjo@gantu ~/src/sage.git $ sage -t -p2 --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
Running doctests with ID 2022-01-25-11-47-54-32b9067f.
Git branch: develop
Using --optional=build,gentoo,pip,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_jones_numfield,database_knotinfo,dvipng,ffmpeg,graphviz,imagemagick,jupymake,kenzo,latte_int,lrslib,mcqd,meataxe,pandoc,pdf2svg,plantri,pynormaliz,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.plot,sage.rings.number_field,sage.rings.real_double,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,sphinx,tdlib
Doctesting 1 file using 2 threads.
sage -t --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
    [1154 tests, 527.12 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 527.9 seconds
    cpu time: 526.1 seconds
    cumulative wall time: 527.1 seconds
Features detected for doctesting: 
Pytest is not installed, skip checking tests that rely on it.
mjo@gantu ~/src/sage.git $ sage -t -p2 --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
Running doctests with ID 2022-01-25-12-01-21-764e200d.
Git branch: develop
Using --optional=build,gentoo,pip,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_jones_numfield,database_knotinfo,dvipng,ffmpeg,graphviz,imagemagick,jupymake,kenzo,latte_int,lrslib,mcqd,meataxe,pandoc,pdf2svg,plantri,pynormaliz,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.plot,sage.rings.number_field,sage.rings.real_double,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,sphinx,tdlib
Doctesting 1 file using 2 threads.
sage -t --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
    [1154 tests, 627.24 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 628.1 seconds
    cpu time: 617.7 seconds
    cumulative wall time: 627.2 seconds
Features detected for doctesting: 
Pytest is not installed, skip checking tests that rely on it.
mjo@gantu ~/src/sage.git $ sage -t -p2 --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
Running doctests with ID 2022-01-25-12-14-03-c62c53a9.
Git branch: develop
Using --optional=build,gentoo,pip,sage,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_jones_numfield,database_knotinfo,dvipng,ffmpeg,graphviz,imagemagick,jupymake,kenzo,latte_int,lrslib,mcqd,meataxe,pandoc,pdf2svg,plantri,pynormaliz,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.plot,sage.rings.number_field,sage.rings.real_double,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,sphinx,tdlib
Doctesting 1 file using 2 threads.
sage -t --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx
**********************************************************************
File "src/sage/rings/integer.pyx", line 3006, in sage.rings.integer.Integer.divisors
Failed example:
    for i in range(20):  # long time
        try:
            alarm(RDF.random_element(1e-3, 0.5))
            _ = n.divisors()
            cancel_alarm()  # we never get here
        except AlarmInterrupt:
            pass
Exception raised:
    Traceback (most recent call last):
      File "<doctest sage.rings.integer.Integer.divisors[20]>", line 4, in <module>
        _ = n.divisors()
      File "sage/rings/integer.pyx", line 3093, in sage.rings.integer.Integer.divisors (build/cythonized/sage/rings/integer.c:20167)
        for p, e in f:
      File "/home/mjo/src/sage.git/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/structure/factorization.py", line 319, in __getitem__
        def __getitem__(self, i):
      File "src/cysignals/signals.pyx", line 310, in cysignals.signals.python_check_interrupt
    cysignals.signals.AlarmInterrupt

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/mjo/src/sage.git/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/mjo/src/sage.git/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.rings.integer.Integer.divisors[20]>", line 4, in <module>
        _ = n.divisors()
      File "src/cysignals/signals.pyx", line 310, in cysignals.signals.python_check_interrupt
    cysignals.signals.AlarmInterrupt
**********************************************************************
1 item had failures:
   1 of  23 in sage.rings.integer.Integer.divisors
    [1154 tests, 1 failure, 498.58 s]
----------------------------------------------------------------------
sage -t --long --warn-long 0.0 --random-seed=317330528558743225605191137282347178703 src/sage/rings/integer.pyx  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 499.6 seconds
    cpu time: 496.0 seconds
    cumulative wall time: 498.6 seconds
Features detected for doctesting: 
Pytest is not installed, skip checking tests that rely on it.
mwageringel commented 2 years ago
comment:2

This might not be entirely related, but I have just seen the same test fail with another error on a patchbot:

sage -t --long --random-seed=249317294624714313432109516979551245556 src/sage/rings/integer.pyx
**********************************************************************
File "src/sage/rings/integer.pyx", line 3006, in sage.rings.integer.Integer.divisors
Failed example:
    for i in range(20):  # long time
        try:
            alarm(RDF.random_element(1e-3, 0.5))
            _ = n.divisors()
            cancel_alarm()  # we never get here
        except AlarmInterrupt:
            pass
Exception raised:
    Traceback (most recent call last):
      File "/home/debian/sage/local/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/debian/sage/local/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.rings.integer.Integer.divisors[20]>", line 4, in <module>
        _ = n.divisors()
      File "sage/rings/integer.pyx", line 3108, in sage.rings.integer.Integer.divisors (build/cythonized/sage/rings/integer.c:20364)
        sig_on()
    SystemError: calling remove_from_pari_stack() inside sig_on()