git.iko.soy/distributed-process
on master help sign in
trace process deaths to the GHC event log
297458fTim Watson
distributed-process/src/Control/Distributed/Process/Node.hs+9
@@ -42,6 +42,7 @@ import qualified Data.Set as Set
42import Data.Foldable (forM_)
42import Data.Foldable (forM_)
43import Data.Maybe (isJust, isNothing, catMaybes)
43import Data.Maybe (isJust, isNothing, catMaybes)
44import Data.Typeable (Typeable)
44import Data.Typeable (Typeable)
45+import Debug.Trace
45import Control.Category ((>>>))
46import Control.Category ((>>>))
46import Control.Applicative ((<$>))
47import Control.Applicative ((<$>))
47import Control.Monad (void, when)
48import Control.Monad (void, when)
@@ -222,6 +223,10 @@ startServiceProcesses node = do
222 sendChan ch ()
223 sendChan ch ()
223 ]
224 ]
224
225
226+-- | Send a message to the GHC event log
227+logEvent :: String -> IO ()
228+logEvent = traceEventIO
229+
225-- | Force-close a local node
230-- | Force-close a local node
226--
231--
227-- TODO: for now we just close the associated endpoint
232-- TODO: for now we just close the associated endpoint
@@ -267,6 +272,10 @@ forkProcess node proc = modifyMVar (localState node) startProcess
267 reason <- Exception.catch
272 reason <- Exception.catch
268 (runLocalProcess lproc proc >> return DiedNormal)
273 (runLocalProcess lproc proc >> return DiedNormal)
269 (return . DiedException . (show :: SomeException -> String))
274 (return . DiedException . (show :: SomeException -> String))
275+
276+ -- [Issue #104]
277+ logEvent (show reason)
278+
270 -- [Unified: Table 4, rules termination and exiting]
279 -- [Unified: Table 4, rules termination and exiting]
271 modifyMVar_ (localState node) (cleanupProcess pid)
280 modifyMVar_ (localState node) (cleanupProcess pid)
272 writeChan (localCtrlChan node) NCMsg
281 writeChan (localCtrlChan node) NCMsg