DefaultMessageListenerContainer#doShutdown hangs [SPR-11841] #16460
We have the situation that the method DefaultMessageListenerContainer#doShutdown hangs which is caused by the call “this.lifecycleMonitor.wait()”. I know that the problem is similar to other once in Jira but my question is the following.
It seems there can be a situation where the “lifecycleMonitor.notifyAll()” is called before “this.lifecycleMonitor.wait()” in DefaultMessageListenerContainer#doShutdown is invoked. In that case, the wait will never return. This is what I think I have observed. Wouldn’t it be better to secure the lifecycleMonitor.wait()by a flag which signalizes if the “wait” has to be called or not. The flag can be set together with the call of notifyAll. So is it guaranteed that in all circumstances the “lifecycleMonitor.notifyAll()” is noticed during the shutdown.
We are using 3.1.1.RELEASE but I the saw the same implementation of DefaultMessageListenerContainer#doShutdown in 4.0.2.RELEASE.
Referenced from: commits d398bb7
2 votes, 6 watchers
Igor E. Poteryaev commented
We have the same situation on shutdown of grails webapp (spring-jms 4.0.6). It happens about 5-10 times per month on our jenkins build server.
Juergen Hoeller commented
Since we're always setting the
In any case, it doesn't hurt to specify a timeout for the
If there's anything more we can do, please raise a concrete suggestion...