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

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

This widget could not be displayed.

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.

This widget could not be displayed.

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.

This widget could not be displayed.

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

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?

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;

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

531 views 3 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you