Croway opened a new pull request, #27380:
URL: https://github.com/apache/camel/pull/27380

   ## Summary
   
   [CAMEL-25346](https://issues.apache.org/jira/browse/CAMEL-25346)
   
   Camel Main applies `camel.devConsole.<id>.capacity` after 
`DefaultDevConsoleRegistry` has started the console, so `doInit()` had already 
allocated its buffers with the default capacity while the console kept using 
the configured one:
   
   | Console | Default | Failure with a larger configured capacity |
   |---|---|---|
   | `trace` | 100 | `IllegalStateException: Queue full` on every dump after 
the first: trace snapshots stop for good |
   | `receive` | 100 | `Queue full`, thrown into the exchange of the received 
message |
   | `event` | 25 | `ArrayIndexOutOfBoundsException` when recording events and 
on every dump |
   | `sql-trace` | 200 | `ArrayIndexOutOfBoundsException` on every dump |
   
   Found while soak-testing Kaoto Kompanion with camel-cli-connector and 
`-Dcamel.devConsole.trace.capacity=1000`.
   
   ## Fix
   
   - `setCapacity` resizes the buffers of a started console, keeping the newest 
entries.
   - The consoles index their buffers by their actual size, and the trace and 
receive queues drop the oldest entry when full (`offer` + `poll`) instead of 
computing how much to drain from the `capacity` field.
   - Small package-private helpers in `ConsoleHelper`; no public API change.
   
   Defaults, the capacity validation in `doInit()` and the startup order are 
unchanged: configurations that work today behave the same, the ones above now 
work.
   
   ## Tests
   
   - `DevConsoleCapacityTest`: each console resolved through the registry (as 
Camel Main does), capacity raised after start (the 4 tests fail without the 
fix) and lowered after start.
   - `ConsoleHelperTest`: the resize and slot helpers.
   - `camel-console` module: 242 tests pass.
   
   Backports to `camel-4.22.x` and `camel-4.18.x` are planned once this is 
merged.
   
   _Claude Code on behalf of Croway_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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