ConcurrentModificationException in SingleConnectionFactory$AggregatedExceptionListener [SPR-13421] #18000
Labels
in: messaging
Issues in messaging modules (jms, messaging)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Mike Noordermeer opened SPR-13421 and commented
The
SingleConnectionFactory$AggregatedExceptionListener
objects contains a list of delegates in aLinkedHashSet
, protected by theSingleConnectionFactory.connectionMonitor
lock object.If you configure a
SingleConnectionFactory
withreconnectOnException = true
, and use it in aSimpleMessageListenerContainer
, the following will happen on aJMSException
:SingleConnectionFactory$AggregatedExceptionListener.onException()
is called, and starts looping over thedelegates Set
SimpleMessageListenerContainer.onException()
, which callsrefreshSharedConnection()
,createSharedConnection()
,prepareSharedConnection()
,connection.setExceptionListener()
delegates
list (from the same thread, so the locking does not help)ConcurrentModificationException
will be thrown inSingleConnectionFactory$AggregatedExceptionListener.onException()
Full exception message:
The list of delegates should probably be copied before iteration, or the
SimpleMessageListenerContainer
should not re-add itself as listener.Affects: 4.1.7, 4.2.1
Issue Links:
Referenced from: commits f562eb5, 1ed1167
Backported to: 4.1.8
The text was updated successfully, but these errors were encountered: