DO NOT REPLY [Bug 40885] - Hung threads with Websphere

[email protected]
Newsgroups gmane.comp.jakarta.slide.devel
Message-ID <[email protected]>
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=40885>.
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=40885





------- Additional Comments From [email protected]  2006-11-08 07:31 -------
The problem described is easy to reproduce when stress testing slide server
(running 20 threads repeatedly putting files kills the server in less than 10
minutes)

Subversion version (from 1 week ago) does not solve the problem.

After some reseach we found the following :

The problem was caused by a thread getting stuck while holding the global write
lock :
"Servlet.Engine.Transports : 0" daemon prio=5 tid=0x01f05c28 nid=0x24 runnable
[deb7e000..deb7fc30]
	at java.util.HashMap.put(HashMap.java:382)
	at org.apache.slide.store.ExtendedStore.end(ExtendedStore.java:1029)
	at
org.apache.slide.transaction.SlideTransaction.delistResource(SlideTransaction.java:377)
	at org.apache.slide.store.AbstractStore.delist(AbstractStore.java:1574)
	at org.apache.slide.store.AbstractStore.delist(AbstractStore.java:1559)
	at org.apache.slide.store.ExtendedStore.retrieveObject(ExtendedStore.java:581)
	at org.apache.slide.structure.StructureImpl.retrieve(StructureImpl.java:178)
	at org.apache.slide.structure.StructureImpl.retrieve(StructureImpl.java:160)
	at
org.apache.slide.webdav.method.AbstractWebdavMethod.run(AbstractWebdavMethod.java:387)
	at org.apache.slide.webdav.WebdavServlet.service(WebdavServlet.java:155)

The thread was stuck because of the map internal state became corrupted (there
was a cycle in a linked list so the put method never exited)

The obvious fix was to replace the collection with a thread safe one.

--- ExtendedStore.java.orig     2004-12-23 13:07:48.000000000 +0100
+++ ExtendedStore.java  2006-11-08 16:23:11.393555000 +0100
@@ -63,6 +63,8 @@
 import org.apache.slide.util.logger.Logger;
 import org.apache.slide.util.logger.TxLogger;

+import java.util.Collections;
+
 /**
  * Store that allows for transactional caching of data. Takes over much
modified code from StandardStore.
  * That's why Remy is listed as author as well.
@@ -145,7 +147,7 @@
     long maxByteSizePerEntry;
     boolean noGlobalCacheInTx;

-    private Map suspendedLocks = new HashMap();
+    private Map suspendedLocks = Collections.synchronizedMap(new HashMap());

     public ExtendedStore() {
         lockManager = new GenericLockManager(1, new TxLogger(getLogger(),
LOG_CHANNEL));

Now we have no more hung threads, but i'm not sure it's the right fix.
What do you think ?


-- 
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.