Skip to content

Commit 4f2e602

Browse files
committed
add logging to failures caught in doRestartChild
The `Left` branch of doStartChild is unrecoverable. It currently drops the affected child without logging.
1 parent bae39c9 commit 4f2e602

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Control/Distributed/Process/Platform/Supervisor.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,13 +1169,18 @@ doRestartChild _ spec _ state = do -- TODO: use ProcessId and DiedReason to log
11691169
case start' of
11701170
Right (ref, st') -> do
11711171
return $ markActive st' ref spec
1172-
Left _ -> do -- TODO: handle this by policy
1172+
Left err -> do -- TODO: handle this by policy
11731173
-- All child failures are handled via monitor signals, apart from
1174-
-- BadClosure, which comes back from doStartChild as (Left err).
1174+
-- BadClosure and UnresolvableAddress from the StarterProcess
1175+
-- variants of ChildStart, which both come back from
1176+
-- doStartChild as (Left err).
11751177
-- Since we cannot recover from that, there's no point in trying
11761178
-- to start this child again (as the closure will never resolve),
11771179
-- so we remove the child forthwith. We should provide a policy
11781180
-- for handling this situation though...
1181+
sup <- getSelfPid
1182+
logEntry Log.error $
1183+
mkReport "Unrecoverable error in child" sup (childKey spec) (show err)
11791184
return $ ( (active ^: Map.filter (/= chKey))
11801185
. (bumpStats Active chType decrement)
11811186
. (bumpStats Specified chType decrement)

0 commit comments

Comments
 (0)