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

BitbucketSCMSource retrieval for a Head revision should not fetch all branches

XMLWordPrintable

    • bitbucket-branch-source-plugin:804.v8b_0642650b_d2

      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 problems, especially when a repository has a lot of branches.. Since it is absolutely not necessary to fetch all branches in that scenario, we need to address this.

      We saw this happening in a user's environment recently with a repository with a lot of branches:

      Branch event
        java.net.SocketTimeoutException: Read timed out
          at java.base/java.net.SocketInputStream.socketRead0(Native Method)
          at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
          at java.base/java.net.SocketInputStream.read(SocketInputStream.java:168)
          at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
          at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
          at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
          at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
          at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
          at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506)
          at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1416)
          at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:456)
          at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:427)
          at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436)
          at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384)
          at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
        Caused: org.apache.http.conn.ConnectTimeoutException: Connect to bitbucket.corp.intusurg.com:443 [bitbucket.corp.intusurg.com/172.20.176.100] failed: Read timed out
          at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
          at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
          at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
          at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
          at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
          at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
          at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
          at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
          at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
          at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.executeMethodNoRetry(BitbucketServerAPIClient.java:1230)
          at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.executeMethod(BitbucketServerAPIClient.java:1203)
          at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:860)
        Caused: java.io.IOException: Communication error for url: /rest/api/1.0/projects/<projectName>/repos/<repoName>/branches?start=18800&limit=200
          at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:890)
          at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getResources(BitbucketServerAPIClient.java:836)
          at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getServerBranches(BitbucketServerAPIClient.java:589)
          at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getBranches(BitbucketServerAPIClient.java:580)
          at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:821)
          at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
          at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:101)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
          at hudson.model.ResourceController.execute(ResourceController.java:107)
          at hudson.model.Executor.run(Executor.java:449)
      

      Possibly the real root cause of the older issue https://issues.jenkins.io/browse/JENKINS-63633.

            allan_burdajewicz Allan BURDAJEWICZ
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: