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

Abort when Kore's simplifier throws DecidePredicateUnknown #392

Merged
merged 12 commits into from
Dec 8, 2023
2 changes: 1 addition & 1 deletion dev-tools/kore-rpc-dev/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ main = do
jsonRpcServer
srvSettings
(const $ respond koreRespond)
[handleErrorCall, handleSomeException]
[Kore.handleDecidePredicateUnknown, handleErrorCall, handleSomeException]
interruptHandler _ = do
when (logLevel >= LevelInfo) $
hPutStrLn stderr "[Info#proxy] Server shutting down"
Expand Down
12 changes: 10 additions & 2 deletions tools/booster/Proxy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module Proxy (

import Control.Concurrent.MVar qualified as MVar
import Control.Monad (when)
import Control.Monad.Catch (MonadCatch (..), catch)
import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.Logger qualified as Log
import Control.Monad.Trans.Except (runExcept)
Expand Down Expand Up @@ -43,6 +44,7 @@ import Kore.JsonRpc.Types qualified as ExecuteRequest (ExecuteRequest (..))
import Kore.JsonRpc.Types qualified as SimplifyRequest (SimplifyRequest (..))
import Kore.JsonRpc.Types.Log qualified as RPCLog
import Kore.Log qualified
import Kore.Log.DecidePredicateUnknown (DecidePredicateUnknown, externaliseDecidePredicateUnknown)
import Kore.Syntax.Definition (SentenceAxiom)
import Kore.Syntax.Json.Types qualified as KoreJson
import SMT qualified
Expand Down Expand Up @@ -72,7 +74,7 @@ serverError detail = ErrorObj ("Server error: " <> detail) (-32032)
respondEither ::
forall m.
Log.MonadLogger m =>
MonadIO m =>
(MonadIO m, MonadCatch m) =>
ProxyConfig ->
Respond (API 'Req) m (API 'Res) ->
Respond (API 'Req) m (API 'Res) ->
Expand Down Expand Up @@ -418,7 +420,13 @@ respondEither ProxyConfig{statsVar, forceFallback, boosterState} booster kore re
postExecSimplify ::
LogSettings -> TimeSpec -> Maybe Text -> KoreDefinition -> API 'Res -> m (API 'Res)
postExecSimplify logSettings start mbModule def = \case
Execute res -> Execute <$> simplifyResult res
Execute res ->
Execute
<$> ( simplifyResult res
`catch` ( \(err :: DecidePredicateUnknown) ->
pure res{reason = Aborted, unknownPredicate = Just . externaliseDecidePredicateUnknown $ err}
)
)
other -> pure other
where
-- timeLog :: TimeDiff -> Maybe [LogEntry]
Expand Down
2 changes: 1 addition & 1 deletion tools/booster/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ main = do
jsonRpcServer
srvSettings
(const $ Proxy.respondEither proxyConfig boosterRespond koreRespond)
[handleErrorCall, handleSomeException]
[Kore.handleDecidePredicateUnknown, handleErrorCall, handleSomeException]
interruptHandler _ = do
when (logLevel >= LevelInfo) $
hPutStrLn stderr "[Info#proxy] Server shutting down"
Expand Down