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