deadlock between BasicAlarm and JettyContinuationSleeper

Description

Output from jstack:
===================================================
"Timer-3":
"Timer-3":
waiting to lock monitor 0x00002aab14327f50 (object 0x00002aaab5ed79e8, a java.lang.Object),
which is held by "qtp0-535"
"qtp0-535":
waiting to lock monitor 0x00002aab1499d3e8 (object 0x00002aaab5ed7b48, a java.lang.Object),
which is held by "Timer-3"

Java stack information for the threads listed above:
===================================================
"Timer-3":
at org.directwebremoting.dwrp.JettyContinuationSleeper.wakeUp(JettyContinuationSleeper.java:109)

  • waiting to lock <0x00002aaab5ed79e8> (a java.lang.Object)
    at org.directwebremoting.dwrp.BasicAlarm.raiseAlarm(BasicAlarm.java:33)

  • locked <0x00002aaab5ed7b48> (a java.lang.Object)
    at org.directwebremoting.dwrp.TimedAlarm$1.run(TimedAlarm.java:75)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)
    "qtp0-535":
    at org.directwebremoting.dwrp.BasicAlarm.cancel(BasicAlarm.java:43)

  • waiting to lock <0x00002aaab5ed7b48> (a java.lang.Object)
    at org.directwebremoting.dwrp.TimedAlarm.cancel(TimedAlarm.java:48)
    at org.directwebremoting.dwrp.PollHandler$1.run(PollHandler.java:189)
    at org.directwebremoting.dwrp.JettyContinuationSleeper.goToSleep(JettyContinuationSleeper.java:80)

  • locked <0x00002aaab5ed79e8> (a java.lang.Object)
    at org.directwebremoting.dwrp.PollHandler.handle(PollHandler.java:211)
    at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
    at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:757)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:416)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:840)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:657)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:377)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:497)

Activity

Show:
Tim Williamson
September 5, 2008, 7:19 PM

Looks like the simplest fix is to make the sleeper member variable volatile instead of using a sleeperLock. (see attached patch)

Joe Walker
November 18, 2008, 4:32 PM

Assignee

Joe Walker

Reporter

Tim Williamson

Labels

None

Documentation Required

None

Fix versions

Affects versions

Priority

Major
Configure