Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Error "An ssh error occurred while querying for reviews." shown in Gerrit Reviews panel

Liam Wickins August 4, 2013

Hello,

We recently moved our JIRA instance to a new server on a different domain and network subnet. Everything appears to be working well with the exception of the Gerrit plug-in.

The error mentioned in the subject title now appears in the "Gerrit Reviews" panel for any issues.

I have done the following checks to confirm the configuration should be correct (in theory):

1. Added a new public ssh-key to the gerrit user account that is used for all ssh queries for the new JIRA instance.

2. Checked the ssh configuration is working by running the following command as user "jira" which is used by our JIRA instance:

ssh -p 29418 gerrituser@gerrit_server gerrit query --format TEXT message:TG-173

The above command works correctly and returns the open gerrit ticket TG-173 from our gerrit server.

3. Checked that I can download the URL for the above ticket from the gerrit server using 'wget'.

I've tried to run a grep through the atlassian log files, but couldn't see any relevant error messages for the ssh error to understand more deeply what might be failing in our configuration.

Since the original JIRA installation worked and we imported the database from the original JIRA installation, the problem could quite possibly be caused by this import process.

I have tried uninstalling Gerrit and re-installing it without success. I should note that when I did this, the Gerrit configuration dialog appeared to remember all previous settings, so I don't think the plug-in uninstall is comprehensively deleting associated data from the database.

Any pointers into how to solve this problem gratefully received.

Liam.

3 answers

1 accepted

2 votes
Answer accepted
Liam Wickins September 2, 2013

I managed to eventually find catalina.out and the following trace:

Caused by: com.jcraft.jsch.JSchException: invalid privatekey: /var/atlassian/application-data/jira/data/com/meetme/plugins/jira/gerrit/wcdma-git.picochip.com1299857170919082294.key
at com.jcraft.jsch.IdentityFile.<init>(IdentityFile.java:224)
at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:135)
at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:130)
at com.jcraft.jsch.JSch.addIdentity(JSch.java:206)
at com.jcraft.jsch.JSch.addIdentity(JSch.java:200)
at com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh.SshConnectionImpl.<init>(SshConnectionImpl.java:78)

I checked the key file we had on record and discovered that it was in fact an RSA public key rather than the paired private key. Upon addressing this problem I am pleased to report that the Gerrit plugin is now working.

0 votes
&(*&)#)_*#@@(*)(@*)(*@
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 24, 2013

Hi Liam,

to enable some logging, you will have to set the following level :

  • com.meetme = DEBUG
  • com.sonyericsson.hudson = DEBUG
  • com.jcraft = DEBUG

i suggest that you re-upload the Private key ( a private key with no password ) .. but you should have some more verbose output wiith the above mentioned level .

best regards

Liam Wickins August 26, 2013

Thanks for the suggestion, Trey. I've done as suggested and enabled DEBUG for the above modules under the ViewLogging.jspa page.

However, I did not see any additional debug trace reported either under the 'Gerrit' tab in the GUI or in the atlassian-jira.log file.

Do I need to look somewhere else?

&(*&)#)_*#@@(*)(@*)(*@
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2013

did you check catalin.out , websphere.log. atlassian-jira.log .. ?

you should see one of :

  • Connected:true
  • Connected:false
  • a stacktrace (when something is wrong)

here is the fulle name of the package : com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh


here is the code :

logger.debug("connecting...");
        try {
            client = new JSch();
            client.addIdentity(authentication.getPrivateKeyFile().getAbsolutePath(),
                    authentication.getPrivateKeyFilePassword());
            client.setHostKeyRepository(new BlindHostKeyRepository());
            connectSession = client.getSession(authentication.getUsername(), host, port);
            connectSession.connect();
            logger.debug("Connected: {}", connectSession.isConnected());
            connectSession.setServerAliveInterval(ALIVE_INTERVAL);
        } catch (JSchException ex) {
            throw new SshException(ex);
        }

http://maven.jenkins-ci.org/content/repositories/releases/com/sonyericsson/hudson/plugins/gerrit/gerrit-events/1.3.1/

https://github.com/MeetMe/jira-gerrit-plugin/blob/master/src/main/java/com/meetme/plugins/jira/gerrit/data/IssueReviewsImpl.java#L104

best regards;

0 votes
Liam Wickins August 5, 2013

One further and important point to add. I have also checked the Gerrit sshd "site/log/sshd_log" file and can see that there are no access attempts being made from our JIRA instance which suggests that the Gerrit plugin is, for some unknown reason, not running or unable to connect outwardly on ssh.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events