Repository navigation
Fail the space when relaxation cannot keep a value - #276
Merged
Merged
Conversation
Search::relax called home.failed(), which only queries the space, where it meant home.fail(). When posting a kept solution value failed, the space stayed unfailed. IntVarImp::eq_full assigns the variable before it detects that the value lies in a hole, so the variable was left assigned without its propagators being notified. Restart-based search with relaxation then continued on an inconsistent space. With no-goods, the no-goods propagator cancelled subscriptions against that state, VarImp::remove ran past the subscription array, and the corrupted memory crashed later in Space::_clone. photo with -restart constant -restart-scale 5 -nogoods true -seed 4 crashed this way.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
photo -restart constant -restart-scale 5 -nogoods true -seed 4 -time 5000 1segfaults (exit 139) inSpace::_clone, which BAB calls from insideRBS::next. It reproduces on 6.5.0 and on the Gecode 7 line. On Linux, unfixedmaincrashed in 19 of 32 runs across seeds 1–8, restart scales 1, 5 and 8, and-threads 2. Without-nogoodsit does not crash.Root cause
gecode/search/relax.hhis shared by the Int, Bool, Set and Floatrelaxfunctions. When posting a kept solution value fails, it calledhome.failed(), which only asks whether the space has failed. It should callhome.fail(), so the space stayed unfailed.IntVarImp::eq_fullassigns the variable before it detects that the value lies in a hole. It then returnsfail(home)without notifying any propagators, relying on the caller to fail the space. The variable was therefore left assigned while its propagators were never told. Search then continued on that inconsistent space. With no-goods, the no-goods propagator cancelled subscriptions against it, andVarImp::removeran past the end of the subscription array, which is not bounds-checked outside audit builds. The corrupted memory crashed later inSpace::_clone.No-goods make the crash common: they prune the persistent space, so the LNS relaxation often tries to keep a value that is no longer in the domain.
Fix
Call
home.fail(). Every caller ofrelaxalready handles a failed space; in RBS, a failed spoke leads to the next restart. The fix changes no API and prunes nothing extra.Test
Search::Relax::Failedrelaxes two variables with domain {0,2} against the solution value 1, with probability 0 so that one value is kept, and checks that the space ends up failed. It fails without the fix and passes with it.Validation
-tag standard -test Search::-tag standard -test NoGoods::check-tag standard -test Search::/NoGoods::Search::Relax,Search::RBS,-tag check NoGoods::-nogoods true, unfixedmain(GCC)-nogoods true, fixed (GCC, and ASan+UBSan)uv run misc/tidy.py --checkpasses.Related, not fixed here
Space::masterposts restart no-goods even whenslave()returned false. No-goods recorded in a restricted (LNS) spoke are then posted into the master, which can turn a non-optimal solution into a false optimality proof.