gnodet commented on PR #31136:
URL: https://github.com/apache/camel/pull/31136#issuecomment-7287420935

   Good catch on checking this — I ran the new test against \`main\` 
**without** the production change to confirm.
   
   **Result: the test fails (ConditionTimeout) on current \`main\`** — the 
consumer thread dies after the first \`AssertionError\` and the remaining 4 
exchanges are never processed.
   
   The reason is in \`doRun()\`'s structure on \`main\`:
   
   \`\`\`java
   while (queue != null && isRunAllowed()) {
       // …
       try {
           // inner try
           processPolledExchange(exchange);
       } catch (Exception e) {               // doesn't catch Error
           getExceptionHandler()…;
       }
       // …
   } catch (InterruptedException e) { … }
     catch (VirtualMachineError e) {         // outer: stops consumer
       handleFatalError(e);
     }
     catch (Throwable e) {                   // outer: also catches non-VME 
Error
       getExceptionHandler()…;
     }
   // ← the while loop does NOT resume here after the outer catch
   \`\`\`
   
   The outer \`catch (Throwable)\` **is** at the same level as the \`while\` — 
it is not inside the loop body. When an \`AssertionError\` escapes the inner 
\`catch (Exception)\`, it unwinds through the entire \`while\` block, is caught 
by the outer \`catch (Throwable)\`, the exception handler is called — and then 
the thread returns from \`doRun()\`. The loop is gone. The consumer thread 
exits permanently.
   
   So the description ("escaped both catch blocks … terminated the consumer 
thread") is accurate. The fix is real, not a refactor.
   
   The description could be more precise about the nesting — the 
\`AssertionError\` is caught by the outer handler, but that outer handler is 
**outside** the loop, so the loop never resumes. I'll update the PR description 
to clarify this.
   
   _Claude Code on behalf of gnodet_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to