[gecode-users] strange bug in propagation
Grégoire Dooms
dooms at info.ucl.ac.be
Sun Apr 16 14:45:09 CEST 2006
jeremie.vautard wrote:
> Hi !
>
> I encountered a very strange bug while testing my extensively
> defined binary constraint propagator. Under some conditions
> that I havn't really discovered right now (it seems to be at
> least with 3 of my propagators posted, but this is not
> sufficient), I get a segmentation fault after several steps of
> propagation. The most strange is that the instruction causing
> the bug is in the gecode part : gdb tells me the crash occur
> here :
>
> #0 Gecode::Int::IntVarImp::nq_full (this=0x80542f4,
> home=0x8053fa0, m=3) at ././kernel/memory-manager.icc:233
> 233 _next = n;
> (gdb) bt
> #0 Gecode::Int::IntVarImp::nq_full (this=0x80542f4,
> home=0x8053fa0, m=3) at ././kernel/memory-manager.icc:233
> #1 0x0804f047 in ExtensiveBinaryConstraint::check
> (this=0xbf840164, home=0x8053fa0, x=
> {<Gecode::VariableViewBase<Gecode::Int::IntVarImp>> =
> {var = 0x805437c}, <No data fields>}, y=
> {<Gecode::VariableViewBase<Gecode::Int::IntVarImp>> =
> {var = 0x80542f4}, <No data fields>})
> at ./int/var/imp.icc:364
> #2 0x0804f0ed in ExtensiveBinaryPropagator::propagate
> (this=0x807400c, home=0x8053fa0) at QSolve.cc:666
> #3 0xb7f1b218 in Gecode::Space::propagators (this=0x8053fa0)
> at kernel/core.cc:160
> #4 0xb7f1b7a3 in Gecode::Space::status (this=0x8053fa0,
> a=@0x80300c0, pn=@0xbf840254) at kernel/core.cc:254
>
> (The ExtensiveBinaryPropagator propagate() method does nothing
> but call an ExtensiveBinaryConstraint::check(Space* home,
> Intview x,y) method which actually remove the values and
> returns ES_NOFIX, ES_FAILED or ES_SUBSUMED).
>
> Have you even encountered this kind of bug when creating
> propagators ? Do you have an idea of what I can have done
> wrong ? In this particular example, the IntView::nq method is
> called to remove 2 from a [1..4] domain...
>
Here is a (small) check list for mistakes I did and which triggered
segfaults later :
- do you do GECODE_ME_CHECK for each basic and iterator tell on IntViews
? if not the Space might be failed before you do the tell.
You can also assert(! home.failed()); in your check method before you do
the nq tell.
- did you forget to call update on all of your views in the copy
constructor of your propagator ? If you inherit from BinaryPropagator it
is done in its copy constructor and you have to call that copy
constructor in the member initialization list of yours.
Best,
--
Grégoire
More information about the gecode-users
mailing list