Fix the zombie solver processes mentioned in #477 #691
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.
I encountered the same issue as mentioned in #477, and this pull request tries to fix it. I do not fully understand the codebase, so please carefully review my changes.
I believe that the root cause of the issue is that the
queryTerminate
(i.e., thecleanUp
function defined inrunSolver
) is skipped when an exception happens before it but after the solver has been started by therunSolver
call.This pull request moves the termination of the solver to
executeQuery
function, and terminates it immediately after we finished all the interaction with the solver. In this function, we have the handyExtractIO
class, which allows us to do the clean up no matter whether an exception is raised withfinally
.The
ExtractIO
instance forIO
is also buggy, though. It violates the law mentioned in the comment. This pull request also fixes it, and the fix is required for the clean up to work.sbv/Data/SBV/Utils/ExtractIO.hs
Lines 29 to 31 in ddd2c87
After doing these changes, I observed no zombie or long-running processes after killing a thread running sbv.