Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operations (fetch, push, etc) never complete, no error #68

Open
castortech opened this issue Dec 15, 2024 · 12 comments
Open

Operations (fetch, push, etc) never complete, no error #68

castortech opened this issue Dec 15, 2024 · 12 comments
Labels
not egit Issue unrelated to EGit

Comments

@castortech
Copy link

Version

7.1.0.202411261347-r

Operating System

Windows

Eclipse version

2024-12 (same with 2024-09)

Bug description

After moving to new laptop, Git operations like fetch, push that have to go over the network never complete (waited 30 minutes) and never report any error.

On the 2024-09 installation, I tried deleting the secure storage and got no changes.

Since there are no errors, I don't know where to start. I need to say that my GitBash works just fine and this is what I've been using for the last few weeks, but not the most convenient for most operations.

Actual behavior

No errors or stack trace

Expected behavior

Operation completes normally or at the very least reports an error

Relevant log output

None as stated

Other information

No response

@castortech castortech added the bug Something isn't working label Dec 15, 2024
@Bananeweizen
Copy link
Contributor

check preferences>team>git>timeout. the default is 30 seconds for me, but I guess you have the same. besides that, we can only continue to investigate if provide us a stack dump: https://www.baeldung.com/java-thread-dump (the jstack option is the most simple one). that would show us where the code "hangs" when nothing happens anymore.

@castortech
Copy link
Author

Here you go, I do have the 30 seconds timeout setting. This is over 30 minutes hanging there.

eclipse-git.txt

@Bananeweizen
Copy link
Contributor

Looks like we need a jgit specialist here, maybe @tomaswolf . It is still fetching, and the TimeoutStream doesn't timeout, as it seems (lines 1359ff.):

"Worker-733: Fetch from iriscommon - origin" #24108 [513376] prio=5 os_prio=0 cpu=11265.62ms elapsed=12339.82s tid=0x00000229fc684270 nid=513376 runnable  [0x000000ca0ec1e000]
   java.lang.Thread.State: RUNNABLE
        at java.io.FileInputStream.readBytes([email protected]/Native Method)
        at java.io.FileInputStream.read([email protected]/FileInputStream.java:287)
        at java.io.BufferedInputStream.fill([email protected]/BufferedInputStream.java:291)
        at java.io.BufferedInputStream.read1([email protected]/BufferedInputStream.java:347)
        at java.io.BufferedInputStream.implRead([email protected]/BufferedInputStream.java:420)
        at java.io.BufferedInputStream.read([email protected]/BufferedInputStream.java:399)
        at java.io.FilterInputStream.read([email protected]/FilterInputStream.java:119)
        at org.eclipse.jgit.util.io.TimeoutInputStream.read(TimeoutInputStream.java:87)
        at java.io.InputStream.readNBytes([email protected]/InputStream.java:509)
        at org.eclipse.jgit.util.IO.readFully(IO.java:142)
        at org.eclipse.jgit.transport.PacketLineIn.readLength(PacketLineIn.java:305)
        at org.eclipse.jgit.transport.PacketLineIn.readString(PacketLineIn.java:169)
        at org.eclipse.jgit.transport.BasePackConnection.readLine(BasePackConnection.java:197)
        at org.eclipse.jgit.transport.BasePackConnection.readAdvertisedRefsImpl(BasePackConnection.java:218)
        at org.eclipse.jgit.transport.BasePackConnection.readAdvertisedRefs(BasePackConnection.java:186)
        at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:322)
        at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:152)
        at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:153)
        at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:105)
        at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1458)
        at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:238)
        at org.eclipse.egit.core.op.FetchOperation.run(FetchOperation.java:134)
        at org.eclipse.egit.ui.internal.fetch.FetchOperationUI.execute(FetchOperationUI.java:111)
        at org.eclipse.egit.ui.internal.fetch.FetchOperationUI$1.performJob(FetchOperationUI.java:137)
        at org.eclipse.egit.ui.internal.jobs.RepositoryJob.run(RepositoryJob.java:59)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

@tomaswolf
Copy link
Contributor

There is also

"Worker-733: Fetch from iriscommon - origin-StreamCopy" #26883 [554528] prio=5 os_prio=0 cpu=15.62ms elapsed=3226.41s tid=0x00000229fd74b990 nid=554528 runnable  [0x000000ca0d41f000]
   java.lang.Thread.State: RUNNABLE
        at java.io.FileInputStream.readBytes([email protected]/Native Method)
        at java.io.FileInputStream.read([email protected]/FileInputStream.java:263)
        at org.eclipse.jgit.util.io.StreamCopyThread.run(StreamCopyThread.java:93)

"Worker-733: Fetch from iriscommon - origin-Timer" #26884 [89600] daemon prio=5 os_prio=0 cpu=125.00ms elapsed=3226.40s tid=0x00000229fd74b300 nid=89600 in Object.wait()  [0x000000ca0ee1f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait0([email protected]/Native Method)
        - waiting on <no object reference available>
        at java.lang.Object.wait([email protected]/Object.java:366)
        at org.eclipse.jgit.util.io.InterruptTimer$AlarmState.run(InterruptTimer.java:175)
        - locked <0x000004001fa6d490> (a org.eclipse.jgit.util.io.InterruptTimer$AlarmState)
        at java.lang.Thread.runWith([email protected]/Thread.java:1596)
        at java.lang.Thread.run([email protected]/Thread.java:1583)

If you look at the code in InterruptTimer at https://github.com/eclipse-jgit/jgit/blob/2ec1dc20ec7/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java#L162-L181 , you'll see that apparently deadline is <= 0, in which case the thread will never interrupt the reading thread. Evidently this means that the code did go through the delay <= 0 case before. The interrupt was done, but it did not interrupt the reading thread.

The javadoc on InputStream.readNBytes() points out that the behavior when the reading thread is interrupted is unspecified.

@castortech : A completely different question is why the read just hangs. I see that you are using SSH to fetch. Are you using an external SSH (environment variable GIT_SSH set)? Look at Help->About Eclipse, "Installation Details", "Configuration" tab. What is the value of environment variable GIT_SSH?

Could there be any firewalls that affect the connection?

You wrote this occurred on a new laptop. Do you still have your old laptop? If you install Eclipse 2024-12 on the old one, does fetching via SSH from that repository work?

@tomaswolf
Copy link
Contributor

That the hang is in FileInputStream makes me think that GIT_SSH is set. It's the only way I see to get that particular stack trace. If the Java SSH library were used, I'd expect to see the ChannelPipedInputStreamclass from Apache MINA sshd to appear in the stack.

@castortech
Copy link
Author

It is set indeed, both on the old and the new: GIT_SSH=C:\Windows\System32\OpenSSH\ssh.exe

The old one, I did a fetch and no issue at all. Note that this is with 24-09, but on the new I had the issue on 24-09 and then updated to make sure that I reported on the current version if it persisted.

There are no firewall. Both laptops are on the same network, and the new laptop works fine with Git Bash.

Thanks

@tomaswolf
Copy link
Contributor

So there are several things to examine:

  • Version of the MS Windows OpenSSH. Are they different? If so, maybe that gives a hint. The source code is available on GitHub, you could check the version history and reported issues there to see if there's something that might explain this.
  • SSH config (normally in your home directory, in the .ssh folder).
  • Check in Eclipse under Preferences->General->Network Connections->SSH2 that the "SSH2 home" is set to the same .ssh directory.
  • What is the home directory as seen by JGit? See https://github.com/eclipse-jgit/jgit/blob/2ec1dc20/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java#L166-L186 for the environment variables to check. (The super call used as fallback uses the Java "user.home" property.)

@tomaswolf
Copy link
Contributor

Note that the fetch is hanging at very beginning. It did open the SSH channel and is waiting to read the very first line from the upstream git server. But somehow nothing is coming in, plus the timeout interrupt doesn't appear to be working. But the timeout not working is a secondary problem; your real problem is that no data is being received in the first place from that ssh.exe.

If you can, also try to check which SSH executable command-line git in git bash is using. git bash comes with its own stock OpenSSH; perhaps it's using that.

@castortech
Copy link
Author

Version of the MS Windows OpenSSH. Are they different?
Not different, both are: OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2

SSH config (normally in your home directory, in the .ssh folder).
Both are the same (.ssh content is identical, even same byte count)

Check in Eclipse under Preferences->General->Network Connections->SSH2 that the "SSH2 home" is set to the same .ssh directory.
Confirmed

What is the home directory as seen by JGit? See https://github.com/eclipse-jgit/jgit/blob/2ec1dc20/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java#L166-L186 for the environment variables to check. (The super call used as fallback uses the Java "user.home" property.)
Same on both:
HOMEDRIVE=C:
HOMEPATH=\Users\picar

As mentioned the SSH executable for GitBash is different. If I switch to it, the it fails fast with:
Caused by: org.eclipse.jgit.errors.NoRemoteRepositoryException: ssh://[email protected]/home/git/iriscommon.git: [email protected]..com: Permission denied (publickey).

@tomaswolf
Copy link
Contributor

So, git bash with the SSH executable provided in git bash works, but Eclipse with the MS Window OpenSSH port hangs.

Try running that SSH directly in a terminal. I wonder if it's something crazy such as https://bugs.eclipse.org/bugs/show_bug.cgi?id=515354 . (I.e., that it asks for some interactive confirmation the first time it's being run.)

Try

C:\Windows\System32\OpenSSH\ssh.exe [email protected] git-upload-pack /home/git/iriscommon.git

Do you have the host key in your known_hosts file? (Probably, if all files under .ssh are identical.)

@castortech
Copy link
Author

Trying in terminal:

C:\Windows\System32\OpenSSH\ssh.exe [email protected] git-upload-pack /home/git/iriscommo
n.git
Enter passphrase for key 'C:\Users\picar/.ssh/id_rsa':
01050074b7f69a5b0749e71ad129659e3b9125049262 HEAD1c1a2f45ab refs/tags/ba-3.0.0.1
0045b4b997c97df323e107f24afc72090258347bda86 refs/tags/ba-3.0.0.1^{}
0043482fcccced4fc4657cb74814669cc33f5ba2c290 refs/tags/ba-3.0.0.10
004686e3811a7c280b171050ac0b02ab7f912555c8f1 refs/tags/ba-3.0.0.10^{}

and looking at the mentioned issue, if I run it, I again get asked for the passphrase:

bash --login -c which git
Enter passphrase for /c/Users/picar/.ssh/id_rsa:
Identity added: /c/Users/picar/.ssh/id_rsa ([email protected])

I am starting to think that it's related to the need to enter a passphrase. And maybe the old version had it "stored" somewhere.

@tomaswolf
Copy link
Contributor

bash is probably asking you because your .profile or .bash_profile adds your key to the SSH agent, after which SSH will use the key from the agent and not ask for the passphrase again.

This is definitely the root cause of the hang. I don't know if anything can be done about the interrupt not interrupting the read.

@tomaswolf tomaswolf added not egit Issue unrelated to EGit and removed bug Something isn't working labels Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not egit Issue unrelated to EGit
Projects
None yet
Development

No branches or pull requests

3 participants