Claus Ibsen created CAMEL-25056:
-----------------------------------

             Summary: camel-core - Backlog debugger and tracer: fix bugs found 
in a deep review
                 Key: CAMEL-25056
                 URL: https://issues.apache.org/jira/browse/CAMEL-25056
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen


A deep review of the backlog debugger and backlog tracer 
(DefaultBacklogDebugger, DefaultDebugger, BacklogTracer, 
DefaultBacklogTracerEventMessage, ManagedBacklogDebugger) found the bugs below. 
Each one was reproduced against 4.23.0-SNAPSHOT and has a test in 
BacklogDebuggerEdgeCasesTest or BacklogTracerEdgeCasesTest that fails without 
the fix.

Debugger
# *stepOver() when not single stepping switches off all breakpoints for good.* 
It set the step-over mode, which is only reset by the next single step; at a 
breakpoint (the first stop in camel debug) or at the last step there is none, 
so every breakpoint was skipped from then on. Step over is now only set when 
single stepping, and it is reset when the single stepped exchange completes.
# *Suspend mode set with setSuspendMode (camel.debug.waitForAttach) does not 
suspend anything*, as only the flag was set; and suspend mode from the 
environment turned off with setSuspendMode(false) kept every message waiting 
forever. Setting the suspend mode now suspends or resumes the message 
processing.
# *removeAllBreakpoints() only removes the breakpoints that have a suspended 
exchange.*
# *Changing a breakpoint to a conditional breakpoint does not set its 
condition*, so it stayed unconditional.
# *A breakpoint condition that fails to evaluate fails the exchange.* It now 
logs a WARN and the breakpoint is skipped.
# *setExchangePropertyOnBreakpoint / setExchangeVariableOnBreakpoint keep the 
type of the header with the same name*, not of the property or variable.
# *The JMX evaluateExpressionAtBreakpoint(nodeId, language, expression) fails 
with NullPointerException* when the node is not suspended or the result is null.

Tracer
# *A traceFilter with a colon is taken as a language name*: ${header.foo} == 
'a:b' or ${date:now} failed with NoSuchLanguageException. A language prefix 
(simple:, jq:) is now only used when it names a language, and it is removed 
from the predicate (simple:... was previously always true).
# *A traceFilter that fails to evaluate fails the traced exchange.* The 
exchange is now not traced.
# *nodeLabel in the JSON of a traced message is escaped twice*, so the label 
read back had backslashes (such as mock:a\/b).
# *The XML dump is not well-formed when an endpoint uri, location, node id or 
header key has & or <*, as only the values were encoded.

*Not changed (for a later look)*
* The latest message history queue may throw Queue full in append mode with 
many downstream exchanges (not reproduced).
* The history capture stays stuck when tracePattern/traceFilter excludes the 
first or last event of a route.
* A step breakpoint can replace another exchange suspended at the same node, 
and step() resumes exchanges suspended at other breakpoints.
* The debugger is not prepared for shutdown (prepareShutdown is only called for 
route services), so suspended exchanges wait until the shutdown timeout.
* includeException of the debugger is not used, and a refreshed suspended 
message loses its first/last flags.

_Claude Code on behalf of Claus Ibsen_




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to