@@ -1149,14 +1149,14 @@ tryRestartChild pid st active' spec reason
1149
1149
| True <- isTemporary (childRestart spec) = continue childRemoved
1150
1150
| DiedNormal <- reason
1151
1151
, True <- isIntrinsic (childRestart spec) = stopWith updateStopped ExitNormal
1152
- | otherwise = continue =<< doRestartChild pid spec reason st
1152
+ | otherwise = doRestartChild pid spec reason st
1153
1153
where
1154
1154
childDown = (active ^= active') $ updateStopped
1155
1155
childRemoved = (active ^= active') $ removeChild spec st
1156
1156
updateStopped = maybe st id $ updateChild chKey (setChildStopped False ) st
1157
1157
chKey = childKey spec
1158
1158
1159
- doRestartChild :: ProcessId -> ChildSpec -> DiedReason -> State -> Process State
1159
+ doRestartChild :: ProcessId -> ChildSpec -> DiedReason -> State -> Process ( ProcessAction State )
1160
1160
doRestartChild _ spec _ state = do -- TODO: use ProcessId and DiedReason to log
1161
1161
state' <- addRestart state
1162
1162
case state' of
@@ -1167,23 +1167,26 @@ doRestartChild _ spec _ state = do -- TODO: use ProcessId and DiedReason to log
1167
1167
Just st -> do
1168
1168
start' <- doStartChild spec st
1169
1169
case start' of
1170
- Right (ref, st') -> do
1171
- return $ markActive st' ref spec
1170
+ Right (ref, st') -> continue $ markActive st' ref spec
1172
1171
Left err -> do
1173
1172
-- All child failures are handled via monitor signals, apart from
1174
1173
-- BadClosure and UnresolvableAddress from the StarterProcess
1175
1174
-- variants of ChildStart, which both come back from
1176
1175
-- doStartChild as (Left err).
1177
1176
sup <- getSelfPid
1178
- logEntry Log. error $
1179
- mkReport " Unrecoverable error in child" sup (childKey spec) (show err)
1180
1177
if isTemporary (childRestart spec)
1181
- then return $ ( (active ^: Map. filter (/= chKey))
1178
+ then do
1179
+ logEntry Log. warning $
1180
+ mkReport " Error in temporary child" sup (childKey spec) (show err)
1181
+ continue $ ( (active ^: Map. filter (/= chKey))
1182
1182
. (bumpStats Active chType decrement)
1183
1183
. (bumpStats Specified chType decrement)
1184
- $ removeChild spec st
1185
- )
1186
- else die $ " Unrecoverable error in child " ++ (childKey spec)
1184
+ $ removeChild spec st)
1185
+ else do
1186
+ logEntry Log. error $
1187
+ mkReport " Unrecoverable error in child. Stopping supervisor"
1188
+ sup (childKey spec) (show err)
1189
+ stopWith st $ ExitOther $ " Unrecoverable error in child " ++ (childKey spec)
1187
1190
-- TODO: convert this to a meaningful exception type
1188
1191
1189
1192
where
0 commit comments