allthingssecurity commented on PR #28537: URL: https://github.com/apache/camel/pull/28537#issuecomment-6438274760
@davsclaus thanks, applied here in e04a519d369c (a new commit on top). **`doStop` ordering:** the manager is now stopped in a `finally` after closing the transport, and the pending calls are failed after that. So a call that a `process()` registers before the manager stops is failed too, and the `AtomicBoolean` still keeps a call that the selector thread completes meanwhile from being completed twice. Each pending call is failed in its own `try`/`catch` that logs a WARN, so a continuation that throws neither skips the other calls nor keeps the selector thread running (the manager is already stopped by then). **Nits:** `getPendingCallbacks()` is now `getPendingCallbackCount()`. The `(AsyncProducer)` cast is gone, and `stoppingTheProducerFailsAnInFlightCall` stops the producer in a `finally`. **Test:** new `aContinuationThatThrowsDoesNotKeepTheSelectorThreadRunning`, with latches and no sleeps. It sends a `ping` to a server that reads the request and never answers, with a continuation that throws. It then expects `stop()` not to throw, the exchange to complete with the `CamelExchangeException`, no pending call left, and the producer's `TAsyncClientManager#SelectorThread` to end (`join` with a 10 s bound). With the previous `doStop` it fails: `Unexpected exception thrown: java.lang.IllegalStateException: the continuation of the exchange fails`, so the manager was never stopped. I did not find a deterministic test for a `process()` that runs between the loop and the stop without adding a hook to the producer, so that ordering is covered by reading the code only. camel-thrift unit tests: 59 run, 0 failures. The formatter and import sort made no changes. I updated the description to match. _Claude Code on behalf of allthingssecurity_ -- 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]
