fix: SMT session deadlocks on unread solver stderr; set-logic lost after (reset) - #228
Merged
Merged
Conversation
…(reset) Two related defects in the typechecking SMT session (Act.SMT): 1. spawnSolver creates the solver's stderr as a pipe that nothing ever reads. Solvers emit warnings there; once ~64KB accumulate, the solver blocks in write() mid-session and act blocks in poll() waiting for stdout - a permanent deadlock at zero CPU on both sides. Large specs hit this reliably: `act type` appears to hang on an SMT blow-up but is actually deadlocked on a full pipe. Fixed by draining stderr with a background thread. 2. checkSat prepends (reset) to every query, but (reset) clears the (set-logic ALL) sent by the spawn-time preamble, so every query after the first runs without a logic. This is also what makes cvc5 emit its set-logic warning triplet per query - the stderr volume that fills the pipe in (1). Fixed by re-sending the preamble after each (reset). With both fixes a ~600-line spec that previously deadlocked cvc5 in under a minute typechecks to completion.
320 trivial behaviours = 320+ queries, each preceded by (reset); before the fix that meant one solver warning block per query (~270 bytes with cvc5) written to a stderr pipe nothing read. This file generates ~86KB of pre-fix warning volume - past any kernel's pipe capacity (observed blocking as low as 8KB under pipe-buffer pressure) - so unfixed act hangs on it indefinitely (cvc5 blocked in write, act in poll, both at zero CPU); fixed act typechecks it in ~5s. Runs via the existing tests/typing/pass wildcard. Note the failure mode on regression is a hang, not a failing exit - CI job timeouts are the backstop.
lefterislazar
approved these changes
Jul 31, 2026
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.
No description provided.