Segmentation fault in singular multi-polynomial factor() function

71 views
Skip to first unread message

Dominique Laurain

unread,
Jun 4, 2014, 5:19:43 PM6/4/14
to sage-s...@googlegroups.com
I usually factor "small" polynomials...but this time I got a "Segmentation fault" for a bigger one...is it ok to get that error (no control of enough memory or processor task force to get the result) ?

Maybe I want toooo much :-) ... over the quota.?

Dominique

Project-id:   6429970e-5a78-4aee-a6b1-af1e80542481
Location:    f71dab5b-f40c-48db-a3d2-eefe6ec55f01
hostname : compute2dc2


Run in SAGE python cell:

# Segmentation fault in singular factorization
u,v,w = var('u,v,w')
f(u,v,w) = 16*u^4*v^6*w^2 + 144*u^4*v^5*w^3 + 80*u^3*v^6*w^3 + 416*u^4*v^4*w^4 + 560*u^3*v^5*w^4 + 96*u^2*v^6*w^4 + 560*u^4*v^3*w^5 + 1296*u^3*v^4*w^5 + 368*u^2*v^5*w^5 + 16*u*v^6*w^5 + 384*u^4*v^2*w^6 + 1328*u^3*v^3*w^6 + 528*u^2*v^4*w^6 + 48*u*v^5*w^6 + 128*u^4*v*w^7 + 608*u^3*v^2*w^7 + 336*u^2*v^3*w^7 + 48*u*v^4*w^7 + 16*u^4*w^8 + 96*u^3*v*w^8 + 80*u^2*v^2*w^8 + 16*u*v^3*w^8 - 112*u^4*v^5*w^2 - 64*u^3*v^6*w^2 - 752*u^4*v^4*w^3 - 960*u^3*v^5*w^3 - 176*u^2*v^6*w^3 - 1648*u^4*v^3*w^4 - 3744*u^3*v^4*w^4 - 1344*u^2*v^5*w^4 - 64*u*v^6*w^4 - 1600*u^4*v^2*w^5 - 5744*u^3*v^3*w^5 - 3104*u^2*v^4*w^5 - 304*u*v^5*w^5 - 704*u^4*v*w^6 - 3840*u^3*v^2*w^6 - 3056*u^2*v^3*w^6 - 480*u*v^4*w^6 - 112*u^4*w^7 - 1008*u^3*v*w^7 - 1296*u^2*v^2*w^7 - 304*u*v^3*w^7 - 64*u^3*w^8 - 176*u^2*v*w^8 - 64*u*v^2*w^8 + 312*u^4*v^4*w^2 + 400*u^3*v^5*w^2 + 76*u^2*v^6*w^2 + 1540*u^4*v^3*w^3 + 3436*u^3*v^4*w^3 + 1360*u^2*v^5*w^3 + 72*u*v^6*w^3 + 2412*u^4*v^2*w^4 + 8788*u^3*v^3*w^4 + 5572*u^2*v^4*w^4 + 616*u*v^5*w^4 + 1500*u^4*v*w^5 + 8836*u^3*v^2*w^5 + 8524*u^2*v^3*w^5 + 1540*u*v^4*w^5 + 316*u^4*w^6 + 3484*u^3*v*w^6 + 5512*u^2*v^2*w^6 + 1548*u*v^3*w^6 + 400*u^3*w^7 + 1348*u^2*v*w^7 + 628*u*v^2*w^7 + 72*u^2*w^8 + 76*u*v*w^8 - 448*u^4*v^3*w^2 - 1004*u^3*v^4*w^2 - 420*u^2*v^5*w^2 - 24*u*v^6*w^2 - 1548*u^4*v^2*w^3 - 5672*u^3*v^3*w^3 - 3920*u^2*v^4*w^3 - 476*u*v^5*w^3 - 1544*u^4*v*w^4 - 9500*u^3*v^2*w^4 - 10280*u^2*v^3*w^4 - 2076*u*v^4*w^4 - 460*u^4*w^5 - 5696*u^3*v*w^5 - 10244*u^2*v^2*w^5 - 3280*u*v^3*w^5 - 1008*u^3*w^6 - 3884*u^2*v*w^6 - 2108*u*v^2*w^6 - 404*u^2*w^7 - 492*u*v*w^7 - 24*u*w^8 + 352*u^4*v^2*w^2 + 1304*u^3*v^3*w^2 + 952*u^2*v^4*w^2 + 124*u*v^5*w^2 + 764*u^4*v*w^3 + 4824*u^3*v^2*w^3 + 5604*u^2*v^3*w^3 + 1228*u*v^4*w^3 + 364*u^4*w^4 + 4836*u^3*v*w^4 + 9468*u^2*v^2*w^4 + 3332*u*v^3*w^4 + 1316*u^3*w^5 + 5568*u^2*v*w^5 + 3356*u*v^2*w^5 + 928*u^2*w^6 + 1252*u*v*w^6 + 124*u*w^7 - 144*u^4*v*w^2 - 928*u^3*v^2*w^2 - 1132*u^2*v^3*w^2 - 264*u*v^4*w^2 - 148*u^4*w^3 - 2056*u^3*v*w^3 - 4264*u^2*v^2*w^3 - 1608*u*v^3*w^3 - 940*u^3*w^4 - 4252*u^2*v*w^4 - 2764*u*v^2*w^4 - 1116*u^2*w^5 - 1624*u*v*w^5 - 264*u*w^6 + 24*u^4*w^2 + 344*u^3*v*w^2 + 744*u^2*v^2*w^2 + 296*u*v^3*w^2 + 348*u^3*w^3 + 1652*u^2*v*w^3 + 1136*u*v^2*w^3 + 740*u^2*w^4 + 1140*u*v*w^4 + 296*u*w^5 - 52*u^3*w^2 - 256*u^2*v*w^2 - 184*u*v^2*w^2 - 256*u^2*w^3 - 412*u*v*w^3 - 184*u*w^4 + 36*u^2*w^2 + 60*u*v*w^2 + 60*u*w^3 - 8*u*w^2
print "Factor f : ",f.factor()
︡0b6bb50a-8d75-47c8-b89a-2a6e6c21336d︡{"stdout":"Factor f : "}︡{"stderr":"Error in lines 4-4\n"}︡{"stderr":"Traceback (most recent call last):\n  File \"/projects/6429970e-5a78-4aee-a6b1-af1e80542481/.sagemathcloud/sage_server.py\", line 733, in execute\n    exec compile(block+'\\n', '', 'single') in namespace, locals\n  File \"\", line 1, in <module>\n  File \"expression.pyx\", line 8760, in sage.symbolic.expression.Expression.factor (sage/symbolic/expression.cpp:37261)\n  File \"multi_polynomial_libsingular.pyx\", line 4132, in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular.factor (sage/rings/polynomial/multi_polynomial_libsingular.cpp:26950)\n  File \"c_lib.pyx\", line 97, in sage.ext.c_lib.sig_raise_exception (sage/ext/c_lib.c:1208)\nSignalError: Segmentation fault\n"}︡

leif

unread,
Jun 4, 2014, 8:55:10 PM6/4/14
to sage-s...@googlegroups.com
Dominique Laurain wrote:
> I usually factor "small" polynomials...but this time I got a
> "Segmentation fault" for a bigger one...is it ok to get that error (no
> control of enough memory or processor task force to get the result) ?
>
> Maybe I want toooo much :-) ... over the quota.?

Certainly not a (out of) memory error; I can reproduce it with Sage
6.3.beta2, FWIW.

The answer is instantaneous with Sage 5.7 and 5.8: :-)

Factor f : 4*(v + w - 1)^3*(4*u^3*v^3 + 24*u^3*v^2*w + 20*u^3*v*w^2 +
4*u^3*w^3 + 20*u^2*v^3*w + 80*u^2*v^2*w^2 + 24*u^2*v*w^3 + 24*u*v^3*w^2
+ 20*u*v^2*w^3 + 4*v^3*w^3 - 16*u^3*v^2 - 44*u^3*v*w - 16*u^3*w^2 -
16*u^2*v^3 - 132*u^2*v^2*w - 132*u^2*v*w^2 - 16*u^2*w^3 - 44*u*v^3*w -
132*u*v^2*w^2 - 44*u*v*w^3 - 16*v^3*w^2 - 16*v^2*w^3 + 18*u^3*v +
19*u^3*w + 52*u^2*v^2 + 151*u^2*v*w + 52*u^2*w^2 + 19*u*v^3 +
151*u*v^2*w + 151*u*v*w^2 + 18*u*w^3 + 18*v^3*w + 52*v^2*w^2 + 19*v*w^3
- 6*u^3 - 47*u^2*v - 48*u^2*w - 48*u*v^2 - 137*u*v*w - 47*u*w^2 + 13*u^2
- 6*v^3 - 47*v^2*w - 48*v*w^2 + 37*u*w + 13*v^2 - 6*w^3 + 37*u*v +
37*v*w + 13*w^2 - 9*u - 9*v - 9*w + 2)*u*w^2


-leif
--
() The ASCII Ribbon Campaign
/\ Help Cure HTML E-Mail

leif

unread,
Jun 4, 2014, 9:27:50 PM6/4/14
to sage-s...@googlegroups.com
leif wrote:
> Dominique Laurain wrote:
>> I usually factor "small" polynomials...but this time I got a
>> "Segmentation fault" for a bigger one...is it ok to get that error (no
>> control of enough memory or processor task force to get the result) ?
>>
>> Maybe I want toooo much :-) ... over the quota.?
>
> Certainly not a (out of) memory error; I can reproduce it with Sage
> 6.3.beta2, FWIW.
>
> The answer is instantaneous with Sage 5.7 and 5.8: :-)
>
> Factor f : 4*(v + w - 1)^3*(4*u^3*v^3 + 24*u^3*v^2*w + 20*u^3*v*w^2 +
> 4*u^3*w^3 + 20*u^2*v^3*w + 80*u^2*v^2*w^2 + 24*u^2*v*w^3 + 24*u*v^3*w^2
> + 20*u*v^2*w^3 + 4*v^3*w^3 - 16*u^3*v^2 - 44*u^3*v*w - 16*u^3*w^2 -
> 16*u^2*v^3 - 132*u^2*v^2*w - 132*u^2*v*w^2 - 16*u^2*w^3 - 44*u*v^3*w -
> 132*u*v^2*w^2 - 44*u*v*w^3 - 16*v^3*w^2 - 16*v^2*w^3 + 18*u^3*v +
> 19*u^3*w + 52*u^2*v^2 + 151*u^2*v*w + 52*u^2*w^2 + 19*u*v^3 +
> 151*u*v^2*w + 151*u*v*w^2 + 18*u*w^3 + 18*v^3*w + 52*v^2*w^2 + 19*v*w^3
> - 6*u^3 - 47*u^2*v - 48*u^2*w - 48*u*v^2 - 137*u*v*w - 47*u*w^2 + 13*u^2
> - 6*v^3 - 47*v^2*w - 48*v*w^2 + 37*u*w + 13*v^2 - 6*w^3 + 37*u*v +
> 37*v*w + 13*w^2 - 9*u - 9*v - 9*w + 2)*u*w^2

P.S.: Works with Sage 6.1.1 as well:

Factor f : 4*(4*u^3*v^3 + 24*u^3*v^2*w + 20*u^2*v^3*w + 20*u^3*v*w^2 +
80*u^2*v^2*w^2 + 24*u*v^3*w^2 + 4*u^3*w^3 + 24*u^2*v*w^3 + 20*u*v^2*w^3
+ 4*v^3*w^3 - 16*u^3*v^2 - 16*u^2*v^3 - 44*u^3*v*w - 132*u^2*v^2*w -
44*u*v^3*w - 16*u^3*w^2 - 132*u^2*v*w^2 - 132*u*v^2*w^2 - 16*v^3*w^2 -
16*u^2*w^3 - 44*u*v*w^3 - 16*v^2*w^3 + 18*u^3*v + 52*u^2*v^2 + 19*u*v^3
+ 19*u^3*w + 151*u^2*v*w + 151*u*v^2*w + 18*v^3*w + 52*u^2*w^2 +
151*u*v*w^2 + 52*v^2*w^2 + 18*u*w^3 + 19*v*w^3 - 6*u^3 - 47*u^2*v -
48*u*v^2 - 6*v^3 - 48*u^2*w - 137*u*v*w - 47*v^2*w - 47*u*w^2 - 48*v*w^2
- 6*w^3 + 13*u^2 + 37*u*v + 13*v^2 + 37*u*w + 37*v*w + 13*w^2 - 9*u -
9*v - 9*w + 2)*u*(v + w - 1)^3*w^2


-leif

Dominique Laurain

unread,
Jun 5, 2014, 2:32:38 PM6/5/14
to sage-s...@googlegroups.com
Thanks leif for your help..
Since some weeks, I have a strange ("final destination") feeling falling too much into deep software traps at office or at home...

leif

unread,
Jun 5, 2014, 6:07:01 PM6/5/14
to sage-s...@googlegroups.com
FWIW, Singular has been upgraded from 3.1.5 (in Sage 6.1.1) to 3.1.6
(6.2 and later), so this might be an upstream regression.

The .factor() function in the Sage library hasn't changed at all AFAICS,
but other changes in Sage may have borked it as well, although the
function which apparently causes the segfault, p_Copy(), is a Singular
function.

The Sage-Singular experts should investigate...

leif

unread,
Jun 5, 2014, 6:44:17 PM6/5/14
to sage-s...@googlegroups.com
Work-around: Works in Sage 6.2 if you define f (i.e., u, v and w) "the
right way":

sage: R.<u,v,w>=QQ[]
sage: f = 16*u^4*v^6*w^2 + 144*u^4*v^5*w^3 + 80*u^3*v^6*w^3 +
sage: f.factor()
(4) * u * w^2 * (v + w - 1)^3 * (4*u^3*v^3 + 24*u^3*v^2*w + 20*u^2*v^3*w
+ 20*u^3*v*w^2 + 80*u^2*v^2*w^2 + 24*u*v^3*w^2 + 4*u^3*w^3 +
24*u^2*v*w^3 + 20*u*v^2*w^3 + 4*v^3*w^3 - 16*u^3*v^2 - 16*u^2*v^3 -
44*u^3*v*w - 132*u^2*v^2*w - 44*u*v^3*w - 16*u^3*w^2 - 132*u^2*v*w^2 -
132*u*v^2*w^2 - 16*v^3*w^2 - 16*u^2*w^3 - 44*u*v*w^3 - 16*v^2*w^3 +
18*u^3*v + 52*u^2*v^2 + 19*u*v^3 + 19*u^3*w + 151*u^2*v*w + 151*u*v^2*w
+ 18*v^3*w + 52*u^2*w^2 + 151*u*v*w^2 + 52*v^2*w^2 + 18*u*w^3 + 19*v*w^3
- 6*u^3 - 47*u^2*v - 48*u*v^2 - 6*v^3 - 48*u^2*w - 137*u*v*w - 47*v^2*w
- 47*u*w^2 - 48*v*w^2 - 6*w^3 + 13*u^2 + 37*u*v + 13*v^2 + 37*u*w +
37*v*w + 13*w^2 - 9*u - 9*v - 9*w + 2)


(In your definition, f(u,v,w)=..., f is just a symbolic expression in
the first place. It's still of course a bug that your way currently
does no longer work.)

leif

unread,
Jun 5, 2014, 7:16:12 PM6/5/14
to sage-s...@googlegroups.com
leif wrote:
> Dominique Laurain wrote:
>> Thanks leif for your help..
>> Since some weeks, I have a strange ("final destination") feeling falling
>> too much into deep software traps at office or at home...
>
> Work-around: Works in Sage 6.2 if you define f (i.e., u, v and w) "the
> right way":

Sorry, my bad, forget that... (I confused the windows and only
*thought* I was using 6.2).

Not very surprisingly, my version behaves exactly the same in Sage 6.2.
:-/ (as it just shortcuts f.polynomial(QQ).factor() to f.factor())


-leif

Volker Braun

unread,
Jun 5, 2014, 7:22:32 PM6/5/14
to sage-s...@googlegroups.com
Upstream bug:

$ sage -singular
                     SINGULAR                                 /  Development
 A Computer Algebra System for Polynomial Computations       /   version 3-1-6
                                                           0<
 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann     \   Dec 2012
FB Mathematik der Universitaet, D-67653 Kaiserslautern        \
> ring r = 0,(u,v,w),dp;
> poly f = 16*u^4*v^6*w^2+144*u^4*v^5*w^3+80*u^3*v^6*w^3+416*u^4*v^4*w^4+560*u^3*v^5*w^4+96*u^2*v^6*w^4+560*u^4*v^3*w^5+1296*u^3*v^4*w^5+368*u^2*v^5*w^5+16*u*v^6*w^5+384*u^4*v^2*w^6+1328*u^3*v^3*w^6+528*u^2*v^4*w^6+48*u*v^5*w^6+128*u^4*v*w^7+608*u^3*v^2*w^7+336*u^2*v^3*w^7+48*u*v^4*w^7+16*u^4*w^8+96*u^3*v*w^8+80*u^2*v^2*w^8+16*u*v^3*w^8-112*u^4*v^5*w^2-64*u^3*v^6*w^2-752*u^4*v^4*w^3-960*u^3*v^5*w^3-176*u^2*v^6*w^3-1648*u^4*v^3*w^4-3744*u^3*v^4*w^4-1344*u^2*v^5*w^4-64*u*v^6*w^4-1600*u^4*v^2*w^5-5744*u^3*v^3*w^5-3104*u^2*v^4*w^5-304*u*v^5*w^5-704*u^4*v*w^6-3840*u^3*v^2*w^6-3056*u^2*v^3*w^6-480*u*v^4*w^6-112*u^4*w^7-1008*u^3*v*w^7-1296*u^2*v^2*w^7-304*u*v^3*w^7-64*u^3*w^8-176*u^2*v*w^8-64*u*v^2*w^8+312*u^4*v^4*w^2+400*u^3*v^5*w^2+76*u^2*v^6*w^2+1540*u^4*v^3*w^3+3436*u^3*v^4*w^3+1360*u^2*v^5*w^3+72*u*v^6*w^3+2412*u^4*v^2*w^4+8788*u^3*v^3*w^4+5572*u^2*v^4*w^4+616*u*v^5*w^4+1500*u^4*v*w^5+8836*u^3*v^2*w^5+8524*u^2*v^3*w^5+1540*u*v^4*w^5+316*u^4*w^6+3484*u^3*v*w^6+5512*u^2*v^2*w^6+1548*u*v^3*w^6+400*u^3*w^7+1348*u^2*v*w^7+628*u*v^2*w^7+72*u^2*w^8+76*u*v*w^8-448*u^4*v^3*w^2-1004*u^3*v^4*w^2-420*u^2*v^5*w^2-24*u*v^6*w^2-1548*u^4*v^2*w^3-5672*u^3*v^3*w^3-3920*u^2*v^4*w^3-476*u*v^5*w^3-1544*u^4*v*w^4-9500*u^3*v^2*w^4-10280*u^2*v^3*w^4-2076*u*v^4*w^4-460*u^4*w^5-5696*u^3*v*w^5-10244*u^2*v^2*w^5-3280*u*v^3*w^5-1008*u^3*w^6-3884*u^2*v*w^6-2108*u*v^2*w^6-404*u^2*w^7-492*u*v*w^7-24*u*w^8+352*u^4*v^2*w^2+1304*u^3*v^3*w^2+952*u^2*v^4*w^2+124*u*v^5*w^2+764*u^4*v*w^3+4824*u^3*v^2*w^3+5604*u^2*v^3*w^3+1228*u*v^4*w^3+364*u^4*w^4+4836*u^3*v*w^4+9468*u^2*v^2*w^4+3332*u*v^3*w^4+1316*u^3*w^5+5568*u^2*v*w^5+3356*u*v^2*w^5+928*u^2*w^6+1252*u*v*w^6+124*u*w^7-144*u^4*v*w^2-928*u^3*v^2*w^2-1132*u^2*v^3*w^2-264*u*v^4*w^2-148*u^4*w^3-2056*u^3*v*w^3-4264*u^2*v^2*w^3-1608*u*v^3*w^3-940*u^3*w^4-4252*u^2*v*w^4-2764*u*v^2*w^4-1116*u^2*w^5-1624*u*v*w^5-264*u*w^6+24*u^4*w^2+344*u^3*v*w^2+744*u^2*v^2*w^2+296*u*v^3*w^2+348*u^3*w^3+1652*u^2*v*w^3+1136*u*v^2*w^3+740*u^2*w^4+1140*u*v*w^4+296*u*w^5-52*u^3*w^2-256*u^2*v*w^2-184*u*v^2*w^2-256*u^2*w^3-412*u*v*w^3-184*u*w^4+36*u^2*w^2+60*u*v*w^2+60*u*w^3-8*u*w^2;
> factorize(f);
Singular : signal 11 (v: 3160):
current line:>>factorize(f);<<
Segment fault/Bus error occurred at 2 because of 10202 (r:1402010493)
please inform the authors
trying to restart...

Volker Braun

unread,
Jun 5, 2014, 7:40:57 PM6/5/14
to sage-s...@googlegroups.com

leif

unread,
Jun 6, 2014, 5:19:04 PM6/6/14
to sage-s...@googlegroups.com
Volker Braun wrote:
> Reported at http://www.singular.uni-kl.de:8002/trac/ticket/621

Fix committed upstream:

https://github.com/Singular/Sources/commit/28f4fe9464722511718050dfab7cd61d29898968

If somebody^TM opens a ticket (or has already done so), please cc me or
post the ticket # here.

I'll otherwise probably do so, and check whether the patch applies clean
to our version (and is sufficient for it).

leif

unread,
Jun 9, 2014, 10:20:46 AM6/9/14
to sage-s...@googlegroups.com
leif wrote:
> Volker Braun wrote:
>> Reported at http://www.singular.uni-kl.de:8002/trac/ticket/621
>
> Fix committed upstream:
>
> https://github.com/Singular/Sources/commit/28f4fe9464722511718050dfab7cd61d29898968
>
>
> If somebody^TM opens a ticket (or has already done so), please cc me or
> post the ticket # here.
>
> I'll otherwise probably do so, and check whether the patch applies clean
> to our version (and is sufficient for it).

/Of course/^TM the patch from the pull request isn't sufficient (as it
isn't based on Singular 3.1.6); working on a larger patch right now...
[i.e., currently testing it]

leif

unread,
Jun 9, 2014, 3:39:10 PM6/9/14
to sage-s...@googlegroups.com
leif wrote:
> leif wrote:
>> If somebody^TM opens a ticket (or has already done so), please cc me or
>> post the ticket # here.
>>
>> I'll otherwise probably do so, and check whether the patch applies clean
>> to our version (and is sufficient for it).
>
> /Of course/^TM the patch from the pull request isn't sufficient (as it
> isn't based on Singular 3.1.6); working on a larger patch right now...
> [i.e., currently testing it]


http://trac.sagemath.org/ticket/16462

Needs review.

leif

unread,
Jun 19, 2014, 10:22:20 AM6/19/14
to sage-s...@googlegroups.com, Dominique Laurain
This is now fixed in Sage 6.3.beta4, released today.

Dominique Laurain

unread,
Jun 19, 2014, 1:45:05 PM6/19/14
to sage-s...@googlegroups.com
OK+Thanks... I will check it when release will pop up in the cloud.

William Stein

unread,
Jun 19, 2014, 1:48:59 PM6/19/14
to sage-support
On Thu, Jun 19, 2014 at 10:45 AM, Dominique Laurain
<dominique...@orange.fr> wrote:
> OK+Thanks... I will check it when release will pop up in the cloud.

I'm planning to wait for the official Sage 6.3 release before updating
the cloud. If you want to test sooner, let me know and I can drop a
temporary build in /scratch on the same VM as one of your projects
(let me know the project id).

-- William

>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
Reply all
Reply to author
Forward
0 new messages