[jcifs] deadlock during scheduled logoffs

Christensen, Scott M SCHRIST1 at amfam.com
Tue Nov 14 21:30:00 GMT 2006


Hi,

 

We are having a deadlock issue that has to do with the setupDiscoLock in
the transport object.  This is happening in 1.2.9.  I have reviewed the
code in 1.2.10 and this issue will still occur. What appears to be
happening is that at a scheduled time (every 35 seconds by default),
during a getSmbSession() in SmbTransport, SmbTransport attempts to do
some cleanup of existing but expired sessions by calling their logoff
method which locks the SmbTransport object.  It eventually calls the
treeConnect method in SmbTree which attempts to first lock the
setupDiscoLock and then the transport object.  However if another thread
calls the logon method the thread eventually gets to the treeConnect
method and locks the setupDiscoLock.  It is then waiting to lock the
transport object while the first thread has the transport and is waiting
to lock the setupDiscoLock.

 

I guess I'm wondering what is the best way to fix this issue.  I've
thought of a couple of ways and would like to get the ramifications of
each.

 

1.	Reverse the locks in the treeConnect method of SmbTree.  This
would require that the transport be locked before locking the
setupDiscoLock.
2.	Synchronize the logoff call in the "cleanup block" of
SmbTransport.getSmbSession on the transport.
3.	Other better ideas?

 

I admit that the locking mechanisms employed are slightly beyond my
total comprehension, so if I'm way off base, let me know.  I would just
like a way to find a resolution to this issue.  Below is a thread dump
of the deadlock we are seeing.

 

Thanks,

Scott

 

Found one Java-level deadlock:

=============================

"Servlet.Engine.Transports : 49":

  waiting to lock monitor 002ae7c8 (object 45ceabc0, a
java.lang.Object),

  which is held by "Servlet.Engine.Transports : 67"

"Servlet.Engine.Transports : 67":

  waiting to lock monitor 002ae748 (object 45cd7180, a
jcifs.smb.SmbTransport),

  which is held by "Servlet.Engine.Transports : 49"

 

Java stack information for the threads listed above:

===================================================

"Servlet.Engine.Transports : 49":

      at jcifs.smb.SmbTree.treeConnect(SmbTree.java:130)

      - waiting to lock <45ceabc0> (a java.lang.Object)

      at jcifs.smb.SmbTree.send(SmbTree.java:57)

      at jcifs.smb.SmbTree.treeDisconnect(SmbTree.java:179)

      - locked <45cd7180> (a jcifs.smb.SmbTransport)

      at jcifs.smb.SmbSession.logoff(SmbSession.java:311)

      - locked <45cd7180> (a jcifs.smb.SmbTransport)

      at jcifs.smb.SmbTransport.getSmbSession(SmbTransport.java:138)

      - locked <45cd7180> (a jcifs.smb.SmbTransport)

      at jcifs.smb.SmbSession.logon(SmbSession.java:177)

      at jcifs.smb.SmbSession.logon(SmbSession.java:172)

      at
com.myapp.authenticator.DomainController.logon(DomainController.java:70)

      at
com.myapp.authenticator.delegate.NtlmAuthenticationDelegate.processLogin
(NtlmAuthenticationDelegate.java:150)

      at com.myapp.Authenticator.processLogin(Authenticator.java:210)

      at
org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:13
1)

      at com.myapp.SecurityFilter.doFilter(SecurityFilter.java:172)

      at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInst
anceWrapper.java:132)

      at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterCh
ain.java:71)

      at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispa
tch(WebAppRequestDispatcher.java:1009)

      - locked <529511b0> (a
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher)

      at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRe
questDispatcher.java:529)

      - locked <529511b0> (a
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher)

      at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppReq
uestDispatcher.java:208)

      - locked <529511b0> (a
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher)

      at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:1
34)

      at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInv
oker.java:321)

      at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocati
on(CachedInvocation.java:71)

      at
com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invo
ke(CacheableInvocationContext.java:120)

      at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(Servle
tRequestProcessor.java:250)

      at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSELis
tener.java:334)

      at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection
.java:56)

      at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:
652)

      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:458)

      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:936)

"Servlet.Engine.Transports : 67":

      at jcifs.smb.SmbTree.treeConnect(SmbTree.java:132)

      - waiting to lock <45cd7180> (a jcifs.smb.SmbTransport)

      - locked <45ceabc0> (a java.lang.Object)

      at jcifs.smb.SmbSession.logon(SmbSession.java:179)

      at jcifs.smb.SmbSession.logon(SmbSession.java:172)

      at
com.myapp.authenticator.DomainController.logon(DomainController.java:70)

      at
com.myapp.authenticator.delegate.NtlmAuthenticationDelegate.processLogin
(NtlmAuthenticationDelegate.java:150)

      at com.myapp.Authenticator.processLogin(Authenticator.java:210)

      at
org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:13
1)

      at com.myapp.SecurityFilter.doFilter(SecurityFilter.java:172)

      at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInst
anceWrapper.java:132)

      at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterCh
ain.java:71)

      at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispa
tch(WebAppRequestDispatcher.java:1009)

      - locked <5b665c28> (a
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher)

      at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRe
questDispatcher.java:529)

      - locked <5b665c28> (a
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher)

      at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppReq
uestDispatcher.java:208)

      - locked <5b665c28> (a
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher)

      at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:1
34)

      at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInv
oker.java:321)

      at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocati
on(CachedInvocation.java:71)

      at
com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invo
ke(CacheableInvocationContext.java:120)

      at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(Servle
tRequestProcessor.java:250)

      at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSELis
tener.java:334)

      at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection
.java:56)

      at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:
652)

      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:458)

      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:936)

 

Found 1 deadlock.

 

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list