Opened 4 years ago

Closed 3 years ago

#24288 closed defect (duplicate)

Failing tests in sage.rings.bernmm due to cysignals error on SAGE_DEBUG=yes

Reported by: embray Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: packages: standard Keywords:
Cc: jdemeyer Merged in:
Authors: Reviewers:
Report Upstream: Fixed upstream, in a later stable release. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by embray)

When running these tests (and possible others; need to check) I'm getting a lot of error messages + tracebacks from Cysignals on a debug build:

sage -t src/sage/rings/bernmm.pyx
**********************************************************************
File "src/sage/rings/bernmm.pyx", line 67, in sage.rings.bernmm.bernmm_bern_rat
Failed example:
    lst1 = [ bernoulli(2*k, algorithm='bernmm', num_threads=2) for k in [2932, 2957, 3443, 3962, 3973] ]
Expected nothing
Got:
    <BLANKLINE>
    *** ERROR *** sig_unblock() with sig_on_count = 1, block_sigint = 0
    /home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/cysignals/signals.so(+0x4eab)[0x7f48f55f7eab]
    /home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/sage/ext/memory.so(+0x24d5)[0x7f48b35f24d5]
    /home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/sage/ext/memory.so(+0x2122)[0x7f48b35f2122]
    /home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/sage/ext/memory.so(+0x247f)[0x7f48b35f247f]
    /home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/sage/ext/memory.so(+0x2320)[0x7f48b35f2320]
    /home/embray/src/sagemath/sage/local/lib/libgmp.so.23(__gmpz_realloc+0x5a)[0x7f48f4a5fbdb]
    /home/embray/src/sagemath/sage/local/lib/libgmp.so.23(__gmpz_mul_ui+0x94)[0x7f48f4a59bad]
    /home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/sage/rings/bernmm.so(_ZN6bernmm6workerEPv+0x1bc)[0x7f4895cfa91a]
    /home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/sage/rings/bernmm.so(_ZN6bernmm8bern_ratEP12__mpq_structli+0x4c6)[0x7f4895cfafbb]
    /home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/sage/rings/bernmm.so(+0xbbdc)[0x7f4895ceebdc]
    /home/embray/src/sagemath/sage/local/lib/python2.7/site-packages/sage/rings/bernmm.so(+0xb96c)[0x7f4895cee96c]
    /home/embray/src/sagemath/sage/local/lib/libpython2.7.so.1.0(PyCFunction_Call+0xbd)[0x7f48fabd911f]
...

I trimmed the traceback after this point since it appears to just be Python's stack.

It seems likely to do with the use of sig_realloc inside GMP/MPIR in a multi-threaded environment, whereas we know cysignals is not currently thread safe. We should probably disable its use before calling this multi-threaded procedure...

Change History (11)

comment:1 Changed 4 years ago by embray

  • Description modified (diff)

comment:2 Changed 4 years ago by embray

  • Milestone changed from sage-8.1 to sage-8.2

comment:3 Changed 4 years ago by embray

This is still a problem I'm seeing. It goes away when building cysignals without debug, but that's just because the messages aren't being displayed. The underlying problem is probably still there.

comment:4 Changed 3 years ago by embray

  • Milestone changed from sage-8.2 to sage-8.3

comment:5 Changed 3 years ago by embray

  • Milestone changed from sage-8.3 to sage-wishlist

comment:6 Changed 3 years ago by jdemeyer

C11 atomic operations might help with this.

comment:7 Changed 3 years ago by jdemeyer

  • Milestone changed from sage-wishlist to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from new to closed

This is fixed in the experimental branch https://github.com/sagemath/cysignals/pull/109

comment:8 Changed 3 years ago by embray

  • Milestone sage-duplicate/invalid/wontfix deleted
  • Resolution duplicate deleted
  • Status changed from closed to new

Interesting. Is there a separate ticket in Sage for this? Even though the issue is for cysignals to fix, it's still an issue in Sage as well until/unless Sage depends on a cysignals that has the fix.

comment:9 Changed 3 years ago by jdemeyer

Now fixed in cysignals master.

comment:10 Changed 3 years ago by jdemeyer

  • Report Upstream changed from N/A to Fixed upstream, but not in a stable release.

comment:11 Changed 3 years ago by jdemeyer

  • Milestone set to sage-duplicate/invalid/wontfix
  • Report Upstream changed from Fixed upstream, but not in a stable release. to Fixed upstream, in a later stable release.
  • Resolution set to duplicate
  • Status changed from new to closed

Fixed by #27070

Note: See TracTickets for help on using tickets.