Skip to content

fix: SMT session deadlocks on unread solver stderr; set-logic lost after (reset) - #228

Merged
lefterislazar merged 3 commits into
argotorg:mainfrom
mijovic:fix/smt-stderr-deadlock
Jul 31, 2026
Merged

fix: SMT session deadlocks on unread solver stderr; set-logic lost after (reset)#228
lefterislazar merged 3 commits into
argotorg:mainfrom
mijovic:fix/smt-stderr-deadlock

Conversation

@mijovic

@mijovic mijovic commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

mijovic and others added 3 commits July 30, 2026 07:47
…(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
lefterislazar merged commit 270c558 into argotorg:main Jul 31, 2026
2 checks passed
@mijovic
mijovic deleted the fix/smt-stderr-deadlock branch July 31, 2026 10:30
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

Successfully merging this pull request may close these issues.

3 participants