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

CLI restart command fails with NullPointerException in Jenkins.doRestart

    Details

    • Similar Issues:

      Description

      $ sudo "/usr/lib/jvm/java-1.8.0/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://aws-instance:8080 -i "/tmp/kitchen/cache/jenkins-key" restart
      
      ERROR: Unexpected exception occurred while performing restart command.
      java.lang.NullPointerException
      at jenkins.model.Jenkins.doRestart(Jenkins.java:4116)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4116
      The server has "StaplerResponse rsp == null".

      The issue does not appear with safe-restart, as nullity is checked on all variables
      https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4127

        Attachments

          Issue Links

            Activity

            yetanotherion Jon Alberdi created issue -
            yetanotherion Jon Alberdi made changes -
            Field Original Value New Value
            Description [https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4116]

            {code:java}
            $ sudo "/usr/lib/jvm/java-1.8.0/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://aws-instance:8080 -i "/tmp/kitchen/cache/jenkins-key" restart

            ERROR: Unexpected exception occurred while performing restart command.
            java.lang.NullPointerException
            at jenkins.model.Jenkins.doRestart(Jenkins.java:4116)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62){code}

            The server has the StaplerResponse rsp == null.

            The issue does not appear with safe-restart, as nullity is checked on all variables
            https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4127

            [https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4116]

            {code:java}
            $ sudo "/usr/lib/jvm/java-1.8.0/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://aws-instance:8080 -i "/tmp/kitchen/cache/jenkins-key" restart

            ERROR: Unexpected exception occurred while performing restart command.
            java.lang.NullPointerException
            at jenkins.model.Jenkins.doRestart(Jenkins.java:4116)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62){code}

            The server has "StaplerResponse rsp == null".

            The issue does not appear with safe-restart, as nullity is checked on all variables
            https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4127

            yetanotherion Jon Alberdi made changes -
            Description [https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4116]

            {code:java}
            $ sudo "/usr/lib/jvm/java-1.8.0/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://aws-instance:8080 -i "/tmp/kitchen/cache/jenkins-key" restart

            ERROR: Unexpected exception occurred while performing restart command.
            java.lang.NullPointerException
            at jenkins.model.Jenkins.doRestart(Jenkins.java:4116)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62){code}

            The server has "StaplerResponse rsp == null".

            The issue does not appear with safe-restart, as nullity is checked on all variables
            https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4127


            {code:java}
            $ sudo "/usr/lib/jvm/java-1.8.0/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://aws-instance:8080 -i "/tmp/kitchen/cache/jenkins-key" restart

            ERROR: Unexpected exception occurred while performing restart command.
            java.lang.NullPointerException
            at jenkins.model.Jenkins.doRestart(Jenkins.java:4116)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62){code}

            [https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4116]
            The server has "StaplerResponse rsp == null".

            The issue does not appear with safe-restart, as nullity is checked on all variables
            https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4127

            danielbeck Daniel Beck made changes -
            Assignee Daniel Beck [ danielbeck ]
            jglick Jesse Glick made changes -
            Link This issue relates to SECURITY-420 [ SECURITY-420 ]
            Hide
            jglick Jesse Glick added a comment -

            Probably harmless, as the restart has already been initiated, but would cause the noise and incorrect exit status on the command.

            To fix, prepend the original

            if (rsp != null) // null for CLI
            Show
            jglick Jesse Glick added a comment - Probably harmless, as the restart has already been initiated, but would cause the noise and incorrect exit status on the command. To fix, prepend the original if (rsp != null ) // null for CLI
            jglick Jesse Glick made changes -
            Component/s core [ 15593 ]
            Component/s cli [ 15624 ]
            Description
            {code:java}
            $ sudo "/usr/lib/jvm/java-1.8.0/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://aws-instance:8080 -i "/tmp/kitchen/cache/jenkins-key" restart

            ERROR: Unexpected exception occurred while performing restart command.
            java.lang.NullPointerException
            at jenkins.model.Jenkins.doRestart(Jenkins.java:4116)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62){code}

            [https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4116]
            The server has "StaplerResponse rsp == null".

            The issue does not appear with safe-restart, as nullity is checked on all variables
            https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4127

            {code:java}
            $ sudo "/usr/lib/jvm/java-1.8.0/bin/java" -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://aws-instance:8080 -i "/tmp/kitchen/cache/jenkins-key" restart

            ERROR: Unexpected exception occurred while performing restart command.
            java.lang.NullPointerException
            at jenkins.model.Jenkins.doRestart(Jenkins.java:4116)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62){code}

            [https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4116]
            The server has "StaplerResponse rsp == null".

            The issue does not appear with safe-restart, as nullity is checked on all variables
            https://github.com/jenkinsci/jenkins/blob/stable-2.46/core/src/main/java/jenkins/model/Jenkins.java#L4127

            Labels cli regression
            jglick Jesse Glick made changes -
            Labels cli regression cli lts-candidate regression
            jglick Jesse Glick made changes -
            Summary NPE in doRestart CLI restart command fails with NullPointerException in Jenkins.doRestart
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            core/src/main/java/jenkins/model/Jenkins.java
            http://jenkins-ci.org/commit/jenkins/83671af504197f031c1e89a5122a1d4168288bb4
            Log:
            [FIX JENKINS-44769] Don't access response when called from CLI

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/jenkins/model/Jenkins.java http://jenkins-ci.org/commit/jenkins/83671af504197f031c1e89a5122a1d4168288bb4 Log: [FIX JENKINS-44769] Don't access response when called from CLI
            scm_issue_link SCM/JIRA link daemon made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            core/src/main/java/jenkins/model/Jenkins.java
            http://jenkins-ci.org/commit/jenkins/c3b1bff6477e05050a40c0e20816bea9cf396534
            Log:
            Merge pull request #2912 from daniel-beck/JENKINS-44769

            [FIX JENKINS-44769] Don't access response when called from CLI

            Compare: https://github.com/jenkinsci/jenkins/compare/0b12bd3f7cc6...c3b1bff6477e

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/jenkins/model/Jenkins.java http://jenkins-ci.org/commit/jenkins/c3b1bff6477e05050a40c0e20816bea9cf396534 Log: Merge pull request #2912 from daniel-beck/ JENKINS-44769 [FIX JENKINS-44769] Don't access response when called from CLI Compare: https://github.com/jenkinsci/jenkins/compare/0b12bd3f7cc6...c3b1bff6477e
            olivergondza Oliver Gond┼ża made changes -
            Labels cli lts-candidate regression 2.60.2-fixed cli regression
            danielbeck Daniel Beck made changes -
            Link This issue is duplicated by JENKINS-44080 [ JENKINS-44080 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            core/src/main/java/jenkins/model/Jenkins.java
            http://jenkins-ci.org/commit/jenkins/28880329177a37ae04136ee1eca97c650b4acf6d
            Log:
            [FIX JENKINS-44769] Don't access response when called from CLI

            (cherry picked from commit 83671af504197f031c1e89a5122a1d4168288bb4)

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/jenkins/model/Jenkins.java http://jenkins-ci.org/commit/jenkins/28880329177a37ae04136ee1eca97c650b4acf6d Log: [FIX JENKINS-44769] Don't access response when called from CLI (cherry picked from commit 83671af504197f031c1e89a5122a1d4168288bb4)

              People

              • Assignee:
                danielbeck Daniel Beck
                Reporter:
                yetanotherion Jon Alberdi
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: