This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 257800

Summary: org.netbeans.modules.deadlock.detector.Detector$DeadlockDetectedException: ConnectionManager queue
Product: cnd Reporter: Exceptions Reporter <exceptions_reporter>
Component: executionAssignee: ilia
Status: RESOLVED INVALID    
Severity: normal CC: apepin, vkvashin
Priority: P3    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 222337
Attachments: stacktrace

Description Exceptions Reporter 2016-02-01 14:28:02 UTC
Build: NetBeans IDE 8.1 (Build 201510222201)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.60-b23, Java(TM) SE Runtime Environment, 1.8.0_60-b27
OS: Linux

User Comments:
GUEST: was trying to disable some modules




Stacktrace: 
org.netbeans.modules.deadlock.detector.Detector$DeadlockDetectedException: ConnectionManager queue
   at com.jcraft.jsch.KnownHosts.getHMACSHA1(KnownHosts.java:486)
   at com.jcraft.jsch.KnownHosts.access$000(KnownHosts.java:35)
   at com.jcraft.jsch.KnownHosts$HashedHostKey.isMatched(KnownHosts.java:540)
   at com.jcraft.jsch.KnownHosts.getHostKey(KnownHosts.java:361)
   at com.jcraft.jsch.Session.checkHost(Session.java:809)
   at com.jcraft.jsch.Session.connect(Session.java:342)
Comment 1 Exceptions Reporter 2016-02-01 14:28:04 UTC
Created attachment 158335 [details]
stacktrace
Comment 2 Vladimir Kvashin 2016-02-01 15:42:55 UTC
This is a classical deadlock inside the jsch:

"SFTP" thread 
- has locked KnownHosts instance
- then tries to lock KnownHosts.pool

"ConnectionManager queue" thread
- has locked KnownHosts.pool
- then tries to lock KnownHosts instance

Below are minimal thread fgarments that illustrate this (note that there are no NB code in these stacks):

"ConnectionManager queue" Id=371 in BLOCKED on lock=com.jcraft.jsch.KnownHosts@24a91105
     owned by SFTP: : Uploading /home/kiss/netbeans-8.1/cnd/bin/Linux-x86_64/rfs_controller to user@11.44.33.55:/var/tmp/dlight_ikiss/6b88f630/tools/Linux-x86_64/rfs_controller Id=388
    at com.jcraft.jsch.KnownHosts.getHMACSHA1(KnownHosts.java:486)
    at com.jcraft.jsch.KnownHosts.access$000(KnownHosts.java:35)
    at com.jcraft.jsch.KnownHosts$HashedHostKey.isMatched(KnownHosts.java:540)
    at com.jcraft.jsch.KnownHosts.getHostKey(KnownHosts.java:361)
      - locked java.util.Vector@79ee48d
    at com.jcraft.jsch.Session.checkHost(Session.java:809)
    at com.jcraft.jsch.Session.connect(Session.java:342)

"SFTP: : Uploading /home/kiss/netbeans-8.1/cnd/bin/Linux-x86_64/rfs_controller to user@11.44.33.55:/var/tmp/dlight_ikiss/6b88f630/tools/Linux-x86_64/rfs_controller" Id=388 in BLOCKED on lock=java.util.Vector@79ee48d
     owned by ConnectionManager queue Id=371
    at com.jcraft.jsch.KnownHosts.check(KnownHosts.java:263)
    at com.jcraft.jsch.Session.checkHost(Session.java:732)
      - locked com.jcraft.jsch.KnownHosts@24a91105
    at com.jcraft.jsch.Session.connect(Session.java:342)
Comment 3 Vladimir Kvashin 2016-02-01 15:50:47 UTC
This can probably be solved on NetBeans side, but I'm not sure. One possible way solving the issue or of at least minimizing its probability could be: somehow suppress automatic connecting (which takes place if someone launched a process or a sftp upload/download, etc). That's just an idea, I'm not sure whether it will fly. 

This can also make stability lower for connections that tend to break from time to time (so that going via key or with saved password improves the situation).
Comment 4 Vladimir Kvashin 2016-02-10 08:43:50 UTC
I wrote a mail to jsch-users in this respect, see the link below.

http://sourceforge.net/p/jsch/mailman/jsch-users/thread/56BAF700.20601%40oracle.com/#msg34837989
Comment 5 Vladimir Kvashin 2016-02-12 14:28:35 UTC
I've even got an answer with a patch:
https://sourceforge.net/p/jsch/mailman/jsch-users/thread/56BC7AFE.50400%40kimmeringer.de/#msg34841444
But unfortunately not from jsch authors, but from other user, who says, they never responded for the requests to contribute and pathces
:(

Is it time to use a custom version as we did with antlr a while ago?
License allows that...
Comment 6 Vladimir Kvashin 2016-03-24 17:49:29 UTC
I filed a bug against jsch
https://sourceforge.net/p/jsch/bugs/101
although I'm not sure anyone will react...
Comment 7 Vladimir Kvashin 2016-04-07 11:46:49 UTC
*** Bug 258359 has been marked as a duplicate of this bug. ***
Comment 8 ilia 2016-12-08 08:54:32 UTC
Vladimir,

seems that this bug was fixed in the latest version:

ChangeLog of JSch
====================================================================
Last modified: Tue Aug 30 06:47:52 UTC 2016


Changes since version 0.1.53:
...
- bugfix: fixed a deadlock bug in KnownHosts#getHostKey().
...
Comment 9 ilia 2016-12-08 08:57:13 UTC
Although it's too risky to upgrade our jsch dependency while in the patch process, I suggest to make this change in trunk.
Comment 10 ilia 2016-12-08 12:49:13 UTC
Well, suddenly we already use 0.1.54 :-)

So this problem shouldn't occur anymore.