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

multibranch-job deleted when bitbucket communication fails

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'm trying out the "Bitbucket team/project" feature: I have an issue where some of my jobs keeps being deleted and recreated randomly, and it seems to be related to situations where communicating with bitbucket fails. I would not expect Jenkins to delete my multibranch-job when e.g. Bitbucket or some network link is down.

      Relevant log:

      Proposing ansible-docker
      Connecting to https://bitbucket.org using hidden-org-name/****** (hidden-org-name bitbucket credentials)
      Looking up hidden-org-name/ansible-docker for branches
      Checking branch jenkins-test from hidden-org-name/ansible-docker
      Met criteria
      ERROR: Failed to create or update a subproject ansible-docker
      com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: Communication error: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
      	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequest(BitbucketCloudApiClient.java:421)
      	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRepository(BitbucketCloudApiClient.java:173)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.getRepositoryType(BitbucketSCMSource.java:254)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.observe(BitbucketSCMSource.java:372)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieveBranches(BitbucketSCMSource.java:326)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:279)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:146)
      	at jenkins.scm.api.SCMSource.retrieve(SCMSource.java:230)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:175)
      	at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria$1.call(MultiBranchProjectFactory.java:157)
      	at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria$1.call(MultiBranchProjectFactory.java:154)
      	at jenkins.branch.OrganizationFolder.withSCMSourceCriteria(OrganizationFolder.java:255)
      	at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria.recognizes(MultiBranchProjectFactory.java:154)
      	at jenkins.branch.OrganizationFolder$1$1.complete(OrganizationFolder.java:165)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator.add(BitbucketSCMNavigator.java:198)
      	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator.visitSources(BitbucketSCMNavigator.java:175)
      	at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:125)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:157)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:122)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
      	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:992)
      	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
      	at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:747)
      	at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
      	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
      	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
      	at org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java:828)
      	at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2116)
      	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
      	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
      	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
      	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
      	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
      	at com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient.getRequest(BitbucketCloudApiClient.java:412)
      	... 20 more
      Caused by: java.io.EOFException: SSL peer shut down incorrectly
      	at sun.security.ssl.InputRecord.read(InputRecord.java:505)
      	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
      	... 33 more
      
        Evaluating orphaned items in hidden-org-name on Bitbucket
        Will remove ansible-docker as it is #1 in the list
        Finished: SUCCESS
      
      

        Attachments

          Issue Links

            Activity

            Hide
            stephenconnolly Stephen Connolly added a comment -

            I have a fix for this under test. If anyone wants to assist in doing some early testing the code is on https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/35 (though at this point it doesn't build)

            Show
            stephenconnolly Stephen Connolly added a comment - I have a fix for this under test. If anyone wants to assist in doing some early testing the code is on https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/35 (though at this point it doesn't build)
            Hide
            fortuna Ben Fortuna added a comment -

            Stephen Connolly Will this fix also apply for Git/Github repositories? I suspect most of these plugins will just swallow exceptions when they can't connect to a repository, so perhaps the design needs to be rethought.. (possibly require an exception/explicit return value before deleting the job?)

            Show
            fortuna Ben Fortuna added a comment - Stephen Connolly Will this fix also apply for Git/Github repositories? I suspect most of these plugins will just swallow exceptions when they can't connect to a repository, so perhaps the design needs to be rethought.. (possibly require an exception/explicit return value before deleting the job?)
            Hide
            stephenconnolly Stephen Connolly added a comment -

            Ben Fortuna to the best of my knowledge the Git, GitHub and Subversion implementations do the correct thing and propagate IO errors as exceptions. Certainly when I run out of rate limit the scan is aborted and no repositories or branches are deleted. If you have a reproducible test case or an example log where there was an API error and the scan / index completed as success (which would then cause the missing branches to be removed) please create an issue for it in JIRA as that kind of data loss is highest priority IMHO (i.e. this is why I am working on this issue ahead of all others at present - because it is a data loss issue)

            Show
            stephenconnolly Stephen Connolly added a comment - Ben Fortuna to the best of my knowledge the Git, GitHub and Subversion implementations do the correct thing and propagate IO errors as exceptions. Certainly when I run out of rate limit the scan is aborted and no repositories or branches are deleted. If you have a reproducible test case or an example log where there was an API error and the scan / index completed as success (which would then cause the missing branches to be removed) please create an issue for it in JIRA as that kind of data loss is highest priority IMHO (i.e. this is why I am working on this issue ahead of all others at present - because it is a data loss issue)
            Hide
            fortuna Ben Fortuna added a comment -

            Stephen Connolly new issue created for github: JENKINS-42000

            Show
            fortuna Ben Fortuna added a comment - Stephen Connolly new issue created for github: JENKINS-42000
            Hide
            stephenconnolly Stephen Connolly added a comment -

            I claim fixed in 2.1.0 release

            Show
            stephenconnolly Stephen Connolly added a comment - I claim fixed in 2.1.0 release

              People

              • Assignee:
                stephenconnolly Stephen Connolly
                Reporter:
                asgeirf Asgeir Frimannsson
              • Votes:
                19 Vote for this issue
                Watchers:
                24 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: