DO NOT REPLY [Bug 41838] New: - HashMap infinite loop
[email protected] Wed, 14 Mar 2007 07:40:56 -0700 (PDT)
| Newsgroups | gmane.comp.jakarta.slide.devel |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41838>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=41838
Summary: HashMap infinite loop
Product: Slide
Version: 2.1
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: Transaction Manager
AssignedTo: [email protected]
ReportedBy: [email protected]
When many concurrent threads try to connect to slide using the same user
account, an infinite loop may occur in HashMap.put or HashMap.transfer methods.
Stack trace of some threads inside JConsole :
Name: http-8095-Processor36
State: RUNNABLE
Total blocked: 142 Total waited: 14
Stack trace:
java.util.HashMap.put(HashMap.java:385)
org.apache.slide.store.ExtendedStore.end(ExtendedStore.java:1029)
org.apache.slide.transaction.SlideTransaction.delistResource(SlideTransaction.java:377)
org.apache.slide.store.AbstractStore.delist(AbstractStore.java:1574)
org.apache.slide.store.AbstractStore.delist(AbstractStore.java:1559)
org.apache.slide.store.ExtendedStore.retrieveObject(ExtendedStore.java:581)
org.apache.slide.structure.StructureImpl.retrieve(StructureImpl.java:178)
org.apache.slide.structure.StructureImpl.retrieve(StructureImpl.java:160)
org.apache.slide.webdav.method.AbstractWebdavMethod.run(AbstractWebdavMethod.java:387)
org.apache.slide.webdav.WebdavServlet.service(WebdavServlet.java:155)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
Name: http-8095-Processor46
State: RUNNABLE
Total blocked: 44 Total waited: 12
Stack trace:
java.util.HashMap.transfer(HashMap.java:476)
java.util.HashMap.resize(HashMap.java:455)
java.util.HashMap.addEntry(HashMap.java:745)
java.util.HashMap.put(HashMap.java:395)
org.apache.slide.store.ExtendedStore.end(ExtendedStore.java:1029)
The ExtendedStore.java, line 1029 :
suspendedLocks.put(txId, locks.get());
Many threads use the same ExtendedStore instance, so the same suspendedLocks
instance.
suspendedLocks is not a synchronized Map.
The following link
http://blogs.opensymphony.com/plightbo/2005/07/hashmapget_can_cause_an_infini.html
explains clearly the behaviour of "non synchronized Map updated by concurrent
threads".
The patch is :
private Map suspendedLocks = Collections.synchronizedMap(new HashMap());
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.