[undertow-dev] InSessionMemoryManager synchronized methods

Eric Peters epeters at epicor.com
Thu Jun 25 19:22:42 EDT 2015


I stand corrected - This is 50% of what brought our server down.

The other half of the deadlock belongs to Seam:


  *   io.undertow.server.session.InMemorySessionManager$SessionImpl.bumpTimeout() (line: 271)
  *   io.undertow.server.session.InMemorySessionManager$SessionImpl.getAttribute(java.lang.String) (line: 355)
  *   io.undertow.servlet.spec.HttpSessionImpl.getAttribute(java.lang.String)
  *   com.sun.faces.context.SessionMap.get(java.lang.Object)
  *   org.jboss.seam.contexts.ServerConversationContext.get(java.lang.String) (line: 110)
  *   org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(java.lang.String) (line: 189)
  *   org.jboss.seam.Component.getInstanceFromFactory(java.lang.String, org.jboss.seam.ScopeType) (line: 2088)
  *   org.jboss.seam.Component.getInstance(java.lang.String, boolean, boolean, java.lang.Object, org.jboss.seam.ScopeType) (line: 2014)
  *   org.jboss.seam.Component.getInstance(java.lang.String, boolean, boolean) (line: 1986)
  *   org.jboss.seam.Component.getInstance(java.lang.String, boolean)
  *   org.jboss.seam.Namespace.getComponentInstance(java.lang.String, boolean)

org.jboss.seam.Component.getInstanceFromFactory() obtains a lock that has static scope, so nothing else can invoke getInstanceFromFacotry() while the lock is held.It then blocks on InMemorySessionManager$SessionImpl.bumpTimeout()
Meanwhile, the invalidate() method blocks against the static method in getInstanceFromFactory()
//EricP




From: undertow-dev-bounces at lists.jboss.org [mailto:undertow-dev-bounces at lists.jboss.org] On Behalf Of Eric Peters
Sent: Thursday, June 25, 2015 4:39 PM
To: undertow-dev at lists.jboss.org
Subject: [undertow-dev] InSessionMemoryManager synchronized methods

Chasing after another problem I found several blocked task threads, best as I can determine:
InMemorySessionmanager$SessionImpl.invalidate() is invoked.
This method is synchronized, and the call blocks inside SesssionListeners.sessionDestroyed() (separate issue there...)

Later, InMemorySessionmanager$SessionImpl.bumpTimeout() is invoked from another thread.
This method is also synchronized, and blocks waiting for invalidate() to complete.  As the first thread is indefinitely blocked inside invalidate(), this second thread also remains blocked indefinitely.

In my environment it appears to make an existing problem slightly more severe.

Found in 1.1.0, but it looks like it's in both 1.1.7 and the master branch as well.
Using RHEL, Java 7, Wildfly 8.2

invalidate() Thread trace (excerpt):

  *   (blocked) - sun.misc.Unsafe.park(boolean, long)
  *   ...
  *   org.jboss.seam.contexts.ServletLifecycle.endSession(javax.servlet.http.HttpSession) (line: 187)
  *   org.jboss.seam.servlet.SeamListener.sessionDestroyed(javax.servlet.http.HttpSessionEvent) (line: 59)
  *   io.undertow.servlet.core.ApplicationListeners.sessionDestroyed(javax.servlet.http.HttpSession) (line: 264)
  *   io.undertow.servlet.core.SessionListenerBridge.sessionDestroyed(io.undertow.server.session.Session, io.undertow.server.HttpServerExchange, io.undertow.server.session.SessionListener$SessionDestroyedReason) (line: 67)
  *   io.undertow.server.session.SessionListeners.sessionDestroyed(io.undertow.server.session.Session, io.undertow.server.HttpServerExchange, io.undertow.server.session.SessionListener$SessionDestroyedReason) (line: 61)
  *   io.undertow.server.session.InMemorySessionManager$SessionImpl.invalidate(io.undertow.server.HttpServerExchange, io.undertow.server.session.SessionListener$SessionDestroyedReason) (line: 413)
  *   io.undertow.server.session.InMemorySessionManager$SessionImpl.invalidate(io.undertow.server.HttpServerExchange) (line: 399)
  *   io.undertow.servlet.spec.HttpSessionImpl.invalidate() (line: 197)
  *   ...

bumpTimeout() Thread trace:

  *   io.undertow.server.session.InMemorySessionManager$SessionImpl.bumpTimeout() (line: 271)
  *   io.undertow.server.session.InMemorySessionManager$SessionImpl.getAttribute(java.lang.String) (line: 355)
  *   io.undertow.servlet.util.SavedRequest.tryRestoreRequest(io.undertow.server.HttpServerExchange, javax.servlet.http.HttpSession) (line: 124)
  *   io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(io.undertow.server.HttpServerExchange) (line: 67)
  *   io.undertow.security.handlers.SecurityInitialHandler.handleRequest(io.undertow.server.HttpServerExchange) (line: 76)
  *   io.undertow.server.handlers.PredicateHandler.handleRequest(io.undertow.server.HttpServerExchange) (line: 43)
  *   org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(io.undertow.server.HttpServerExchange) (line: 61)
  *   io.undertow.server.handlers.PredicateHandler.handleRequest(io.undertow.server.HttpServerExchange) (line: 43)
  *   io.undertow.server.handlers.PredicateHandler.handleRequest(io.undertow.server.HttpServerExchange) (line: 43)
  *   io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(io.undertow.server.HttpServerExchange, io.undertow.servlet.handlers.ServletChain, io.undertow.servlet.handlers.ServletRequestContext, javax.servlet.ServletRequest, javax.servlet.ServletResponse) (line: 261)
  *   io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(io.undertow.server.HttpServerExchange, io.undertow.servlet.handlers.ServletRequestContext, io.undertow.servlet.handlers.ServletChain, javax.servlet.DispatcherType) (line: 247)
  *   io.undertow.servlet.handlers.ServletInitialHandler.access$000(io.undertow.servlet.handlers.ServletInitialHandler, io.undertow.server.HttpServerExchange, io.undertow.servlet.handlers.ServletRequestContext, io.undertow.servlet.handlers.ServletChain, javax.servlet.DispatcherType)
  *   io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(io.undertow.server.HttpServerExchange) (line: 166)
  *   io.undertow.server.Connectors.executeRootHandler(io.undertow.server.HttpHandler, io.undertow.server.HttpServerExchange) (line: 197)
  *   io.undertow.server.HttpServerExchange$1.run() (line: 759)
  *   java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (line: 1145)
  *   java.util.concurrent.ThreadPoolExecutor$Worker.run() (line: 615)
  *   java.lang.Thread.run() (line: 745)
//EricP



This message has been scanned for malware by Websense. www.websense.com<http://www.websense.com/>


Click here<https://www.mailcontrol.com/sr/qFsLDesiAOTGX2PQPOmvUk8LIR8eqmo3fP!Z+Zd24fwdO9XGlCVXypUHpd+quuDmLK9zr65hnE4eRLY+cWrx9g==> to report this email as spam.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150625/988c8e5a/attachment-0001.html 


More information about the undertow-dev mailing list