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

"Configure Global Security", "Configure Credentials", "Global Tool Configuration" menu items throw stack trace

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • None

      We're running Jenkins version 2.81 on a 64-bit Windows 7 Professional machine, 8 GB RAM, using JRE v1.8.0.112.

      Certain Jenkins menus throw a stack trace:

      • Configure Global Security
      • Configure Credentials
      • Global Tool Configuration
      java.lang.AssertionError: InstanceIdentity is missing its singleton
      	at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.get(InstanceIdentity.java:133)
      	at org.jenkinsci.main.modules.instance_identity.InstanceIdentityRSAProvider.getKeyPair(InstanceIdentityRSAProvider.java:23)
      	at jenkins.model.identity.InstanceIdentityProvider$KeyTypes.get(InstanceIdentityProvider.java:161)
      	at jenkins.model.identity.InstanceIdentityProvider$KeyTypes.getKeyPair(InstanceIdentityProvider.java:210)
      	at jenkins.model.identity.IdentityRootAction.getUrlName(IdentityRootAction.java:42)
      	at jenkins.model.Jenkins.getDynamic(Jenkins.java:3643)
      	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
      	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
      	at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:372)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      Caused: javax.servlet.ServletException
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:765)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
      	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:564)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
      	at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
      	at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
      	at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

      This is particularly problematic because it prevents us from adding new SSH keys to the server instance.

      (This seems to be related or similar to JENKINS-38057, which was recently closed.)

          [JENKINS-47431] "Configure Global Security", "Configure Credentials", "Global Tool Configuration" menu items throw stack trace

          Oleg Nenashev added a comment -

          gs0f40o0vseljgbjcxv2 please clarify which version you use. There is no Jenkins version like "2.8.1" available. Do you mean "2.81" or what?

          Oleg Nenashev added a comment - gs0f40o0vseljgbjcxv2 please clarify which version you use. There is no Jenkins version like "2.8.1" available. Do you mean "2.81" or what?

          Alex Fung added a comment -

          Sorry oleg_nenashev, that's correct – I meant Jenkins version 2.81; that was a typo.

          Alex Fung added a comment - Sorry oleg_nenashev , that's correct – I meant Jenkins version 2.81 ; that was a typo.

          Daniel Beck added a comment -

          gs0f40o0vseljgbjcxv2 Since this links to another issue, did you apply the solution described in its comments of deleting the identity file? What happens when you do?

          Daniel Beck added a comment - gs0f40o0vseljgbjcxv2 Since this links to another issue, did you apply the solution described in its comments of deleting the identity file? What happens when you do?

          Alex Fung added a comment -

          Hello danielbeck,

          Yes, we did attempt to apply the solution cited here – we renamed the existing identity file identity.key in the user directory for Jenkins to identity.key.<timestamp>, and restarted. Unfortunately, the issue remained – we are unable to access certain Jenkins menus, as per JIRA description.. (Unlike Peter Schutt, I did not see a new identity.key file generated, for what that's worth.)

          Alex Fung added a comment - Hello danielbeck , Yes, we did attempt to apply the solution cited here – we renamed the existing identity file identity.key in the user directory for Jenkins to identity.key.<timestamp> , and restarted. Unfortunately, the issue remained – we are unable to access certain Jenkins menus, as per JIRA description.. (Unlike Peter Schutt, I did not see a new identity.key file generated, for what that's worth.)

          Daniel Beck added a comment -

          gs0f40o0vseljgbjcxv2 Given similar recent reports, please double check that Jenkins runs on JRE 8, and not JRE 9. This error typically occurs when doing the latter.

          Daniel Beck added a comment - gs0f40o0vseljgbjcxv2 Given similar recent reports, please double check that Jenkins runs on JRE 8, and not JRE 9. This error typically occurs when doing the latter.

          Alex Fung added a comment -

          Hello danielbeck,

          Thank you for the advice.  I just double-checked the machine, and this Jenkins is running with JRE v1.8.0.112.

          Alex Fung added a comment - Hello danielbeck , Thank you for the advice.  I just double-checked the machine, and this Jenkins is running with JRE v1.8.0.112.

          Daniel Beck added a comment -

          gs0f40o0vseljgbjcxv2 To clarify, did you rename both identity.key and identity.key.enc earlier?

          Daniel Beck added a comment - gs0f40o0vseljgbjcxv2 To clarify, did you rename both identity.key and identity.key.enc earlier?

          Daniel Beck added a comment -

          Also, please provide the log records (/var/log/jenkins/jenkins.log or equivalent) from the latest Jenkins startup.

          Daniel Beck added a comment - Also, please provide the log records (/var/log/jenkins/jenkins.log or equivalent) from the latest Jenkins startup.

          Alex Fung added a comment -

          Hello danielbeck,

          Regarding identity.key query, we renamed the identity.key file alone in the user directory for Jenkins.  When we restarted the Jenkins server, no identity.key.enc file was generated in the user directory for Jenkins upon start-up.  There was only the renamed identity.key.<timestamp> in the folder.

          Alex Fung added a comment - Hello danielbeck , Regarding identity.key query, we renamed the identity.key file alone in the user directory for Jenkins.  When we restarted the Jenkins server, no identity.key.enc file was generated in the user directory for Jenkins upon start-up.  There was only the renamed identity.key.<timestamp> in the folder.

          Alex Fung added a comment -

          Thank you.  It appears we're starting Jenkins via java -jar jenkins.war such that all output gets directed to console, so I piped this into a file jenkins.out and have attached it to this JIRA.

          Alex Fung added a comment - Thank you.  It appears we're starting Jenkins via java -jar jenkins.war such that all output gets directed to console, so I piped this into a file jenkins.out and have attached it to this JIRA.

          Daniel Beck added a comment -

          The relevant error is

          1) Error injecting constructor, java.io.IOException: Could not read PEM file incorrect header.
            at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl.<init>(PageDecoratorImpl.java:21)
          
          …
          Caused by: java.io.IOException: Could not read PEM file incorrect header.
              at org.jenkinsci.main.modules.instance_identity.pem.PEMHelper.decodePEM(PEMHelper.java:67)
              at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:90)

          Looking at the code, it seems that the file identity.key exists and is in an invalid format. Please note that the files needs to be removed while Jenkins is not running, doing that while it's running doesn't help.

          Daniel Beck added a comment - The relevant error is 1) Error injecting constructor, java.io.IOException: Could not read PEM file incorrect header.   at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl.<init>(PageDecoratorImpl.java:21) … Caused by: java.io.IOException: Could not read PEM file incorrect header.     at org.jenkinsci.main.modules.instance_identity.pem.PEMHelper.decodePEM(PEMHelper.java:67)     at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:90) Looking at the code, it seems that the file identity.key exists and is in an invalid format. Please note that the files needs to be removed while Jenkins is not running, doing that while it's running doesn't help.

          Daniel Beck added a comment -

          The relevant error is

          1) Error injecting constructor, java.io.IOException: Could not read PEM file incorrect header.
            at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl.<init>(PageDecoratorImpl.java:21)
          
          …
          Caused by: java.io.IOException: Could not read PEM file incorrect header.
              at org.jenkinsci.main.modules.instance_identity.pem.PEMHelper.decodePEM(PEMHelper.java:67)
              at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:90)

          Looking at the code, it seems that the file identity.key exists and is in an invalid format. Please note that the files needs to be removed while Jenkins is not running, doing that while it's running doesn't help.

          Daniel Beck added a comment - The relevant error is 1) Error injecting constructor, java.io.IOException: Could not read PEM file incorrect header.   at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl.<init>(PageDecoratorImpl.java:21) … Caused by: java.io.IOException: Could not read PEM file incorrect header.     at org.jenkinsci.main.modules.instance_identity.pem.PEMHelper.decodePEM(PEMHelper.java:67)     at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:90) Looking at the code, it seems that the file identity.key exists and is in an invalid format. Please note that the files needs to be removed while Jenkins is not running, doing that while it's running doesn't help.

          Alex Fung added a comment -

          Many thanks danielbeck, your diagnosis helped resolve this issue for us! As per this comment, we had renamed the identity.key file in the user directory for Jenkins, but apparently this was not the instance in the invalid format causing the issue.  There was another identity.key file on the filesystem.  After:

          • stopping our Jenkins server
          • removing that offending straggler identity.key file
          • and restarting the Jenkins server

          the "Configure Global Security", "Configure Credentials", "Global Tool Configuration" menu items are functioning properly.

          Thanks again Daniel, greatly appreciate your assistance!

          Alex Fung added a comment - Many thanks danielbeck , your diagnosis helped resolve this issue for us! As per this comment, we had renamed the identity.key file in the user directory for Jenkins, but apparently this was not the instance in the invalid format causing the issue.  There was another   identity.key file on the filesystem.  After: stopping our Jenkins server removing that offending straggler identity.key  file and restarting the Jenkins server the "Configure Global Security", "Configure Credentials", "Global Tool Configuration" menu items are functioning properly. Thanks again Daniel, greatly appreciate your assistance!

          Claus Schou added a comment -

          oleg_nenashev I've attached the errors I see in the console when starting up my jenkins server.

          Hope you can help me resolve this issue. 

          Claus Schou added a comment - oleg_nenashev I've attached the errors I see in the console when starting up my jenkins server. Hope you can help me resolve this issue. 

          Daniel Beck added a comment -

          aqlive Jenkins does not support Java 9 and you're trying to run it on that. Don't do that.

          Daniel Beck added a comment - aqlive Jenkins does not support Java 9 and you're trying to run it on that. Don't do that.

          Oleg Nenashev added a comment -

          Yes, Java 9 is not supported. No ETA

          Oleg Nenashev added a comment - Yes, Java 9 is not supported. No ETA

          Oleg Nenashev added a comment -

          I will reopen it and add to the Java 9 EPIC

          Oleg Nenashev added a comment - I will reopen it and add to the Java 9 EPIC

          Daniel Beck added a comment - - edited

          oleg_nenashev Please note that the comment section was hijacked, this wasn't about Java 9. Whatever the issue description says might not be what's caused by Java 9.

          Daniel Beck added a comment - - edited oleg_nenashev Please note that the comment section was hijacked, this wasn't about Java 9. Whatever the issue description says might not be what's caused by Java 9.

          Oleg Nenashev added a comment -

          Created JENKINS-49737 as a follow-up

          Oleg Nenashev added a comment - Created JENKINS-49737 as a follow-up

          Oleg Nenashev added a comment -

          Right, there are Java 8 reports as well. Reverting my change in this ticket, but I am not going to triage it for Java 9 anyway

          Oleg Nenashev added a comment - Right, there are Java 8 reports as well. Reverting my change in this ticket, but I am not going to triage it for Java 9 anyway

          I'm facing same issue on startup screen only when I enter localhost:8080 and hit enter

          vishal shevale added a comment - I'm facing same issue on startup screen only when I enter localhost:8080 and hit enter

          Karthik N added a comment -

          I have started learning Jenkins, I too found the similar issues while trying to enter to "Config global security"

          Karthik N added a comment - I have started learning Jenkins, I too found the similar issues while trying to enter to " Config global security "

          Oleg Nenashev added a comment -

          karthik537 how do you use Jenkins? Do you run it in Apache Tomcat or other external web container?

          Oleg Nenashev added a comment - karthik537 how do you use Jenkins? Do you run it in Apache Tomcat or other external web container?

          oleg_nenashev I am also facing the same issue, I am trying to run Jenkins in Windows machine, whenever I try to access Jenkins before login I use to get this error. I am using Java 8 and windows 10. Let me know if you need any more info. 

          Subramanya Jagannath added a comment - oleg_nenashev I am also facing the same issue, I am trying to run Jenkins in Windows machine, whenever I try to access Jenkins before login I use to get this error. I am using Java 8 and windows 10. Let me know if you need any more info. 

          Oleg Nenashev added a comment -

          subbuhj I do not actively work on it at the moment. Somebody else might diagnose it, a fresh set of startup logs for the recent LTS would be helpful

          Oleg Nenashev added a comment - subbuhj I do not actively work on it at the moment. Somebody else might diagnose it, a fresh set of startup logs for the recent LTS would be helpful

          Sure .. thanks oleg_nenashev. I will be creating new ticket for this issue.

          Subramanya Jagannath added a comment - Sure .. thanks oleg_nenashev . I will be creating new ticket for this issue.

            Unassigned Unassigned
            gs0f40o0vseljgbjcxv2 Alex Fung
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: