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

Canceling an asynchronous solve operation does not always work. #34

Closed
rkaminsk opened this issue Jun 22, 2018 · 1 comment
Closed

Canceling an asynchronous solve operation does not always work. #34

rkaminsk opened this issue Jun 22, 2018 · 1 comment

Comments

@rkaminsk
Copy link
Member

I have been experimenting with the following program:

#script (python) 

import clingo

def main(prg):
    prg.ground([("pigeon", [])])
    for i in range(0,2):
        prg.assign_external(clingo.Function("p"), True)
        prg.solve()
        prg.assign_external(clingo.Function("p"), False)
        with prg.solve(async=True) as handle:
            #print "wait"
            #handle.wait(0.01)
            print "cancel"
            handle.cancel()

#end.

#const n = 190.

#program pigeon.
#external p.

1 { p(X); q(X) } 1 :- X = 1..n, not p.
:- not n+1 { p(1..n); q(1..n) }, not p.

As long as there is a small wait before an asynchronous solve operation is canceled things work fine. But when the search operation is canceled immediately, the above program consistently hangs. (The program will not be solved in the lifetime of our solar system.) The python wait and cancel calls directly map to clasp API calls in ClaspFacade::SolveHandle.

BenKaufmann added a commit that referenced this issue Jun 22, 2018
 * (Asynchronous) SequentialSolve failed to handle interruptions
   occuring between the initial attach and the actual start of the
   solve loop.
@BenKaufmann
Copy link
Contributor

Thanks. Should be fixed.

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