We're updating the issue view to help you get more done. 

BOSH deadlock

Description

We are observing occasional deadlocks in the BOSH component. It appears that the HTTP session reaper can lock up the request handler if a client sends an explicit "terminate" request while the reaper is running, as follows;

Jetty-QTP-BOSH-179: Name[Jetty-QTP-BOSH-179]Thread ID[179]
Deadlocked on Lock[org.jivesoftware.openfire.http.HttpSession$HttpVirtualConnection@4a8aab85] held by thread [pool-openfire618] Thread ID[1338]
Thread stack [

org.jivesoftware.openfire.net.VirtualConnection.close(VirtualConnection.java:173)
org.jivesoftware.openfire.http.HttpSession.close(HttpSession.java:198)
org.jivesoftware.openfire.http.HttpBindServlet.handleSessionRequest(HttpBindServlet.java:271)
org.jivesoftware.openfire.http.HttpBindServlet.parseDocument(HttpBindServlet.java:176)
org.jivesoftware.openfire.http.HttpBindServlet.doPost(HttpBindServlet.java:145)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547)
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:480)
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:941)
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409)
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
org.eclipse.jetty.server.Server.handle(Server.java:349)
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:919)
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:588)
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51)
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586)
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44)
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
java.lang.Thread.run(Thread.java:662)
]

pool-openfire52151: Name[pool-openfire52151]Thread ID[61997]
Deadlocked on Lock[org.jivesoftware.openfire.http.HttpSession$HttpVirtualConnection@4a8aab85] held by thread [pool-openfire618] Thread ID[1338]
Thread stack [

org.jivesoftware.openfire.net.VirtualConnection.close(VirtualConnection.java:173)
org.jivesoftware.openfire.http.HttpSession.close(HttpSession.java:198)
org.jivesoftware.openfire.http.HttpSessionManager$HttpSessionReaper.run(HttpSessionManager.java:395)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:662)
]

pool-openfire618: Name[pool-openfire618]Thread ID[1338]
Deadlocked on Lock[org.jivesoftware.openfire.http.HttpSession@f2eb74b] held by thread [Jetty-QTP-BOSH-179] Thread ID[179]
Thread stack [

org.jivesoftware.openfire.http.HttpSession.closeSession(HttpSession.java:1003)
org.jivesoftware.openfire.http.HttpSession.access$1(HttpSession.java:1002)
org.jivesoftware.openfire.http.HttpSession$HttpVirtualConnection.closeVirtualConnection(HttpSession.java:1085)
org.jivesoftware.openfire.net.VirtualConnection.close(VirtualConnection.java:179)
org.jivesoftware.openfire.http.HttpSession.close(HttpSession.java:198)
org.jivesoftware.openfire.http.HttpSessionManager$HttpSessionReaper.run(HttpSessionManager.java:395)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:662)
]

Environment

None

Acceptance Test - Entry

None

Activity

Show:
Tom Evans
March 15, 2013, 9:51 PM

Removed extraneous synchronization block in HttpSession.closeSession

Assignee

Tom Evans

Reporter

Tom Evans

Labels

None

Expected Effort

None

Ignite Forum URL

None

Fix versions

Affects versions

Priority

Major
Configure