git.iko.soy/distributed-process
on master help sign in
Fix unbounded message box growth in call
0c1f384Edsko de Vries
distributed-process/src/Control/Distributed/Process.hs+9−2
@@ -345,8 +345,15 @@ call dict nid proc = do
345 (\(ProcessMonitorNotification _ _ reason) -> return (Left reason))
345 (\(ProcessMonitorNotification _ _ reason) -> return (Left reason))
346 ]
346 ]
347 case mResult of
347 case mResult of
348+ Right a -> do
349+ -- Wait for the monitor message so that we the mailbox doesn't grow
350+ receiveWait
351+ [ matchIf (\(ProcessMonitorNotification ref _ _) -> ref == mRef)
352+ (\(ProcessMonitorNotification {}) -> return ())
353+ ]
348− Right a -> unmonitor mRef >> return a
354+ return a
355+ Left err ->
349− Left err -> fail $ "call: remote process died: " ++ show err
356+ fail $ "call: remote process died: " ++ show err
350
357
351-- | Spawn a child process, have the child link to the parent and the parent
358-- | Spawn a child process, have the child link to the parent and the parent
352-- monitor the child
359-- monitor the child