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

Internal exception: jgit - length of null array #153

Closed
lorenrogers opened this issue Nov 26, 2015 · 26 comments
Closed

Internal exception: jgit - length of null array #153

lorenrogers opened this issue Nov 26, 2015 · 26 comments

Comments

@lorenrogers
Copy link

Whenever I try to pull my git repo, I get an error titled "Internal exception occurred."
The body says:

Message from jgit:
Attempt to get length of null array
@rndstr
Copy link

rndstr commented Nov 26, 2015

There is some more information in #34 (below the closed fold) but I think it would make more sense to use this ticket instead as the other one's topic was not about this initially

@bignose-debian
Copy link

This happens now for me in Password Store version 1.2.0.48.

@iGormilhit
Copy link

iGormilhit commented Jul 30, 2016

I have the same problem with Password Store version 1.2.0.51 from F-Droid. I tried the workaround found in issue 94, but couldn't apply it.

My configuration is:

Protocol: ssh://
Username: git
Server URL: mydomain:port
Repo Path: /path/to/git-repo.git
Resulting URL: git@mydomain:port/path/to/git-repo.git

And I'm using a ssh-key.

The fun fact is that it has worked at least once yesterday.

edit : 2016-07-31 : Today the git pull worked again, at least once. I don't know what changed.

@iGormilhit
Copy link

Ok, I think my problem is related to the passphrase of my ssh-key which is too complicated. I get the "Attempt to get length of null array" error when I mistype the passphrase.

Sorry...

@zeapo
Copy link
Contributor

zeapo commented Aug 1, 2016

Interesting! I will check if there is a way to get the correct error code
for wrong passphrases.

Thank's

Le lun. 1 août 2016 08:01, iGor milhit notifications@github.com a écrit :

Ok, I think my problem is related to the passphrase of my ssh-key which is
too complicated. I get the "Attempt to get length of null array" error when
I mistype the passphrase.

Sorry...


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#153 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAQgBrkDYQ8769vpiStfvHLLi3r4HvBSks5qbZndgaJpZM4GprCg
.

@bignose-debian
Copy link

Now that I can attempt the Clone again, this bug occurs in Password Store 1.2.0.52.

I am confident the passphrase is correct for the key.

@wongma7
Copy link
Contributor

wongma7 commented Aug 6, 2016

@bignose-debian what kind of key is it? The app doesn't support newer kinds of encryption yet. Can you try testing a new key, maybe one generated from the app, and temporarily adding it to your server.

@bignose-debian
Copy link

bignose-debian commented Aug 7, 2016

@wongma7, as stated earlier, this is exactly the same file that has worked fine in earlier versions of Password Store. The file is unchanged from many months ago when I put it on the device.

As for “what kind of key”, I don't know what answer is needed. How can I get the information from the device? Can the Password Store program not provide better diagnostic on what it doesn't like about the key data?

@wongma7
Copy link
Contributor

wongma7 commented Aug 7, 2016

I mean the type of encryption if you know (RSA, DSA?) but I'm just taking a guess, that probably has nothing to do with it as it should give a different error. We only have the errors the libraries give us to work with, and as you can see they can be quite useless. :/ @bignose-debian to confirm, the latest version that worked is 1.2.0.47? The cloning functionality hasn't been touched in a long time so I will have to do some digging...

@bignose-debian
Copy link

bignose-debian commented Aug 7, 2016

(Using the same SSH secret key from another copy, imports fine now in Password Store 1.2.0.52. I'm willing to blame user error on this specific failure.)

@bignose-debian
Copy link

Is any more diagnostic information needed for this?

Perhaps a new release could be made that catches these errors and emits some more contextual message, so we can have a better idea when reporting this bug.

@lsowen
Copy link
Contributor

lsowen commented Sep 3, 2016

I was having the same (or similar?) issue. Capturing the log with adb logcat gave me the following trace:

09-03 08:02:26.721 12319   540 W System.err: java.lang.NullPointerException: Attempt to get length of null array
09-03 08:02:26.745 12319   540 W System.err:    at java.lang.StringFactory.newStringFromChars(StringFactory.java:211)
09-03 08:02:26.745 12319   540 W System.err:    at org.eclipse.jgit.transport.CredentialsProviderUserInfo.promptPassword(CredentialsProviderUserInfo.java:110)
09-03 08:02:26.745 12319   540 W System.err:    at com.jcraft.jsch.UserAuthPassword.start(UserAuthPassword.java:57)
09-03 08:02:26.745 12319   540 W System.err:    at com.jcraft.jsch.Session.connect(Session.java:463)
09-03 08:02:26.745 12319   540 W System.err:    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)
09-03 08:02:26.745 12319   540 W System.err:    at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:136)
09-03 08:02:26.745 12319   540 W System.err:    at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262)
09-03 08:02:26.745 12319   540 W System.err:    at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161)
09-03 08:02:26.745 12319   540 W System.err:    at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
09-03 08:02:26.745 12319   540 W System.err:    at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
09-03 08:02:26.745 12319   540 W System.err:    at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
09-03 08:02:26.745 12319   540 W System.err:    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
09-03 08:02:26.746 12319   540 W System.err:    at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:193)
09-03 08:02:26.746 12319   540 W System.err:    at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:133)
09-03 08:02:26.746 12319   540 W System.err:    at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:83)
09-03 08:02:26.746 12319   540 W System.err:    at com.zeapo.pwdstore.git.GitAsyncTask.doInBackground(GitAsyncTask.java:44)
09-03 08:02:26.746 12319   540 W System.err:    at com.zeapo.pwdstore.git.GitAsyncTask.doInBackground(GitAsyncTask.java:18)
09-03 08:02:26.746 12319   540 W System.err:    at android.os.AsyncTask$2.call(AsyncTask.java:304)
09-03 08:02:26.746 12319   540 W System.err:    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
09-03 08:02:26.746 12319   540 W System.err:    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
09-03 08:02:26.746 12319   540 W System.err:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
09-03 08:02:26.746 12319   540 W System.err:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
09-03 08:02:26.746 12319   540 W System.err:    at java.lang.Thread.run(Thread.java:761)

I thought this meant that there was an issue with handling SSH keys in JGit that didn't have passwords, but this ended up being incorrect. Running sshd on my server in debug mode (sudo /usr/sbin/sshd -d -p2222) and trying to clone from that (using port 2222 instead of 22) showed that it was failing because none of the keys on the server matched, so it was falling back to attempting password authentication.

Another situation that can generate the exact same error message is to specify the port as 22 (ie don't leave it blank, but add the port explicitly as 22).

The trace generated from that is

09-03 08:36:31.342   790   828 W System.err: org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of fetch command
09-03 08:36:31.342   790   828 W System.err:    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:145)
09-03 08:36:31.342   790   828 W System.err:    at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:261)
09-03 08:36:31.342   790   828 W System.err:    at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:78)
09-03 08:36:31.342   790   828 W System.err:    at com.zeapo.pwdstore.git.GitAsyncTask.doInBackground(GitAsyncTask.java:44)
09-03 08:36:31.343   790   828 W System.err:    at com.zeapo.pwdstore.git.GitAsyncTask.doInBackground(GitAsyncTask.java:18)
09-03 08:36:31.343   790   828 W System.err:    at android.os.AsyncTask$2.call(AsyncTask.java:304)
09-03 08:36:31.343   790   828 W System.err:    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
09-03 08:36:31.343   790   828 W System.err:    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
09-03 08:36:31.343   790   828 W System.err:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
09-03 08:36:31.343   790   828 W System.err:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
09-03 08:36:31.343   790   828 W System.err:    at java.lang.Thread.run(Thread.java:761)
09-03 08:36:31.343   790   828 W System.err: Caused by: org.eclipse.jgit.errors.NotSupportedException: URI not supported: ssh:///git@mygitserver.example.com:password-repo.git
09-03 08:36:31.343   790   828 W System.err:    at org.eclipse.jgit.transport.Transport.open(Transport.java:564)
09-03 08:36:31.343   790   828 W System.err:    at org.eclipse.jgit.transport.Transport.open(Transport.java:438)
09-03 08:36:31.343   790   828 W System.err:    at org.eclipse.jgit.transport.Transport.open(Transport.java:319)
09-03 08:36:31.343   790   828 W System.err:    at org.eclipse.jgit.transport.Transport.open(Transport.java:288)
09-03 08:36:31.343   790   828 W System.err:    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:120)
09-03 08:36:31.343   790   828 W System.err:    ... 10 more

The fix is to edit your settings to leave the port field in the configuration blank.

Summary
  • Server not accepting your ssh public key can cause this error message (run sshd in debug mode to diagnose)
  • Specifying Port 22 in config (instead of leaving blank) can cause this error message

@bignose-debian
Copy link

This is difficult for the developers and impossible for the users to even diagnose, because the message should not be this uninformative. Issue #219 requests better treatment of exceptions like this one.

@jelly
Copy link

jelly commented Nov 2, 2016

I've just found out that JGit expects a ".git" at the end of your git url. Miine was ssh://jelly@awesome.server:/var/lib/git/passwords

Might be nice to mention in the FAQ. Or I can make a bug report upstream (JGit)

@zeapo
Copy link
Contributor

zeapo commented Nov 2, 2016

Well, not really. It depends on your server configuration.

@jfjallid
Copy link

jfjallid commented Nov 2, 2016

I'm trying to clone from a bare repo now and get the error message "Attempt to get length of null array"
I've tried the following two commands:
user@example.com:1234/path/to/bare/repo/
and
ssh://user@example.com:1234/path/to/bare/repo/
but both lead to the same error message.

@gschwaer
Copy link

gschwaer commented Nov 2, 2016

Hm. I am cloning from a bare repo too. With only user@server.tl:pass-store where pass-store is the bare repo in the users home dir. Works for me..
Have you double checked that user has the rights to access the directory? Even though the error msg doesn't make much sense in this case.
Try to clone the repo from another computer with git only. Maybe you get a better error message then.
Or try to create a clean new bare repo and sync with it.

@jfjallid
Copy link

jfjallid commented Nov 2, 2016

Edit:
Nvm, the user had the correct permissions but I had another error preventing my android phone from authenticating right now. Seems to work now :)

I've successfully cloned the repo with git from another computer using the same user account.
I also noticed that even if I supply the wrong password for unlocking my ssh key when cloning I get the same error message.

@otwieracz
Copy link

I am still having this problem with port 2202. None of solutions found on this tracker actually worked.

@zeapo zeapo added the bug label Nov 8, 2016
@zeapo
Copy link
Contributor

zeapo commented Nov 8, 2016

This will be our next priority.

@aut0
Copy link

aut0 commented May 2, 2017

Is there a way to access the internal repository and do the merge manually? I have root access via adb.

@zeapo
Copy link
Contributor

zeapo commented May 4, 2017

You can, it's on the files folder of the application, IIRC /data/data/com.zeapo.pwdstore/files/store

@hughdavenport
Copy link

I feel like this issue is the same root issue as #94 which is also triggered by bad auth (as well as custom port, which is solved by prepending ssh://)

@hughdavenport
Copy link

Actually #219 will probably be a better ticket to merge with, as that is todo with the error messages themselves

@maxb
Copy link

maxb commented Oct 4, 2017

Apparently yet another way to cause the same error is to not have the relevant public key in ~/.ssh/authorized_keys on the server ...

@msfjarvis
Copy link
Member

The most common scenario for this to occur should be fixed in master. Being unauthorised to access the repository is a different problem altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests