Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-11576

Getting "returned status code 128: ssh_exchange_identification" error sometimes

      I have Jenkins setup in Windows Server machine and the job will trigger the build at specified time. Sometimes the job fails with the below exception and when I manually trigger it again it will work fine. I read somewhere that moving id_rsa.* file to GIT installation folder will fix the issue, but it didn't improve in my case. It would be great if there is a way to fix this issue.

      ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
      ERROR: (Underlying report) : Error performing command: E:\git\bin\git.exe fetch -t gitosis@***.**.com:ServiceApp +refs/heads/:refs/remotes/origin/*
      Command "E:\git\bin\git.exe fetch -t gitosis@***.**.com:ServiceApp +refs/heads/:refs/remotes/origin/*" returned status code 128: ssh_exchange_identification: Connection closed by remote host
      fatal: The remote end hung up unexpectedly

      ERROR: Could not fetch from any repository
      FATAL: Could not fetch from any repository
      hudson.plugins.git.GitException: Could not fetch from any repository
      at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1008)
      at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:968)
      at hudson.FilePath.act(FilePath.java:785)
      at hudson.FilePath.act(FilePath.java:767)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:968)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1193)
      at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:567)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:455)
      at hudson.model.Run.run(Run.java:1404)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:230)

          [JENKINS-11576] Getting "returned status code 128: ssh_exchange_identification" error sometimes

          Is there any update on this issue, I'm seeing issue in the latest version 1.449 too....

          Murali Srinivasan added a comment - Is there any update on this issue, I'm seeing issue in the latest version 1.449 too....

          I am seeing this issue as well on Windows 7 64-bit. Manual trigger works just fine, but auto trigger fails.

          Adam Westhusing added a comment - I am seeing this issue as well on Windows 7 64-bit. Manual trigger works just fine, but auto trigger fails.

          The same problem on Ubuntu server 11.10 x64.
          ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
          hudson.plugins.git.GitException: Error performing command: git fetch -t git@git:planroot +refs/heads/:refs/remotes/origin/
          Command "git fetch -t git@git:planroot +refs/heads/:refs/remotes/origin/" returned status code 128: ssh_exchange_identification: Connection closed by remote host
          fatal: The remote end hung up unexpectedly

          at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:776)
          at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:741)
          at hudson.plugins.git.GitAPI.fetch(GitAPI.java:190)
          at hudson.plugins.git.GitAPI.fetch(GitAPI.java:978)
          at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:765)
          at hudson.plugins.git.GitSCM.access$100(GitSCM.java:80)
          at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1003)
          at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:970)
          at hudson.FilePath.act(FilePath.java:788)
          at hudson.FilePath.act(FilePath.java:770)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:970)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1195)
          at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:576)
          at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:465)
          at hudson.model.Run.run(Run.java:1409)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          at hudson.model.ResourceController.execute(ResourceController.java:88)
          at hudson.model.Executor.run(Executor.java:238)
          Caused by: hudson.plugins.git.GitException: Command "git fetch -t git@git:planroot +refs/heads/:refs/remotes/origin/" returned status code 128: ssh_exchange_identification: Connection closed by remote host
          fatal: The remote end hung up unexpectedly

          at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:771)
          ... 17 more

          Dmitriy Korovkin added a comment - The same problem on Ubuntu server 11.10 x64. ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway hudson.plugins.git.GitException: Error performing command: git fetch -t git@git:planroot +refs/heads/ :refs/remotes/origin/ Command "git fetch -t git@git:planroot +refs/heads/ :refs/remotes/origin/ " returned status code 128: ssh_exchange_identification: Connection closed by remote host fatal: The remote end hung up unexpectedly at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:776) at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:741) at hudson.plugins.git.GitAPI.fetch(GitAPI.java:190) at hudson.plugins.git.GitAPI.fetch(GitAPI.java:978) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:765) at hudson.plugins.git.GitSCM.access$100(GitSCM.java:80) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1003) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:970) at hudson.FilePath.act(FilePath.java:788) at hudson.FilePath.act(FilePath.java:770) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:970) at hudson.model.AbstractProject.checkout(AbstractProject.java:1195) at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:576) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:465) at hudson.model.Run.run(Run.java:1409) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:238) Caused by: hudson.plugins.git.GitException: Command "git fetch -t git@git:planroot +refs/heads/ :refs/remotes/origin/ " returned status code 128: ssh_exchange_identification: Connection closed by remote host fatal: The remote end hung up unexpectedly at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:771) ... 17 more

          Did anyone found any solution for this issue?

          Murali Srinivasan added a comment - Did anyone found any solution for this issue?

          Hi all,

          I am experiencing the same issue and it seems very random. I can't pinpoint what is going on. It only fails when the job is set to run on a schedule (regardless of schedule/time of trigger) and the rate of failure seems random.

          One thing that is interesting is that asking to wipe out the workspace before each build fixes the issue, meaning that the git clone works without issues, but for some reason the git fetch done after that when the workspace isn't cleaned sometimes fails.

          What I don't understand is that for other jobs using SCM polling, Jenkins also does a git fetch but it always works (from the exact same Git repository).

          So right now wiping out the workspace is a workaround, but it might not be suitable for everybody.

          Maxime Petazzoni added a comment - Hi all, I am experiencing the same issue and it seems very random. I can't pinpoint what is going on. It only fails when the job is set to run on a schedule (regardless of schedule/time of trigger) and the rate of failure seems random. One thing that is interesting is that asking to wipe out the workspace before each build fixes the issue, meaning that the git clone works without issues, but for some reason the git fetch done after that when the workspace isn't cleaned sometimes fails. What I don't understand is that for other jobs using SCM polling, Jenkins also does a git fetch but it always works (from the exact same Git repository). So right now wiping out the workspace is a workaround, but it might not be suitable for everybody.

          @Seth Goings Is this fixed? will it be available in next release?

          Murali Srinivasan added a comment - @Seth Goings Is this fixed? will it be available in next release?

          Seth Goings added a comment -

          chandramuralis - I was hoping to get some visibility for this issue, so I added the fix version so that it would come up in the "current" road map view that's configured for Jenkins.

          Seth Goings added a comment - chandramuralis - I was hoping to get some visibility for this issue, so I added the fix version so that it would come up in the "current" road map view that's configured for Jenkins.

          Seth Goings added a comment -

          This is not an issue with Jenkins - in my corporate environment we have jobs that are using Git and Jenkins in two ways:

          We've recently had jobs of both implementation styles fail, and have done some investigation and found that the MaxStartups value (defaults to 10) in sshd_config on our git server needed to be increased. See "MaxStartups" here: http://www.linuxmanpages.com/man5/sshd_config.5.php

          After increasing the MaxStartups value, we haven't seen the issue again. In any case, this issue is not a Jenkins bug.

          Seth Goings added a comment - This is not an issue with Jenkins - in my corporate environment we have jobs that are using Git and Jenkins in two ways: Using the git plugin ( https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin ) Using a bash based deployment tool that can checkout code from Git for you and build/deploy code. We've recently had jobs of both implementation styles fail, and have done some investigation and found that the MaxStartups value (defaults to 10) in sshd_config on our git server needed to be increased. See "MaxStartups" here: http://www.linuxmanpages.com/man5/sshd_config.5.php After increasing the MaxStartups value, we haven't seen the issue again. In any case, this issue is not a Jenkins bug.

          @Seth... .thanks a lot for this suggestion. It really worked after 6 months.

          Murali Srinivasan added a comment - @Seth... .thanks a lot for this suggestion. It really worked after 6 months.

          Peter Hannon added a comment - - edited

          sgoings thanks, 5 years later, this also fixed my issue, where I had multiple simultaneous Jenkins jobs trying to do a git clone at the same time.

          Peter Hannon added a comment - - edited sgoings thanks, 5 years later, this also fixed my issue, where I had multiple simultaneous Jenkins jobs trying to do a git clone at the same time.

            sgoings Seth Goings
            chandramuralis Murali Srinivasan
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: