git.iko.soy/distributed-process
on master help sign in
Break feedback loop when tracing messages to the console.

If the user reregisters the "logger" with a custom process which uses 'send' or other primitives which are traced, this primitives would produce tracing messages which would cause the primitives to be called again. This bug only affects tracing messages to the console with DISTRIBUTED_PROCESS_TRACE_CONSOLE=y DISTRIBUTED_PROCESS_TRACE_FLAGS=r

commita94af5c07a9adbfbc4172452a39b2360e8593684 authorFacundo Domínguez <facundo.dominguez@tweag.io> dateThu 5 Feb 2015, 15:43 (12 years ago) parentdb5aa53
2 files changed+7−2
src/Control/Distributed/Process/Management/Internal/Trace/Tracer.hs+1−1 src/Control/Distributed/Process/Node.hs+6−1
src/Control/Distributed/Process/Management/Internal/Trace/Tracer.hs+1−1
@@ -146,7 +146,7 @@ systemLoggerTracer = do
146146 emptyPid <- return $ (nullProcessId (localNodeId node))
147147 traceMsg <- return $ NCMsg {
148148 ctrlMsgSender = ProcessIdentifier (emptyPid)
149− , ctrlMsgSignal = (NamedSend "logger"
149+ , ctrlMsgSignal = (NamedSend "trace.logger"
150150 (createUnencodedMessage msg))
151151 }
152152 liftIO $ writeChan (localCtrlChan node) traceMsg
src/Control/Distributed/Process/Node.hs+6−1
@@ -295,7 +295,12 @@ startServiceProcesses node = do
295295 tableCoordinatorPid <- fork $ Table.startTableCoordinator fork
296296 runProcess node $ register Table.mxTableCoordinator tableCoordinatorPid
297297 logger <- forkProcess node loop
298− runProcess node $ register "logger" logger
298+ runProcess node $ do
299+ register "logger" logger
300+ -- The trace.logger is used for tracing to the console to avoid feedback
301+ -- loops during tracing if the user reregisters the "logger" with a custom
302+ -- process which uses 'send' or other primitives which are traced.
303+ register "trace.logger" logger
299304 where
300305 fork = forkProcess node
301306