Closed simon-king-jena closed 11 years ago
Very strange I don't remember seeing anything like it in sage on gentoo or lmnd. I am not convinced that it is just from python debugging unless we collaterally fixed this along with singular and linbox. Of course now I realise that it may be the result from a doctest so it may have been dormant on us all along.
Could not reproduce in sage-on-gentoo but we don't have "--with-pydebug" by default (can still build python with debugging symbols for gdb but not the stuff from pydebug). Investigating further.
PolyEntryVector::append
contains an assertion, which does not apply when compiled without Debug-Options. The actual problem is probably the ._change_ordering
, which never was a user command. It will yield inconsistencies (we should remove it) , so please use the ordering option of BooleanPolynomialRing
(DegNegLex
is dp_asc
). Perhaps that already fixed the problem.
Replying to @alexanderdreyer:
PolyEntryVector::append
contains an assertion, which does not apply when compiled without Debug-Options. The actual problem is probably the._change_ordering
, which never was a user command. It will yield inconsistencies (we should remove it) , so please use the ordering option ofBooleanPolynomialRing
(DegNegLex
isdp_asc
). Perhaps that already fixed the problem.
So, you say I should rewrite the test, so that ._change_ordering
is not used?
Do you mean doing something like:
sage: from polybori import *
sage: B.<x,y,z> = BooleanPolynomialRing(order='lex')
sage: C.<x,y,z> = BooleanPolynomialRing(order='degneglex')
sage: ideal = BooleanPolynomialVector([x+z, y+z])
sage: sage: FGLMStrategy(B, C, ideal)
because it bangs as well with
terminate called after throwing an instance of 'std::runtime_error'
what(): Operands come from different manager.
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libcsage.so(print_backtrace+0x31)[0x7ffcdf8aed7d]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libcsage.so(sigdie+0x14)[0x7ffcdf8aedaf]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libcsage.so(sage_signal_handler+0x1da)[0x7ffcdf8ae95b]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf310)[0x7ffce464a310]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35)[0x7ffce3bc6dd5]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x17b)[0x7ffce3bc9efb]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x11d)[0x7ffcdf5dc89d]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x63996)[0x7ffcdf5da996]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x639c3)[0x7ffcdf5da9c3]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x63bee)[0x7ffcdf5dabee]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/python2.7/site-packages/sage/rings/polynomial/pbori.so(_ZNK8polybori16CApplyNodeFacadeINS_8BooleSetEP6DdNodeE16checkSameManagerERKS1_+0xc0)[0x7ffcbf85e9ba]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/python2.7/site-packages/sage/rings/polynomial/pbori.so(_ZNK8polybori16CApplyNodeFacadeINS_8BooleSetEP6DdNodeE5applyIP15pbori_DdManagerEES1_PFS3_T_S3_S3_ERKS1_+0x2e)[0x7ffcbf8578a4]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpolybori_groebner-0.8.2.so.0(_ZN8polybori8groebner19MinimalLeadingTerms7cleanupERKNS_13BooleMonomialE+0x69)[0x7ffcbef58319]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpolybori_groebner-0.8.2.so.0(_ZN8polybori8groebner19MinimalLeadingTerms6updateERKNS_13BooleMonomialE+0x47)[0x7ffcbef58677]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpolybori_groebner-0.8.2.so.0(_ZN8polybori8groebner17ReductionStrategy19setupSetsForElementERKNS0_9PolyEntryE+0x61)[0x7ffcbef57031]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpolybori_groebner-0.8.2.so.0(_ZN8polybori8groebner12FGLMStrategyC2ERKNS_13BoolePolyRingES4_RKSt6vectorINS_15BoolePolynomialESaIS6_EE+0x513)[0x7ffcbef20a03]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/python2.7/site-packages/sage/rings/polynomial/pbori.so(_ZN10WrappedPtrIN8polybori8groebner12FGLMStrategyEEC1INS0_13BoolePolyRingES5_St6vectorINS0_15BoolePolynomialESaIS7_EEEERKT_RKT0_RKT1_+0x3f)[0x7ffcbf85665d]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/python2.7/site-packages/sage/rings/polynomial/pbori.so(+0x11c33e)[0x7ffcbf7fa33e]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/python2.7/site-packages/sage/rings/polynomial/pbori.so(+0x11b4fc)[0x7ffcbf7f94fc]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0xe0657)[0x7ffce4937657]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyObject_Call+0x7f)[0x7ffce48a92c1]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15b7ad)[0x7ffce49b27ad]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15aae5)[0x7ffce49b1ae5]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x7c67)[0x7ffce49ac3cc]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x111c)[0x7ffce49aee02]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalCode+0x5a)[0x7ffce49a4744]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15d3e6)[0x7ffce49b43e6]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x43c0)[0x7ffce49a8b25]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x111c)[0x7ffce49aee02]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15af0e)[0x7ffce49b1f0e]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15aac9)[0x7ffce49b1ac9]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x7c67)[0x7ffce49ac3cc]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x111c)[0x7ffce49aee02]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15af0e)[0x7ffce49b1f0e]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15aac9)[0x7ffce49b1ac9]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x7c67)[0x7ffce49ac3cc]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15ade3)[0x7ffce49b1de3]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15aac9)[0x7ffce49b1ac9]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x7c67)[0x7ffce49ac3cc]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x111c)[0x7ffce49aee02]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15af0e)[0x7ffce49b1f0e]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15aac9)[0x7ffce49b1ac9]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x7c67)[0x7ffce49ac3cc]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x111c)[0x7ffce49aee02]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15af0e)[0x7ffce49b1f0e]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15aac9)[0x7ffce49b1ac9]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x7c67)[0x7ffce49ac3cc]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x111c)[0x7ffce49aee02]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15af0e)[0x7ffce49b1f0e]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x15aac9)[0x7ffce49b1ac9]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x7c67)[0x7ffce49ac3cc]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x111c)[0x7ffce49aee02]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyEval_EvalCode+0x5a)[0x7ffce49a4744]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(+0x18bd81)[0x7ffce49e2d81]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyRun_FileExFlags+0xbf)[0x7ffce49e2d07]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyRun_SimpleFileExFlags+0x2be)[0x7ffce49e1504]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(PyRun_AnyFileExFlags+0x88)[0x7ffce49e0b62]
/home/jp/boulot/sage/sage-5.6.beta2/local/lib/libpython2.7.so.1.0(Py_Main+0xd29)[0x7ffce49fcb76]
python(main+0x20)[0x40085c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7ffce3bb36ad]
python[0x400779]
------------------------------------------------------------------------
Unhandled SIGABRT: An abort() 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(). You might
want to run Sage under gdb with 'sage -gdb' to debug this.
Sage will now terminate.
------------------------------------------------------------------------
/home/jp/boulot/sage/sage-5.6.beta2/spkg/bin/sage : ligne 310 : 29842 Abandon sage-ipython "$@" -i
wich seems better but should be caught properly if needed.
I'm not really aware of what the above code should do, so my attempt may be completely senseless (although I feel Sage should not crash in this case neither).
But the following which looks a little better seems to work:
sage: sage: from polybori import *
sage: sage: B.<x,y,z> = BooleanPolynomialRing(order='lex')
sage: C = B.clone(ordering=dp_asc)
sage: sage: ideal = BooleanPolynomialVector([x+z, y+z])
sage: sage: sage: FGLMStrategy(B, C, ideal)
<sage.rings.polynomial.pbori.FGLMStrategy object at 0x7379ab0>
We want that old_ring is in degneglex ordering. Shouldn't the following work
sage: from polybori import *
sage: target_ring = BooleanPolynomialRing(names=['x','y','z'])
sage: source_ring.<x,y,z> = BooleanPolynomialRing(order="DegNegLex")
sage: ideal = BooleanPolynomialVector([x+z, y+z])
sage: z > y > x
True
sage: FGLMStrategy(source_ring, target_ring, ideal)
However, it still crashes!
Replying to @jpflori:
But the following which looks a little better seems to work:
sage: sage: from polybori import * sage: sage: B.<x,y,z> = BooleanPolynomialRing(order='lex') sage: C = B.clone(ordering=dp_asc) sage: sage: ideal = BooleanPolynomialVector([x+z, y+z]) sage: sage: sage: FGLMStrategy(B, C, ideal) <sage.rings.polynomial.pbori.FGLMStrategy object at 0x7379ab0>
I can confirm that this works. However, big surprise:
The following very similar attempt still crashes:
sage: from polybori import *
sage: target_ring = BooleanPolynomialRing(3,names=['x','y','z'])
sage: source_ring = target_ring.clone(ordering=dp_asc)
sage: x,y,z = source_ring.gens()
sage: z > y > x
True
sage: ideal = BooleanPolynomialVector([x+z, y+z])
sage: FGLMStrategy(source_ring, target_ring, ideal)
python: groebner/include/polybori/groebner/PolyEntryVector.h:74: virtual void polybori::groebner::PolyEntryVector::append(const polybori::groebner::PolyEntry&): Assertion `m_indices.checked(back().lead) == (size_type)-1' failed.
So, Alexander, it seems that a misuse of ._change_ordering
is not the problem. There is a bug, that ought to be fixed.
The difference between my crashing example and Jean-Pierre's non-crashing example is that I test z > y > x
. No idea what that means.
I was able to reproduce Simon's example now with plain polybori. The problem is that the input ideal must be a reduced Gröbner basis (fglm does not compute a Groebner basis itself, it just converts). This is what the assertion complains about. But since a user can trigger this, an assertion is probably not the best idea.
I could patch polybori to throw an exception here. What do you think?
I suggest to
Apply FGLMStrategy_sigon.patch
and use the patched spkg here: http://boxen.math.washington.edu/home/dreyer/spkg/polybori-0.8.2.p0.spkg
The spkg just applies the following patch:
--- a/groebner/include/polybori/groebner/PolyEntryVector.h Sat Dec 22 02:54:10 2012 +0100
+++ b/groebner/include/polybori/groebner/PolyEntryVector.h Sun Dec 30 22:56:49 2012 +0100
@@ -71,7 +71,10 @@
virtual void append(const PolyEntry& element) {
m_data.push_back(element);
- PBORI_ASSERT(m_indices.checked(back().lead) == (size_type)-1);
+#ifndef PBORI_NDEBUG
+ if(m_indices.checked(back().lead) != (size_type)-1)
+ throw std::runtime_error("leading terms not unique when appending to PolyEntryVector");
+#endif
m_indices.insert(back(), size() - 1);
}
Author: AlexanderDreyer
Replying to @alexanderdreyer:
I was able to reproduce Simon's example now with plain polybori. The problem is that the input ideal must be a reduced Gröbner basis (fglm does not compute a Groebner basis itself, it just converts). This is what the assertion complains about. But since a user can trigger this, an assertion is probably not the best idea.
I could patch polybori to throw an exception here. What do you think?
Good idea! Now we have just to make sure that Sage catch the exception (which it did not seem to do in my example at least).
Replying to @jpflori:
I could patch polybori to throw an exception here. What do you think?
Good idea! Now we have just to make sure that Sage catch the exception (which it did not seem to do in my example at least).
Did apply the Sage-library patch, I mentioned above? (And rebuild?)
Also, perhaps the exception is not thrown at all. This is the case if PBORI_NDEBUG
is still set when building polybori. Did you re-install polybori with SAGE_DEBUG=yes in the environment?
Attachment: FGLMStrategy_sigon.patch.gz
patch for pbori.pyx
Ah, and of course, we have to fix the broken doctest. So please apply the recent FGLMStrategy_sigon.patch. I've also added an optional - debug doctest for the case above.
Apply FGLMStrategy_sigon.patch
Description changed:
---
+++
@@ -82,3 +82,7 @@
#47 0x00007ffff7b12536 in Py_Main (argc=3, argv=0x7fffffffd218) at Modules/main.c:639
#48 0x00000000004007b4 in main (argc=3, argv=0x7fffffffd218) at ./Modules/python.c:23
+ + +Apply: Attach:FGLMStrategy_sigon.patch +Install: http://boxen.math.washington.edu/home/dreyer/spkg/polybori-0.8.2.p0.spkg
Description changed:
---
+++
@@ -83,6 +83,8 @@
#48 0x00000000004007b4 in main (argc=3, argv=0x7fffffffd218) at ./Modules/python.c:23
+Apply +attachment: FGLMStrategy_sigon.patch
-Apply: Attach:FGLMStrategy_sigon.patch -Install: http://boxen.math.washington.edu/home/dreyer/spkg/polybori-0.8.2.p0.spkg +Install +http://boxen.math.washington.edu/home/dreyer/spkg/polybori-0.8.2.p0.spkg
Everything looks fine to me except for a spurious .orig file in the patches dir of the spkg.
Ah, sorry! I fixed that and replaced the spkg above.
It's fine now.
I think we should also open a follow up ticket to deprecate _change_ordering in Sage.
Reviewer: Jean-Pierre Flori
!_change_ordering
is a private method, i.e., it starts with an underscore. We don't need to deprecate it, we can simply remove it.
Replying to @malb:
!
_change_ordering
is a private method, i.e., it starts with an underscore. We don't need to deprecate it, we can simply remove it.
Should I update the patch, or do we need another ticket?
I'd say let's do this in another ticket. The issues are related because the bug was discovered in a doctest involving this method, but the fact that method should not be used is different.
But if you prefer to do it here, please do.
Replying to @jpflori:
But if you prefer to do it here, please do.
No problem, I'd prefer a new ticket, too.
Replying to @alexanderdreyer:.
No problem, I'd prefer a new ticket, too.
I created #13900 for this purpose.
Indeed, _change_ordering
can simply be removed now (see #13900).
Merged: sage-5.6.beta3
Changed author from AlexanderDreyer to Alexander Dreyer
The following crash occurs in Sage's debug version of #13864:
The gdb backtrace is as follows:
Apply attachment: FGLMStrategy_sigon.patch
Install http://boxen.math.washington.edu/home/dreyer/spkg/polybori-0.8.2.p0.spkg
Upstream: Reported upstream. No feedback yet.
CC: @alexanderdreyer @sagetrac-PolyBoRi
Component: commutative algebra
Keywords: polybori FGLMStrategy debug
Author: Alexander Dreyer
Reviewer: Jean-Pierre Flori
Merged: sage-5.6.beta3
Issue created by migration from https://trac.sagemath.org/ticket/13883