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

IllegalStateException: Jenkins has not been started, or was already shut down

    Details

    • Similar Issues:
    • Released As:
      2.8.2

      Description

      Call over remoting failing sometimes when running checkout scm in a multibranch pipeline

      This is when using a github app,

      likely caused by: https://github.com/jenkinsci/github-branch-source-plugin/pull/223

      12:03:53  java.lang.IllegalStateException: Jenkins has not been started, or was already shut down
      12:03:53  	at org.apache.commons.lang3.Validate.validState(Validate.java:829)
      12:03:53  	at com.cloudbees.jenkins.GitHubWebHook.getJenkinsInstance(GitHubWebHook.java:155)
      12:03:53  	at org.jenkinsci.plugins.github_branch_source.Connector.getProxy(Connector.java:516)
      12:03:53  	at org.jenkinsci.plugins.github_branch_source.Connector.createGitHubBuilder(Connector.java:416)
      12:03:53  	at org.jenkinsci.plugins.github_branch_source.Connector.createGitHubBuilder(Connector.java:399)
      12:03:53  	at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials.generateAppInstallationToken(GitHubAppCredentials.java:111)
      12:03:53  	at org.jenkinsci.plugins.github_branch_source.GitHubAppCredentials.getPassword(GitHubAppCredentials.java:157)
      12:03:53  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createPasswordFile(CliGitAPIImpl.java:2180)
      12:03:53  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2002)
      12:03:53  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:81)
      12:03:53  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:569)
      12:03:53  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:798)
      12:03:53  	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)
      12:03:53  	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:154)
      12:03:53  	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      12:03:53  	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      12:03:53  	at hudson.remoting.Request$2.run(Request.java:369)
      12:03:53  	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      12:03:53  	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      12:03:53  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      12:03:53  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      12:03:53  	at java.base/java.lang.Thread.run(Thread.java:834) 

        Attachments

          Issue Links

            Activity

            Hide
            bitwiseman Liam Newman added a comment -

            Tim Jacomb Jesse Glick
            Do you think I should just wrap getProxy() in a try-catch? If someone is using a proxy though, then their checkout will fail, right?

            Could this be another symptom of the same root cause as JENKINS-62249?

            Show
            bitwiseman Liam Newman added a comment - Tim Jacomb Jesse Glick Do you think I should just wrap getProxy() in a try-catch? If someone is using a proxy though, then their checkout will fail, right? Could this be another symptom of the same root cause as JENKINS-62249 ?
            Hide
            timja Tim Jacomb added a comment -

            Jenkins.isJenkinsJVM or passing the proxy config down in the replacer might be other options but haven’t looked closely

            Show
            timja Tim Jacomb added a comment - Jenkins.isJenkinsJVM or passing the proxy config down in the replacer might be other options but haven’t looked closely
            Hide
            jglick Jesse Glick added a comment - - edited

            Indeed a regression from https://github.com/jenkinsci/github-branch-source-plugin/commit/342952d4f51a6c75a439c62b8a35a0bf08990e71 AFAICT.

            Do not use GitHubWebHook.getJenkinsInstance(). Use Jenkins.getInstanceOrNull and as Tim Jacomb hinted, you can check JenkinsJVM to see if you are running on an agent and thus cannot check Jenkins.proxy. (Best to do both: if on an agent machine, even loading jenkins.model.Jenkins can cause problems with Servlet API class loading.)

            It makes little sense to pass proxy config from master to agent, since you have no way of knowing whether an agent needs or can even use the same proxy as the master. Anyway as of https://github.com/jenkinsci/github-branch-source-plugin/pull/302 it is unlikely that the agent would actually be contacting the GitHub API to begin with, as it would normally just use a token recently computed on the master.

            Show
            jglick Jesse Glick added a comment - - edited Indeed a regression from https://github.com/jenkinsci/github-branch-source-plugin/commit/342952d4f51a6c75a439c62b8a35a0bf08990e71 AFAICT. Do not use GitHubWebHook.getJenkinsInstance() . Use Jenkins.getInstanceOrNull and as Tim Jacomb hinted, you can check JenkinsJVM to see if you are running on an agent and thus cannot check Jenkins.proxy . (Best to do both: if on an agent machine, even loading jenkins.model.Jenkins can cause problems with Servlet API class loading.) It makes little sense to pass proxy config from master to agent, since you have no way of knowing whether an agent needs or can even use the same proxy as the master. Anyway as of https://github.com/jenkinsci/github-branch-source-plugin/pull/302 it is unlikely that the agent would actually be contacting the GitHub API to begin with, as it would normally just use a token recently computed on the master.
            Hide
            bitwiseman Liam Newman added a comment -

            Waiting for jenkins infrastructure getting fixed to publish a fix.

            Show
            bitwiseman Liam Newman added a comment - Waiting for jenkins infrastructure getting fixed to publish a fix.
            Show
            jglick Jesse Glick added a comment - Hence https://github.com/jenkinsci/github-branch-source-plugin/pull/308#issuecomment-642555849

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                timja Tim Jacomb
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: