davsclaus opened a new pull request, #30544: URL: https://github.com/apache/camel/pull/30544
_Claude Code on behalf of Claus Ibsen_ ## What [CAMEL-27326](https://issues.apache.org/jira/browse/CAMEL-27326). The tools that render or read routes without running them boot a short-lived in-process Camel through `Run.runTransform`: - the MCP tool `camel_render_route_diagram` - `camel cmd route-diagram` and `route-structure` on source files - `camel transform route` - `camel validate yaml-normalize` Every such run names its CamelContext `transform` and kept JMX on. When two of these run at the same time in one JVM, as the MCP server does with concurrent calls, both can take the free name `transform`, and the second fails: ``` Failed to render route diagram (org.apache.camel.dsl.jbang.run.IntegrationStartException): javax.management.InstanceAlreadyExistsException: org.apache.camel:context=transform,type=context,name="transform" ``` This is what made `RouteDiagramToolsTest.callsAtTheSameTime` flaky. It failed twice in full runs of camel-jbang-mcp today and passed on rerun. CAMEL-27156 fixed the shared work directory of the same test; this is a different cause. ## Changes - **`RunPipeline`:** a transform run sets `camel.main.jmxEnabled=false`, next to the silent, stubbed and no-autostartup settings it already has. It only dumps the routes to files and uses no MBeans. - **New test `RouteDiagramToolsTest.aTransformRunRegistersNoMBeans`:** it listens to the MBean server while a diagram renders, and asserts that no MBean of a `transform` context is registered. It is deterministic, where the race is not: it fails without the fix (`org.apache.camel:context=transform,type=context,name="transform"`, ...) and passes with it. It only counts the `transform` context, because other tests of the module start contexts of their own meanwhile. - **Test suites:** the tests of camel-jbang-run and camel-jbang-plugin-tui run with `org.apache.camel.jmx.disabled=true`, so their contexts register fewer MBeans and cannot clash. camel-jbang-core and camel-jbang-mcp keep JMX: their tests run integrations in-process with the CLI connector, whose status comes through Camel JMX. With JMX off, `RuntimeToolsChaosTest` and `LoadTest` time out waiting for the status. ## Tests - `RouteDiagramToolsTest`: 11 tests, 5 runs in a row green. The new test fails when the `RunPipeline` change is reverted. - camel-jbang-mcp: all 485 tests pass, with no flakes. - camel-jbang-run, 356 tests, and camel-jbang-plugin-tui, 2,657 tests, pass with JMX off. 🤖 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]
