Skip to content

Commit

Permalink
add logging to failures caught in doRestartChild
Browse files Browse the repository at this point in the history
The `Left` branch of doStartChild is unrecoverable. It currently drops
the affected child without logging.
  • Loading branch information
tavisrudd committed Apr 24, 2014
1 parent bae39c9 commit 4f2e602
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Control/Distributed/Process/Platform/Supervisor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,13 +1169,18 @@ doRestartChild _ spec _ state = do -- TODO: use ProcessId and DiedReason to log
case start' of
Right (ref, st') -> do
return $ markActive st' ref spec
Left _ -> do -- TODO: handle this by policy
Left err -> do -- TODO: handle this by policy
-- All child failures are handled via monitor signals, apart from
-- BadClosure, which comes back from doStartChild as (Left err).
-- BadClosure and UnresolvableAddress from the StarterProcess
-- variants of ChildStart, which both come back from
-- doStartChild as (Left err).
-- Since we cannot recover from that, there's no point in trying
-- to start this child again (as the closure will never resolve),
-- so we remove the child forthwith. We should provide a policy
-- for handling this situation though...
sup <- getSelfPid
logEntry Log.error $
mkReport "Unrecoverable error in child" sup (childKey spec) (show err)
return $ ( (active ^: Map.filter (/= chKey))
. (bumpStats Active chType decrement)
. (bumpStats Specified chType decrement)
Expand Down

0 comments on commit 4f2e602

Please sign in to comment.