Repository navigation
Cache deterministic Z3 errors - #1840
Merged
Merged
Conversation
An ERROR result was never cached, so a query whose formula Z3 rejects, or whose model cannot be parsed, paid a full Z3 round-trip again on every reappearance. The executor now marks these errors as deterministic and the solver caches them. Errors that may be transient, such as container or I/O failures, are still never cached.
agusaldasoro
marked this pull request as ready for review
October 7, 2026 12:50
jgaleotti
approved these changes
Oct 7, 2026
arcuri82
approved these changes
Oct 8, 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.
Problem
SMTLibZ3DbConstraintSolvernever cached anERRORresult, on the grounds that it might be a transient Docker failure. Many errors are not transient, though:(error "...")and exits with code 1.SMTResultParser.The same query produces the same formula and the same output every time. The search keeps producing such queries, so each reappearance paid for SMT-LIB generation, a temporary file and a full round-trip to the Z3 container, only to fail again. Each repeat was also counted as a new Z3 error in the statistics.
Fix
Z3Resultgets anisDeterministicError()flag and adeterministicError(message)factory.error(message)keeps its meaning: an error that may be transient.Z3DockerExecutorreports two cases as deterministic:(error, i.e. Z3 rejected the formula;satmodel.Everything else stays a plain
error: I/O or interruption, other exit codes, empty output, and other runtime exceptions while running the container. Their message no longer claims a parsing failure.SMTLibZ3DbConstraintSolvercaches anERRORonly when it is deterministic. A cached error is served like a cachedUNSAT: a cache hit that returns no actions.UNKNOWNand transient errors are still never cached.Tests
Z3DockerExecutorTest, against the Z3 image:whenSolvingInvalidFileItReturnsErrornow also checks that the error is deterministic.whenFormulaIsRejectedTheErrorIsDeterministic: a formula with an unescaped quote in a string literal, which Z3 rejects partway through the file.whenSolvingEmptyFileItReturnsErrorchecks that empty output is not treated as deterministic.All tests in
core-extra/solverand underorg.evomaster.core.database.sql.solverpass. The comments that said errors are never cached have been updated.The caching itself is a single guarded line in the solver. It has no end-to-end test, because every query that currently makes Z3 fail is a bug fixed in another open PR (#1836, #1838), and such a test would break once those are merged.