Closed lsrcz closed 3 months ago
Great! Unfortunately I’m away from any decent computing device till about May 15th. I’ll take a look at that time.
I’m happy to merge to mainline if you’ve an urgent need. Let me know.
No hurry, I can rely on my own patched version for now.
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. https://github.com/LeventErkok/sbv/blob/ddd2c87f280e3bd29d1115b388282ec3a9b2647b/Data/SBV/Utils/ExtractIO.hs#L29-L31After doing these changes, I observed no zombie or long-running processes after killing a thread running sbv.