sagemath / sage

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

Polybori segfault #17143

Closed simon-king-jena closed 9 years ago

simon-king-jena commented 9 years ago

With the file attached, one gets:

sage: I = load('/home/king/Sage/work/pbori/ideal.sobj')
sage: I
Ideal (x10*x199*x206 + x10*x206*x210, x80*x192*x193*x194*x195*x196*x197*x198*x199*x201*x202 + x80*x192*x193*x194*x195*x196*x198*x199*x201*x202, x80*x192*x193*x194*x195*x196*x197*x198*x199*x201 + x80*x192*x193*x194*x195*x196*x198*x199*x201, x80*x192*x193*x194*x195*x196*x198*x199*x201*x202*x207*x208 + x80*x192*x193*x194*x195*x196*x198*x199*x201*x202*x208*x209, x80*x192*x193*x194*x195*x196*x198*x199*x200*x201*x202*x208 + x80*x192*x193*x194*x195*x196*x198*x199*x201*x202*x208*x209, x11*x199*x206 + x11*x206*x210, x11*x199 + x11*x210, x11*x210 + x169*x210, x11*x210 + x169*x199, x10*x199 + x10*x210, x10*x199*x202*x206 + x10*x202*x206*x210, x165*x210*x211 + x165*x211, x11*x199*x202*x206 + x11*x202*x206*x210, x165*x199 + x165*x210) of Boolean PolynomialRing in x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39, x40, x41, x42, x43, x44, x45, x46, x47, x48, x49, x50, x51, x52, x53, x54, x55, x56, x57, x58, x59, x60, x61, x62, x63, x64, x65, x66, x67, x68, x69, x70, x71, x72, x73, x74, x75, x76, x77, x78, x79, x80, x81, x82, x83, x84, x85, x86, x87, x88, x89, x90, x91, x92, x93, x94, x95, x96, x97, x98, x99, x100, x101, x102, x103, x104, x105, x106, x107, x108, x109, x110, x111, x112, x113, x114, x115, x116, x117, x118, x119, x120, x121, x122, x123, x124, x125, x126, x127, x128, x129, x130, x131, x132, x133, x134, x135, x136, x137, x138, x139, x140, x141, x142, x143, x144, x145, x146, x147, x148, x149, x150, x151, x152, x153, x154, x155, x156, x157, x158, x159, x160, x161, x162, x163, x164, x165, x166, x167, x168, x169, x170, x171, x172, x173, x174, x175, x176, x177, x178, x179, x180, x181, x182, x183, x184, x185, x186, x187, x188, x189, x190, x191, x192, x193, x194, x195, x196, x197, x198, x199, x200, x201, x202, x203, x204, x205, x206, x207, x208, x209, x210, x211
sage: I.groebner_basis()
---------------------------------------------------------------------------
SignalError                               Traceback (most recent call last)
<ipython-input-56-0bd7e420c954> in <module>()
----> 1 I.groebner_basis()

/home/king/Sage/git/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/pbori.so in sage.rings.polynomial.pbori.BooleanPolynomialIdeal.groebner_basis (build/cythonized/sage/rings/polynomial/pbori.cpp:38218)()

/home/king/Sage/git/sage/local/lib/python2.7/site-packages/sage/ext/c_lib.so in sage.ext.c_lib.sig_raise_exception (build/cythonized/sage/ext/c_lib.c:1168)()

SignalError: Segmentation fault

Interestingly, if I do the same example in the debug version of Sage, it does work!

I hope putting Alexander on Cc counts as "reported upstream"...

Upstream: Reported upstream. No feedback yet.

CC: @alexanderdreyer @vbraun

Component: commutative algebra

Keywords: polybori segfault

Reviewer: Jeroen Demeyer

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

simon-king-jena commented 9 years ago

A segfaulting example of an ideal in a boolean polynomial ring

simon-king-jena commented 9 years ago

Description changed:

--- 
+++ 
@@ -17,6 +17,6 @@
 SignalError: Segmentation fault

-Interestingly, if I do the same example in the debug version of Sage does work! +Interestingly, if I do the same example in the debug version of Sage, it does work!

I hope putting Alexander on Cc counts as "reported upstream"...

simon-king-jena commented 9 years ago
comment:1

Attachment: ideal.sobj.gz

jdemeyer commented 9 years ago
comment:2

Works for me:

sage: I = load('/tmp/ideal.sobj')
sage: I
Ideal (x10*x199*x206 + x10*x206*x210, x80*x192*x193*x194*x195*x196*x197*x198*x199*x201*x202 + x80*x192*x193*x194*x195*x196*x198*x199*x201*x202, x80*x192*x193*x194*x195*x196*x197*x198*x199*x201 + x80*x192*x193*x194*x195*x196*x198*x199*x201, x80*x192*x193*x194*x195*x196*x198*x199*x201*x202*x207*x208 + x80*x192*x193*x194*x195*x196*x198*x199*x201*x202*x208*x209, x80*x192*x193*x194*x195*x196*x198*x199*x200*x201*x202*x208 + x80*x192*x193*x194*x195*x196*x198*x199*x201*x202*x208*x209, x11*x199*x206 + x11*x206*x210, x11*x199 + x11*x210, x11*x210 + x169*x210, x11*x210 + x169*x199, x10*x199 + x10*x210, x10*x199*x202*x206 + x10*x202*x206*x210, x165*x210*x211 + x165*x211, x11*x199*x202*x206 + x11*x202*x206*x210, x165*x199 + x165*x210) of Boolean PolynomialRing in x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39, x40, x41, x42, x43, x44, x45, x46, x47, x48, x49, x50, x51, x52, x53, x54, x55, x56, x57, x58, x59, x60, x61, x62, x63, x64, x65, x66, x67, x68, x69, x70, x71, x72, x73, x74, x75, x76, x77, x78, x79, x80, x81, x82, x83, x84, x85, x86, x87, x88, x89, x90, x91, x92, x93, x94, x95, x96, x97, x98, x99, x100, x101, x102, x103, x104, x105, x106, x107, x108, x109, x110, x111, x112, x113, x114, x115, x116, x117, x118, x119, x120, x121, x122, x123, x124, x125, x126, x127, x128, x129, x130, x131, x132, x133, x134, x135, x136, x137, x138, x139, x140, x141, x142, x143, x144, x145, x146, x147, x148, x149, x150, x151, x152, x153, x154, x155, x156, x157, x158, x159, x160, x161, x162, x163, x164, x165, x166, x167, x168, x169, x170, x171, x172, x173, x174, x175, x176, x177, x178, x179, x180, x181, x182, x183, x184, x185, x186, x187, x188, x189, x190, x191, x192, x193, x194, x195, x196, x197, x198, x199, x200, x201, x202, x203, x204, x205, x206, x207, x208, x209, x210, x211
sage: G = I.groebner_basis()
sage: G
Polynomial Sequence with 22 Polynomials in 21 Variables
sage: list(G)
[x10*x80*x192*x193*x194*x195*x196*x197*x198*x201*x210 + x10*x80*x192*x193*x194*x195*x196*x198*x20
 x10*x80*x192*x193*x194*x195*x196*x198*x200*x201*x202*x208*x210 + x10*x80*x192*x193*x194*x195*x196*x198*x201*x202*x208*x20
 x10*x80*x192*x193*x194*x195*x196*x198*x201*x202*x207*x208*x210 + x10*x80*x192*x193*x194*x195*x196*x198*x201*x202*x208*x20
 x10*x199 + x10*x210,
 x11*x165*x211 + x165*x169*x211,
 x11*x199 + x169*x210,
 x11*x210 + x169*x210,
 x80*x165*x192*x193*x194*x195*x196*x197*x198*x201*x210 + x80*x165*x192*x193*x194*x195*x196*x198*x201*x210
 x80*x165*x192*x193*x194*x195*x196*x197*x198*x201*x211 + x80*x165*x192*x193*x194*x195*x196*x198*x201*x211
 x80*x165*x192*x193*x194*x195*x196*x198*x200*x201*x202*x208*x210 + x80*x165*x192*x193*x194*x195*x196*x198*x201*x202*x208*x209*x210,
 x80*x165*x192*x193*x194*x195*x196*x198*x200*x201*x202*x208*x211 + x80*x165*x192*x193*x194*x195*x196*x198*x201*x202*x208*x209*x211,
 x80*x165*x192*x193*x194*x195*x196*x198*x201*x202*x207*x208*x210 + x80*x165*x192*x193*x194*x195*x196*x198*x201*x202*x208*x209*x210,
 x80*x165*x192*x193*x194*x195*x196*x198*x201*x202*x207*x208*x211 + x80*x165*x192*x193*x194*x195*x196*x198*x201*x202*x208*x209*x211,
 x80*x169*x192*x193*x194*x195*x196*x197*x198*x201*x210 + x80*x169*x192*x193*x194*x195*x196*x198*x201*x210
 x80*x169*x192*x193*x194*x195*x196*x198*x200*x201*x202*x208*x210 + x80*x169*x192*x193*x194*x195*x196*x198*x201*x202*x208*x209*x210,
 x80*x169*x192*x193*x194*x195*x196*x198*x201*x202*x207*x208*x210 + x80*x169*x192*x193*x194*x195*x196*x198*x201*x202*x208*x209*x210,
 x80*x192*x193*x194*x195*x196*x197*x198*x199*x201 + 
 x80*x192*x193*x194*x195*x196*x198*x199*x200*x201*x202*x208 + x80*x192*x193*x194*x195*x196*x198*x199*x201*x
 x80*x192*x193*x194*x195*x196*x198*x199*x201*x202*x207*x208 + x80*x192*x193*x194*x195*x196*x198*x199*x201*x
 x165*x199 + x165*x210,
 x165*x210*x211 + x165*x211,
 x169*x199 + x169*x210]
jdemeyer commented 9 years ago
comment:3

Most likely explanation is either a compiler bug or a broken build. So:

1) Does the problem persist after make distclean && make? 2) Does the problem persist after make distclean && env SAGE_INSTALL_GCC=yes make?

jdemeyer commented 9 years ago
comment:4

There is still a bug though (for a different ticket), the result of a second call to groebner_basis() is different:

sage: I.groebner_basis()
Polynomial Sequence with 22 Polynomials in 21 Variables
sage: I.groebner_basis()
Polynomial Sequence with 24 Polynomials in 21 Variables
simon-king-jena commented 9 years ago
comment:5

Replying to @jdemeyer:

Works for me:

...
sage: G = I.groebner_basis()
sage: G
Polynomial Sequence with 22 Polynomials in 21 Variables

21 variables only? Did you edit? The ring has more than 100 variables.

simon-king-jena commented 9 years ago
comment:6

And Jeroen, did you use a debug version of Sage? I don't see the segfault in the debug version, I only see it in a "normal" Sage version

jdemeyer commented 9 years ago
comment:7

A normal version of Sage.

jdemeyer commented 9 years ago
comment:8
sage: G.variables()
(x211,
 x210,
 x209,
 x208,
 x207,
 x202,
 x201,
 x200,
 x199,
 x198,
 x197,
 x196,
 x195,
 x194,
 x193,
 x192,
 x169,
 x165,
 x80,
 x11,
 x10)
simon-king-jena commented 9 years ago
comment:9

I see! I thought the number of variables coincides with the number of variables of the ring, but actually it only gives the number of used variables.

What architecture are you using? I learnt that I am on 32 bit.

jdemeyer commented 9 years ago
comment:10

64-bit x86_64

simon-king-jena commented 9 years ago
comment:11

Replying to @jdemeyer:

64-bit x86_64

OK. I have

sage: import platform
sage: platform.architecture()
('32bit', 'ELF')
sage: platform.processor()
'i686'
sage: platform.linux_distribution()
('openSUSE ', '12.3', 'i586')
sage: platform.python_compiler()
'GCC 4.7.2 20130108 [gcc-4_7-branch revision 195012'

whatever of it is relevant...

jdemeyer commented 9 years ago
comment:12

On a different 32-bit system, it also works:

sage: G = I.groebner_basis()
sage: G
Polynomial Sequence with 22 Polynomials in 21 Variables
jdemeyer commented 9 years ago
comment:13

Replying to @simon-king-jena:

whatever of it is relevant...

It seems that the problem is only happening on your specific system. If you want to dig deeper, you should follow my suggestions from [comment:3]

simon-king-jena commented 9 years ago
comment:14

Replying to @jdemeyer:

It seems that the problem is only happening on your specific system. If you want to dig deeper, you should follow my suggestions from [comment:3]

OK. Will do so as soon as I did some review of one of Nicolas' tickets.

simon-king-jena commented 9 years ago
comment:15

Another data point: I get several segfaults in

sage -t --long src/sage/rings/polynomial/pbori.pyx

and Nicolas gets the same. I guess he will soon comment here.

nthiery commented 9 years ago
comment:16

Indeed: with develop=6.4beta4 (or more precisely very close thereof), and on my laptop (Ubuntu 10.4):

sage: import platform
sage: sage: platform.architecture()
('64bit', 'ELF')
sage:  platform.linux_distribution()
('debian', 'jessie/sid', '')
sage: platform.python_compiler()
'GCC 4.8.2'

I get a good dozen of segfaults:

sage -t --long src/sage/rings/polynomial/pbori.pyx
**********************************************************************
File "src/sage/rings/polynomial/pbori.pyx", line 125, in sage.rings.polynomial.pbori
Failed example:
    for f in I2.groebner_basis():
        f
Exception raised:
    Traceback (most recent call last):
      File "/opt/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 486, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/opt/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 849, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.rings.polynomial.pbori[10]>", line 1, in <module>
        for f in I2.groebner_basis():
      File "sage/rings/polynomial/pbori.pyx", line 5062, in sage.rings.polynomial.pbori.BooleanPolynomialIdeal.groebner_basis (build/cythonized/sage/rings/polynomial/pbori.cpp:38218)
      File "sage/ext/c_lib.pyx", line 97, in sage.ext.c_lib.sig_raise_exception (build/cythonized/sage/ext/c_lib.c:1168)
    SignalError: Segmentation fault
....
Unhandled SIGSEGV: A segmentation fault occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Sage will now terminate.
------------------------------------------------------------------------

If useful, I could post a complete trace.

jdemeyer commented 9 years ago
comment:17

This might also be an instance of #17072.

simon-king-jena commented 9 years ago
comment:18

Replying to @jdemeyer:

This might also be an instance of #17072.

... which means we should make disct-clean, make, and in future this will not be needed because #17072 was merged?

simon-king-jena commented 9 years ago
comment:19

After pulling from develop, export SAGE_UPGRADE=yes, and make, the problem vanishes. So, probably this ticket can be closed.

jdemeyer commented 9 years ago
comment:20

Replying to @simon-king-jena:

After pulling from develop, export SAGE_UPGRADE=yes

If doing the former, the latter shouldn't be needed anymore (#17072).

jdemeyer commented 9 years ago

Reviewer: Jeroen Demeyer