Re: Deadlock in SSLSocket locks Finalizer
xuelei@oracle.com writes: > Does it happen in JDK 6 and previous releases? In JDK 6 and previous > release, Oracle JSSE provider in server side may check the usability of > ciphers and then generate dummy sockets. JDK 7 changed the behaviors. We didn't see this happens with JDK 6. Also it seems like the problem doesn't arise in 1.7.0_25. > BTW, I experienced a few cases that application may cleanup SSLSocket in > a fixed period no matter the status of the sockets, as may also kick off > SSLSocket finalizer. Could you please elaborate on this? Are there any bugs reports? What is "application" your case? BTW, our current workaround is to set SO_LINGER socket option to 0, so Finalizer doesn't hang. -- Dmitry Neverov JetBrains http://www.jetbrains.com "Develop with pleasure!"
Re: Deadlock in SSLSocket locks Finalizer
> On Sep 26, 2013, at 2:58 AM, Dmitry Neverov > wrote: > > xuelei@oracle.com writes: > >> Does it happen in JDK 6 and previous releases? In JDK 6 and previous >> release, Oracle JSSE provider in server side may check the usability of >> ciphers and then generate dummy sockets. JDK 7 changed the behaviors. > > We didn't see this happens with JDK 6. Also it seems like the problem > doesn't arise in 1.7.0_25. > >> BTW, I experienced a few cases that application may cleanup SSLSocket in >> a fixed period no matter the status of the sockets, as may also kick off >> SSLSocket finalizer. > > Could you please elaborate on this? Are there any bugs reports? What is > "application" your case? > I cannot remember the application name. It is not a bug in JDK, it a special design of the application. > BTW, our current workaround is to set SO_LINGER socket option to 0, so > Finalizer doesn't hang. > Cool. Btw, the deadlock fix should be available in next JDK update. You can have a try with the latest nightly build of OpenJDK 7 update and 8. Xuelei > -- > Dmitry Neverov > JetBrains > http://www.jetbrains.com > "Develop with pleasure!"
Re: Deadlock in SSLSocket locks Finalizer
Does it happen in JDK 6 and previous releases? In JDK 6 and previous release, Oracle JSSE provider in server side may check the usability of ciphers and then generate dummy sockets. JDK 7 changed the behaviors. BTW, I experienced a few cases that application may cleanup SSLSocket in a fixed period no matter the status of the sockets, as may also kick off SSLSocket finalizer. Xuelei On 9/20/2013 6:22 PM, Dmitry Neverov wrote: > Hi, > > we have a strange problem with ssl sockets. I didn't find anything > similar in the bug tracker. I've posted a bug twice, but have never got > back. Maybe someone can help. > > We see an example of the deadlock described in > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8013809. The strange > thing is that one of the locked threads is a Finalizer and the other one > is an application thread. It seems like the socket used by an > application is being finalized: > > > "Finalizer" daemon group="system" prio=8 tid=3 nid=3 waiting on > java.util.concurrent.locks.ReentrantLock$NonfairSync@188a1f7 >by "TC: 17:37:45 getCurrentState: "CMLS Root" {instance id=321, parent > internal id=321, parent id=CMLS_Root, description: > "https://gitblit.cid-dev.net/gitblit-0.9.2/git/CMLS/CMLS.Classifiers.NaiveBayes.git#master-2"}; > 17:37:45 Loading VCS changes for "CMLS Root" {instance id=321, parent > internal id=321, parent id=CMLS_Root, description: > "https://gitblit.cid-dev.net/gitblit-0.9.2/git/CMLS/CMLS.Classifiers.NaiveBayes.git#master-2"}; > VCS Periodical executor 6" >java.lang.Thread.State: WAITING > at sun.misc.Unsafe.park(Native Method) > at java.util.concurrent.locks.LockSupport.park(Unknown Source) > at > java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown > Source) > at > java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown > Source) > at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown > Source) > at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown > Source) > at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source) > at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source) > at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source) > at sun.security.ssl.SSLSocketImpl.sendAlert(Unknown Source) > at sun.security.ssl.SSLSocketImpl.warning(Unknown Source) > at sun.security.ssl.SSLSocketImpl.closeInternal(Unknown Source) > at sun.security.ssl.SSLSocketImpl.close(Unknown Source) > at sun.security.ssl.BaseSSLSocketImpl.finalize(Unknown Source) > at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method) > at java.lang.ref.Finalizer.runFinalizer(Unknown Source) > at java.lang.ref.Finalizer.access$100(Unknown Source) > at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source) > > > "TC: 17:37:45 getCurrentState: "CMLS Root" {instance id=321, parent internal > id=321, parent id=CMLS_Root, description: > "https://gitblit.cid-dev.net/gitblit-0.9.2/git/CMLS/CMLS.Classifiers.NaiveBayes.git#master-2"}; > 17:37:45 Loading VCS changes for "CMLS Root" {instance id=321, parent > internal id=321, parent id=CMLS_Root, description: > "https://gitblit.cid-dev.net/gitblit-0.9.2/git/CMLS/CMLS.Classifiers.NaiveBayes.git#master-2"}; > VCS Periodical executor 6" group="main" prio=5 tid=104 nid=104 blocked on > sun.security.ssl.SSLSocketImpl@eb5db2 >by "Finalizer" >java.lang.Thread.State: BLOCKED > at sun.security.ssl.SSLSocketImpl.getConnectionState(Unknown Source) > at sun.security.ssl.SSLSocketImpl.isClosed(Unknown Source) > at java.net.Socket.getTcpNoDelay(Unknown Source) > at sun.security.ssl.BaseSSLSocketImpl.getTcpNoDelay(Unknown Source) > at sun.security.ssl.SSLSocketImpl.writeRecordInternal(Unknown Source) > at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source) > at sun.security.ssl.AppOutputStream.write(Unknown Source) > at java.io.BufferedOutputStream.flushBuffer(Unknown Source) > at java.io.BufferedOutputStream.flush(Unknown Source) > at java.io.PrintStream.flush(Unknown Source) > at sun.net.www.MessageHeader.print(Unknown Source) > at sun.net.www.http.HttpClient.writeRequests(Unknown Source) > at sun.net.www.http.HttpClient.writeRequests(Unknown Source) > at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown > Source) > at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown > Source) > at java.net.HttpURLConnection.getResponseCode(Unknown Source) > at > sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown > Source) > at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:167) > at > org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:459) > at > org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:305) > at > jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.g
Deadlock in SSLSocket locks Finalizer
Hi, we have a strange problem with ssl sockets. I didn't find anything similar in the bug tracker. I've posted a bug twice, but have never got back. Maybe someone can help. We see an example of the deadlock described in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8013809. The strange thing is that one of the locked threads is a Finalizer and the other one is an application thread. It seems like the socket used by an application is being finalized: "Finalizer" daemon group="system" prio=8 tid=3 nid=3 waiting on java.util.concurrent.locks.ReentrantLock$NonfairSync@188a1f7 by "TC: 17:37:45 getCurrentState: "CMLS Root" {instance id=321, parent internal id=321, parent id=CMLS_Root, description: "https://gitblit.cid-dev.net/gitblit-0.9.2/git/CMLS/CMLS.Classifiers.NaiveBayes.git#master-2"}; 17:37:45 Loading VCS changes for "CMLS Root" {instance id=321, parent internal id=321, parent id=CMLS_Root, description: "https://gitblit.cid-dev.net/gitblit-0.9.2/git/CMLS/CMLS.Classifiers.NaiveBayes.git#master-2"}; VCS Periodical executor 6" java.lang.Thread.State: WAITING at sun.misc.Unsafe.park(Native Method) at java.util.concurrent.locks.LockSupport.park(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(Unknown Source) at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(Unknown Source) at java.util.concurrent.locks.ReentrantLock.lock(Unknown Source) at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.sendAlert(Unknown Source) at sun.security.ssl.SSLSocketImpl.warning(Unknown Source) at sun.security.ssl.SSLSocketImpl.closeInternal(Unknown Source) at sun.security.ssl.SSLSocketImpl.close(Unknown Source) at sun.security.ssl.BaseSSLSocketImpl.finalize(Unknown Source) at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method) at java.lang.ref.Finalizer.runFinalizer(Unknown Source) at java.lang.ref.Finalizer.access$100(Unknown Source) at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source) "TC: 17:37:45 getCurrentState: "CMLS Root" {instance id=321, parent internal id=321, parent id=CMLS_Root, description: "https://gitblit.cid-dev.net/gitblit-0.9.2/git/CMLS/CMLS.Classifiers.NaiveBayes.git#master-2"}; 17:37:45 Loading VCS changes for "CMLS Root" {instance id=321, parent internal id=321, parent id=CMLS_Root, description: "https://gitblit.cid-dev.net/gitblit-0.9.2/git/CMLS/CMLS.Classifiers.NaiveBayes.git#master-2"}; VCS Periodical executor 6" group="main" prio=5 tid=104 nid=104 blocked on sun.security.ssl.SSLSocketImpl@eb5db2 by "Finalizer" java.lang.Thread.State: BLOCKED at sun.security.ssl.SSLSocketImpl.getConnectionState(Unknown Source) at sun.security.ssl.SSLSocketImpl.isClosed(Unknown Source) at java.net.Socket.getTcpNoDelay(Unknown Source) at sun.security.ssl.BaseSSLSocketImpl.getTcpNoDelay(Unknown Source) at sun.security.ssl.SSLSocketImpl.writeRecordInternal(Unknown Source) at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source) at sun.security.ssl.AppOutputStream.write(Unknown Source) at java.io.BufferedOutputStream.flushBuffer(Unknown Source) at java.io.BufferedOutputStream.flush(Unknown Source) at java.io.PrintStream.flush(Unknown Source) at sun.net.www.MessageHeader.print(Unknown Source) at sun.net.www.http.HttpClient.writeRequests(Unknown Source) at sun.net.www.http.HttpClient.writeRequests(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source) at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:167) at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:459) at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:305) at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getRemoteRefs(GitVcsSupport.java:472) at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getRemoteRefs(GitVcsSupport.java:454) at jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport.getCurrentState(GitVcsSupport.java:125) at jetbrains.buildServer.buildTriggers.vcs.git.GitCollectChangesPolicy.getCurrentState(GitCollectChangesPolicy.java:176) at jetbrains.vcs.api.services.impl.RepositoryStateServiceProvider$1.getCurrentState(RepositoryStateServiceProvider.java:9) at jetbrains.buildServer.vcs.impl.VcsRootInstanceImpl.getCurrentState(VcsRootInstanceImpl.java:117) a