Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch IOError when a query times out and retry correctly #3692

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion kore/src/Kore/Rewrite/SMT/Evaluator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import Control.Error (
MaybeT (..),
runMaybeT,
)
import Control.Exception (IOException)
import Control.Lens qualified as Lens
import Control.Monad.Catch qualified as Exception
import Control.Monad.Counter qualified as Counter
import Control.Monad.Morph qualified as Morph
import Control.Monad.State.Strict qualified as State
Expand Down Expand Up @@ -186,7 +188,7 @@ decidePredicate onUnknown sideCondition predicates =
& runMaybeT
where
query :: MaybeT Simplifier Result
query = SMT.withSolver . evalTranslator $ do
query = onErrorUnknown $ SMT.withSolver . evalTranslator $ do
tools <- Simplifier.askMetadataTools
Morph.hoist SMT.liftSMT $ do
predicates' <-
Expand All @@ -196,6 +198,9 @@ decidePredicate onUnknown sideCondition predicates =
traverse_ SMT.assert predicates'
SMT.check >>= maybe empty return

onErrorUnknown action =
action `Exception.catch` \(_ :: IOException) -> pure Unknown

retry = retryWithScaledTimeout $ query <* debugRetrySolverQuery predicates

retryWithScaledTimeout :: MonadSMT m => m Result -> m Result
Expand Down
Loading