ruthst00 commented on issue #2849: URL: https://github.com/apache/activemq/issues/2849#issuecomment-6899846407
## Triage: expected behavior, not a demonstrated regression (AI assisted) @muskaan62, connection-wide failure is intentional for this interruption path. Not every session-level exception fails the connection. - There is no session-isolation switch in this path. For independent failure boundaries, use __separate physical connections__; pooled logical connections may still share an underlying connection. - Prefer cooperative shutdown: clear the running flag, use bounded receive waits, let in-flight operations finish, then close resources. Avoid interrupting threads inside synchronous JMS requests. - A configured send timeout may help bound waits, but it is not equivalent to cancellation and does not prove that the broker did not accept the message. - Do not expect a Java upgrade or client upgrade alone to change this longstanding behavior. ### Why other sessions fail Separate JMS sessions provide independent session contexts, __not independent transport-failure boundaries__. They share the connection’s transport and response correlator. The failure path is explicit: 1. [`FutureResponse.getResult()`](/Users/ruthes00/github/activemq/activemq-client/src/main/java/org/apache/activemq/transport/FutureResponse.java:45) catches an interruption while waiting for a response. 2. `dealWithInterrupt()` calls the transport filter’s `onException()` with an `InterruptedIOException`, then restores the thread’s interrupt flag. 3. [`ResponseCorrelator.onException()`](/Users/ruthes00/github/activemq/activemq-client/src/main/java/org/apache/activemq/transport/ResponseCorrelator.java:124) fails __all pending requests__ and records an error that rejects subsequent requests. 4. [`ActiveMQConnection.onException()`](/Users/ruthes00/github/activemq/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java:2093) schedules transport disposal and connection cleanup. This was deliberate. [Commit `0a12bcb928`](https://github.com/apache/activemq/commit/0a12bcb928f151b5ace9a0cffc34ec717b6a8e9c), from November 2015, explicitly says synchronous requests interrupted while waiting should fail the connection: OpenWire operations are not idempotent, so replaying them is unsafe and broker-side state must be torn down. I also checked the published __5.19.0 source__; it contains the same interruption-handling path. ### Problems with the supplied reproducer The example does not reliably demonstrate the claimed producer-to-consumer propagation: - Both running flags start as `false` and are never set to `true`, so neither messaging loop normally executes. - `main()` immediately calls both stop methods, __directly interrupting both threads__. - The posted stack trace shows the consumer itself interrupted while waiting in __`createConsumer()`__, not a producer interrupted during `send()`. - There is no `connection.start()`, which is needed for message delivery to the consumer. These defects do not invalidate the general observation—the shared failure path exists—but the trace is not proof of the described sequence. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
