SourceForge.net
2005-02-18 20:02:08 UTC
Bugs item #1144026, was opened at 2005-02-18 15:02
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1144026&group_id=54559
Category: server
Group: v0.7.6.1
Status: Open
Resolution: None
Priority: 5
Submitted By: pbezi (pbezi)
Assigned to: Nobody/Anonymous (nobody)
Summary: ConcurrentModificationException in TopicDestinationCache
Initial Comment:
SYMPTOMS:
A java.util.ConcurrentModificationException (see below
for the stack trace) is being thrown in the
resolveExpiredMessage(MessageHandle handle) method
of the
org.exolab.jms.messagemgr.TopicDestinationCache class.
FOUND CAUSE:
The exception is thrown because the _consumers
java.util.List object is being accessed in the
multithreaded environment via the iterator in an
unsynchronized block.
The protected _consumers member variable is declared
in the parent class of
org.exolab.jms.messagemgr.TopicDestinationCache -
org.exolab.jms.messagemgr.DestinationCache as follows:
protected List _consumers =
Collections.synchronizedList(new LinkedList());
This does not guarantee a thread safe access to the
_consumers List object via the iterator obtained from
the List.
RESOLUTION:
Modify the source code of the resolveExpiredMessage
(MessageHandle handle) method of the
TopicDestinationCache class to include the iteration
code in the synchronization block, synchronized on the
list object:
synchronized (_consumers) {
// ..... iterate over _consumers
}
EXCEPTION STACK TRACE:
==========================================
java.util.ConcurrentModificationException
at
java.util.LinkedList$ListItr.checkForComodification
(LinkedList.java:548)
at java.util.LinkedList$ListItr.next
(LinkedList.java:484)
at
org.exolab.jms.messagemgr.TopicDestinationCache.resolv
eExpiredMessage(TopicDestinationCache.java:381)
at
org.exolab.jms.messagemgr.DestinationCache.onLeaseExp
ired(DestinationCache.java:398)
at
org.exolab.jms.messagemgr.MessageLeaseHelper.onLease
Expired(MessageLeaseHelper.java:266)
at
org.exolab.jms.lease.BaseLease.notifyLeaseExpired
(BaseLease.java:161)
at org.exolab.jms.lease.LeaseManager.expire
(LeaseManager.java:291)
at org.exolab.jms.lease.LeaseManager.run
(LeaseManager.java:246)
at java.lang.Thread.run(Thread.java:536)
==========================================
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1144026&group_id=54559
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1144026&group_id=54559
Category: server
Group: v0.7.6.1
Status: Open
Resolution: None
Priority: 5
Submitted By: pbezi (pbezi)
Assigned to: Nobody/Anonymous (nobody)
Summary: ConcurrentModificationException in TopicDestinationCache
Initial Comment:
SYMPTOMS:
A java.util.ConcurrentModificationException (see below
for the stack trace) is being thrown in the
resolveExpiredMessage(MessageHandle handle) method
of the
org.exolab.jms.messagemgr.TopicDestinationCache class.
FOUND CAUSE:
The exception is thrown because the _consumers
java.util.List object is being accessed in the
multithreaded environment via the iterator in an
unsynchronized block.
The protected _consumers member variable is declared
in the parent class of
org.exolab.jms.messagemgr.TopicDestinationCache -
org.exolab.jms.messagemgr.DestinationCache as follows:
protected List _consumers =
Collections.synchronizedList(new LinkedList());
This does not guarantee a thread safe access to the
_consumers List object via the iterator obtained from
the List.
RESOLUTION:
Modify the source code of the resolveExpiredMessage
(MessageHandle handle) method of the
TopicDestinationCache class to include the iteration
code in the synchronization block, synchronized on the
list object:
synchronized (_consumers) {
// ..... iterate over _consumers
}
EXCEPTION STACK TRACE:
==========================================
java.util.ConcurrentModificationException
at
java.util.LinkedList$ListItr.checkForComodification
(LinkedList.java:548)
at java.util.LinkedList$ListItr.next
(LinkedList.java:484)
at
org.exolab.jms.messagemgr.TopicDestinationCache.resolv
eExpiredMessage(TopicDestinationCache.java:381)
at
org.exolab.jms.messagemgr.DestinationCache.onLeaseExp
ired(DestinationCache.java:398)
at
org.exolab.jms.messagemgr.MessageLeaseHelper.onLease
Expired(MessageLeaseHelper.java:266)
at
org.exolab.jms.lease.BaseLease.notifyLeaseExpired
(BaseLease.java:161)
at org.exolab.jms.lease.LeaseManager.expire
(LeaseManager.java:291)
at org.exolab.jms.lease.LeaseManager.run
(LeaseManager.java:246)
at java.lang.Thread.run(Thread.java:536)
==========================================
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1144026&group_id=54559