Claus Ibsen created CAMEL-26314:
-----------------------------------

             Summary: camel-core - DefaultDebugger: a single-stepped exchange 
that fails is never removed, and after 100 failures no exchange can be 
single-stepped
                 Key: CAMEL-26314
                 URL: https://issues.apache.org/jira/browse/CAMEL-26314
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: 4.24.0


{{DefaultDebugger}} keeps the exchanges that are being single-stepped in 
{{singleSteps}}, and it refuses a new one once {{maxConcurrentSingleSteps}} 
(100) entries are there ({{startSingleStepExchange}}).

An entry is removed only on {{ExchangeCompletedEvent}}: in the single-step 
breakpoint's {{onEvent}} ({{stopSingleStepExchange}}) and in the fail-safe of 
{{DebugEventNotifier.notify}}. A failed exchange does not raise 
{{ExchangeCompletedEvent}}. {{DefaultUnitOfWork.done}} raises either 
{{ExchangeFailedEvent}} or {{ExchangeCompletedEvent}}, not both:

{code:java}
final boolean failed = exchange.isFailed();
if (failed) {
    EventHelper.notifyExchangeFailed(exchange.getContext(), exchange);
} else {
    EventHelper.notifyExchangeDone(exchange.getContext(), exchange);
}
{code}

So each single-stepped exchange that fails leaves its entry behind, together 
with its {{Breakpoint}}. After 100 such failures, {{startSingleStepExchange}} 
returns false for every new exchange, and single-stepping no longer works until 
the debugger is stopped ({{singleSteps.clear()}}).

h4. Proposed change
Treat {{ExchangeFailedEvent}} like {{ExchangeCompletedEvent}} in both places 
(the single-step breakpoint's {{onEvent}} and the {{DebugEventNotifier}} 
fail-safe). A test can single-step an exchange that fails and assert that 
{{singleSteps}} is empty afterwards (or that 101 failing exchanges can each be 
single-stepped).

Side note: {{singleSteps}} is a plain {{HashMap}}, and it is written from the 
routing threads of concurrent exchanges. It may be worth making it a 
{{ConcurrentHashMap}} in the same change.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to