Hi All,

      I'm facing Connection reset exception while connecting to get code from bit bucket.  

      Jenkins Version : 2.254

      Bitbucket Branch Source Plug-in :2.92

      Exception:

      java.net.SocketException: Connection reset
      05:53:56 at java.net.SocketInputStream.read(Unknown Source)
      05:53:56 at java.net.SocketInputStream.read(Unknown Source)
      05:53:56 at sun.security.ssl.InputRecord.readFully(Unknown Source)
      05:53:56 at sun.security.ssl.InputRecord.read(Unknown Source)
      05:53:56 at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
      05:53:56 at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
      05:53:56 at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
      05:53:56 at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
      05:53:56 at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436)
      05:53:56 at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384)
      05:53:56 at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
      05:53:56 at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374)
      05:53:56 at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
      05:53:56 at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
      05:53:56 at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
      05:53:56 at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
      05:53:56 at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
      05:53:56 at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
      05:53:56 at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
      05:53:56 at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:815)
      05:53:56 Caused: java.io.IOException: Communication error for url: /rest/api/1.0/projects/AB/repos/app1/branches?start=0&limit=200
      05:53:56 at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:845)
      05:53:56 at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getResources(BitbucketServerAPIClient.java:791)
      05:53:56 at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getServerBranches(BitbucketServerAPIClient.java:544)
      05:53:56 at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getBranches(BitbucketServerAPIClient.java:535)
      05:53:56 at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:791)
      05:53:56 at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
      05:53:56 at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:98)
      05:53:56 at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
      05:53:56 at hudson.model.ResourceController.execute(ResourceController.java:97)
      05:53:56 at hudson.model.Executor.run(Executor.java:428)
      05:53:56 Finished: FAILURE

      Please let me know, how to resolve this issue.

          [JENKINS-63633] Connection reset to connect bitbucket branch

          I have already imported the bit bucket certificates in JDK_PATH/jre/lib/security/cacerts as trusted certificates.

          VenkateshReddy Madduri added a comment - I have already imported the bit bucket certificates in JDK_PATH/jre/lib/security/cacerts as trusted certificates.

          we are also same issue for Jira integration. can someone please take a look.
          17:47:29 JIRA: Site - JIRA - Add new comment: {body=Build Started

          17:47:29 Error Code: -1
          17:47:29 Error Message: Connection reset

          roshan chandekar added a comment - we are also same issue for Jira integration. can someone please take a look. 17:47:29 JIRA: Site - JIRA - Add new comment: {body=Build Started 17:47:29 Error Code: -1 17:47:29 Error Message: Connection reset

          Allan BURDAJEWICZ added a comment - - edited

          We found out recently that the SCMBinder in the context of BitbucketSCMSource retrieve *all branches* when looking for a single Head revision that is very inefficient and could possible cause the problem that we see here. Created another ticket for this https://issues.jenkins.io/browse/JENKINS-71355.

          Another factor obviously is slow network... Note that for Bitbucket Server, the read timeout is configurable since v2.8.0 of the Bitbucket Branch source plugin. But not for Bitbucket Cloud https://issues.jenkins.io/browse/JENKINS-71354.

          Allan BURDAJEWICZ added a comment - - edited We found out recently that the SCMBinder in the context of BitbucketSCMSource retrieve * all branches * when looking for a single Head revision that is very inefficient and could possible cause the problem that we see here. Created another ticket for this https://issues.jenkins.io/browse/JENKINS-71355 . Another factor obviously is slow network... Note that for Bitbucket Server, the read timeout is configurable since v2.8.0 of the Bitbucket Branch source plugin. But not for Bitbucket Cloud https://issues.jenkins.io/browse/JENKINS-71354 .

          Please try version 804.v8b_0642650b_d2 and see if that helps.

          Allan BURDAJEWICZ added a comment - Please try version 804.v8b_0642650b_d2 and see if that helps.

          Nikolas Falco added a comment -

          Is this bug still present in latest plugin version?

          Nikolas Falco added a comment - Is this bug still present in latest plugin version?

            nfalco Nikolas Falco
            maddurivenkys VenkateshReddy Madduri
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: