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

   _Claude Code on behalf of davsclaus_
   
   [CAMEL-25230](https://issues.apache.org/jira/browse/CAMEL-25230)
   
   When a Spring Boot app with the CLI connector fails to start before Camel 
started (for example `APPLICATION FAILED TO START` because port 8080 is in 
use), the JVM does not exit.
   
   The connector is started early, while the CamelContext is built, so its 
status is available during startup. When the app then fails, the CamelContext 
was never started and is never stopped, so the connector isn't stopped either. 
Its scheduled thread `Camel Thread #1 - LocalCliConnector` is not a daemon 
thread, so it keeps the JVM running; `jstack` shows it as the only non-daemon 
thread.
   
   **Fix:** the file transport's thread is a daemon thread, as the WebSocket 
transport's threads already are.
   
   **Verified:**
   - `camel run pom.xml` of `camel-spring-boot-examples/metrics` with port 8080 
taken: before, the JVM stayed up; after, it exits right after `APPLICATION 
FAILED TO START`.
   - `LocalCliConnectorFileTransportTest.theConnectorDoesNotKeepTheJvmAlive` 
starts the connector from a non-daemon thread, as Spring Boot's main thread is. 
It fails without the fix and passes with it. The module tests pass (25).
   
   **Upgrade guide (4.23):** an app that only kept running because of this 
thread now exits. To keep it running on purpose, use for example 
`camel.main.run-controller=true` for a Spring Boot app without a web server.
   
   🤖 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