Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion during Clasp::Solver::cloneDB #57

Closed
rkaminsk opened this issue Mar 3, 2020 · 2 comments
Closed

Assertion during Clasp::Solver::cloneDB #57

rkaminsk opened this issue Mar 3, 2020 · 2 comments

Comments

@rkaminsk
Copy link
Member

rkaminsk commented Mar 3, 2020

The program below sometimes terminates with

clasp/src/solver.cpp:261: bool Clasp::Solver::cloneDB(const ConstraintDB&): Assertion `!hasConflict()' failed.

in the second solve call when multi-threading is enabled.

#include <clingo.hh>

int main() {
    Clingo::Control ctl{{"-t8"}};
    ctl.add("base", {}, R"(
        {a; b; c}.
        :- not a, not b.
        :- a,     c.
        :- a, not c.
        :- b,     c.
        :- b, not c.
    )");
    ctl.ground({{"base", {}}});
    ctl.solve().get();
    // Calling this, there sometimes is an assertion:
    ctl.solve().get();
    return 0;
}

EDIT: I simplified the program a bit; it actually does not need a propagator to trigger the assertion.

BenKaufmann added a commit that referenced this issue Mar 7, 2020
* Remove unnecessary assertion in Solver::cloneDB(). The function
  actually does not have a precondition.

* Add missing has conflict check to SharedContext::attach().
  A solver could already have a top-level conflict when attached to
  its SharedContext. This happens, for example, if a previous solve
  call already left the solver in an unconditionally unsat state.
@BenKaufmann
Copy link
Contributor

I removed the assertion and added a missing check further up the call chain that hopefully fixes the issue.

@rkaminsk
Copy link
Member Author

rkaminsk commented Mar 7, 2020

Thanks. All tests also run successfully in debug mode now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants