DO NOT REPLY [Bug 35201] New: - Thread safety problem in AbstractXAResource

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

DO NOT REPLY [Bug 35201] New: - Thread safety problem in AbstractXAResource

Bugzilla from bugzilla@apache.org
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=35201>.
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=35201

           Summary: Thread safety problem in AbstractXAResource
           Product: Commons
           Version: 1.1 Final
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Transaction
        AssignedTo: [hidden email]
        ReportedBy: [hidden email]


An org.apache.commons.transaction.util.xa.AbstractXAResource can be shared by
many  threads, but the activeContexts and suspendedContexts members are both
HashMaps which are not thread safe.

Through slide, I have been able to consistently "lose" transactions when I hit
our server with a large multi-threaded load.

A common failure looks like the following trace, although I've seen several
other manifestations depending on how the concurrent update to one of the
HashMaps failed.

javax.transaction.xa.XAException
        at
org.apache.commons.transaction.util.xa.AbstractXAResource.end(AbstractXAResource.java:143)
        at
org.apache.slide.transaction.SlideTransaction.delistResource(SlideTransaction.java:388)
        at org.apache.slide.store.AbstractStore.delist(AbstractStore.java:1779)
        at org.apache.slide.store.AbstractStore.delist(AbstractStore.java:1764)
        at org.apache.slide.store.AbstractStore.retrieveObject(AbstractStore.java:696)
        at org.apache.slide.store.ExtendedStore.retrieveObject(ExtendedStore.java:603)
        at org.apache.slide.structure.StructureImpl.retrieve(StructureImpl.java:184)
        at org.apache.slide.structure.StructureImpl.retrieve(StructureImpl.java:166)
        at
org.apache.slide.webdav.method.AbstractWebdavMethod.executeRedirect(AbstractWebdavMethod.java:509)
        at
org.apache.slide.webdav.method.AbstractWebdavMethod.run(AbstractWebdavMethod.java:419)
        at org.apache.slide.webdav.WebdavServlet.service(WebdavServlet.java:151)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
        at
org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:762)
        at
com.ris.manager.gateway.http.IPAddressRestriction.doFilter(IPAddressRestriction.java:248)
        at
org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:753)
        at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:494)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
        at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:624)
        at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)
        at org.mortbay.http.HttpServer.service(HttpServer.java:896)
        at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
        at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
        at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
        at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
        at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)
        at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
03 Jun 2005 08:11:48 - org.apache.slide.transaction.SlideTransaction - WARNING -
Delist failure: Resource manager
org.apache.slide.simple.store.WebdavStoreAdapter@4e67b86d Error code XAER_NOTA
in Transaction 2 xid SocketListener3-2-1117800705909-2- in thread SocketListener3-2

The simplest fix is to wrap the two HashMaps in a
"Collections.synchronizedMap()". This shouldn't significantly impact performance.

Patch to follow.

--
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.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]