Community
Participate
Working Groups
Created attachment 277458 [details] Stacktrace for the hanging JGit process When attempting to fetch from a GitHub repo via jgit.sh version 5.2.1.201812262042-r using a GIT_SSH set to plink.exe, jgit seems to hang for a very long time before completing. This seems very similar to this bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=529463 The workaround of commenting out the code from that bug works for me as well. Although that bug is marked as fixed, the fix implemented is different than what works for me. Here is a snippet of the stacktrace during the hang (see attached for full trace): "main" #1 prio=5 os_prio=0 cpu=484.38ms elapsed=59.32s tid=0x0000029c44d56800 nid=0x4154 in Object.wait() [0x000000ea127fe000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.2/Native Method) - waiting on <0x0000000089d128a8> (a org.eclipse.jgit.util.io.StreamCopyThread) at java.lang.Thread.join(java.base@11.0.2/Thread.java:1313) - waiting to re-lock in wait() <0x0000000089d128a8> (a org.eclipse.jgit.util.io.StreamCopyThread) at org.eclipse.jgit.util.io.StreamCopyThread.halt(StreamCopyThread.java:94) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.close(TransportGitSsh.java:319) at org.eclipse.jgit.transport.FetchProcess.closeConnection(FetchProcess.java:277) at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:195) at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:124) at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1271) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:243) at org.eclipse.jgit.pgm.Fetch.run(Fetch.java:165) at org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:264) at org.eclipse.jgit.pgm.Main.execute(Main.java:278) at org.eclipse.jgit.pgm.Main.run(Main.java:166) at org.eclipse.jgit.pgm.Main.main(Main.java:138) Originally, this bug was discovered via Eclipse Git functions hanging and working backwards until it was discovered that JGit was likely the cause.
The basic problem is still that StreamCopyThread tries to stop reading from the error stream by interrupting the reading thread. That just doesn't work. Possibly explicitly closing the streams before destroying the process might help. Something like if (process != null) { try { process.getErrorStream().close(); } catch (IOException e) { // Ignore } process.destroy(); } This assumes that the read() inside StreamCopyThread would then return with -1.