Skip to content

Commit 31bf501

Browse files
authored
Fix some small problems (#3878)
* `--interim-simplification` problem: When `maxDepth < forceFallback` , the proxy was considering a genuine `DepthBound` result as an artefact caused by the interim simplification, and would try to continue execution. * The `cabal.project` file was set up to never profile any `booster` or `kore-rpc-types` code * When given a path to a non-existing file as input, `RpcClient` reported a server connection error and retried (the criterion for recognising connection errors was to general).
1 parent b272101 commit 31bf501

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

booster/tools/booster/Proxy.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,18 +292,21 @@ respondEither cfg@ProxyConfig{statsVar, boosterState} booster kore req = case re
292292
else "Iterating execute request at " <> show currentDepth
293293
-- calculate depth limit, considering possible forced Kore simplification
294294
let mbDepthLimit = case (cfg.forceFallback, r.maxDepth) of
295-
(Just (Depth forceDepth), Just (Depth maxDepth)) ->
296-
if cDepth + forceDepth < maxDepth
297-
then Just $ Depth forceDepth
298-
else Just $ Depth $ maxDepth - cDepth
295+
(Just (Depth forceDepth), Just (Depth maxDepth))
296+
| cDepth + forceDepth < maxDepth ->
297+
cfg.forceFallback
298+
| otherwise ->
299+
Just $ Depth $ maxDepth - cDepth
299300
(Just forceDepth, _) -> Just forceDepth
300301
(_, Just maxDepth) -> Just $ maxDepth - currentDepth
301302
_ -> Nothing
302303
(bResult, bTime) <- Stats.timed $ booster (Execute r{maxDepth = mbDepthLimit})
303304
case bResult of
304305
Right (Execute boosterResult)
305306
-- the execution reached the depth bound due to a forced Kore simplification
306-
| boosterResult.reason == DepthBound && isJust cfg.forceFallback -> do
307+
| DepthBound <- boosterResult.reason
308+
, Just forceDepth <- cfg.forceFallback
309+
, forceDepth == boosterResult.depth -> do
307310
Log.logInfoNS "proxy" . Text.pack $
308311
"Forced simplification at " <> show (currentDepth + boosterResult.depth)
309312
simplifyResult <- simplifyExecuteState logSettings r._module def boosterResult.state

booster/tools/rpc-client/RpcClient.hs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,18 @@ retryTCPClient delay retries host port operation
192192
error $ "retryTCPClient: negative parameters " <> show (delay, retries)
193193
| retries == 0 = runTCPClient host port operation
194194
| otherwise =
195-
catchJust isNoSuchThing (runTCPClient host port operation) tryAgain
195+
catchJust isSocketError (runTCPClient host port operation) tryAgain
196196
where
197-
tryAgain _ = do
198-
hPutStrLn stderr $ "[Warning] Could not connect (retrying " <> show retries <> " times)"
197+
tryAgain msg = do
198+
hPutStrLn stderr $
199+
"[Warning] Could not connect: " <> msg <> ". Retrying " <> show retries <> " times"
199200
sleep delay
200201
retryTCPClient delay (retries - 1) host port operation
201202

202-
isNoSuchThing :: IOError -> Maybe ()
203-
isNoSuchThing IOError{ioe_type = NoSuchThing} = Just ()
204-
isNoSuchThing _other = Nothing
203+
isSocketError :: IOError -> Maybe String
204+
isSocketError IOError{ioe_type = NoSuchThing, ioe_filename = Nothing, ioe_description} =
205+
Just ioe_description
206+
isSocketError _other = Nothing
205207

206208
----------------------------------------
207209
-- Logging

cabal.project

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ packages:
66

77
package *
88
ghc-options: -fhide-source-paths -haddock
9-
profiling-detail: none
109

1110
package kore
1211
ghc-options: -Wall -Werror
13-
profiling-detail: toplevel-functions
12+
profiling-detail: exported-functions
1413

1514
source-repository-package
1615
type: git

0 commit comments

Comments
 (0)