Closed spring-projects-issues closed 10 months ago
Stéphane Nicoll commented
Can you please attach a sample that reproduces the issues (with the steps to run that locally)
Stéphane Nicoll commented
Closing due to lack of feedback.
Itzik Bar David commented
I have experienced the same issue when using DefaultMessageListenerContainer
and setting Prefetch=0
in activemq connection.
Please see attached [^spring-jms-shutdown-hangs.zip] for simple reproduction
The problem is in AbstractJmsListeningContainer.java
on the shutdown
method.
First, it stops the connection and then waits for AsyncMessageListenerInvokers
to deactivate themselves. The wait operation hangs.
+Insights+:
prefetch=0
it doesn't use any timeout when waiting for a message from the broker. so it blocks until a message is available.+Thoughts+:
shutdown
method of AbstractJmsListeningContainer.java
, that the shared connection is stopped, and only after waiting for all invokes it is shutdown.Thanks for the sample and sorry it was overlooked. I've updated your sample to Spring Framework 5 and it does work as expected now.
Doug Harmon opened SPR-15579 and commented
JDK 1.8.0_112 spring-jms-4.3.8.RELEASE.jar activemq-client-5.14.5.jar
When using spring's 4.3.8 DefaultMessageListenerContainer (DMLC) to consume messages from AMQ 5.14.5 server, and using prefetch of 0, spring container hangs when shutting down DMLC (e.g. on tomcat server shutdown).
Applicable 2 threads from spring client app thread dump (logs on separate network so I cannot copy/paste):
"dmlc-1" ... at org.apache.activemq.FifoMessageDispatchChannel.dequeue(FifoMessageDispatchChannel.java:72)
"http-bio-exec-11" at org.springframework.jms.listener.DefaultMessageListenerContainer.doShutdown(DefaultMessageListenerContainer.java:571) ...
Applicable spring configuration file:
\
\
\tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0\
\
\
\
\
\
\
\
\
\
\
\
Affects: 4.3.8
Reference URL: https://issues.apache.org/jira/browse/AMQ-6682
Attachments: