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

Jenkins CLI: build command throws NPE when -s is used and the job is already in the execution queue

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • cli
    • None
    • Ubuntu 11.04

      A call to CLI build with -s, wait for completion will cause NPE if the JOB is already in queue.

      pjos@ubuntu:~/tmp$ java -jar jenkins-cli.jar -s http://192.168.0.191:8888/ build Jenkins
      pjos@ubuntu:~/tmp$ java -jar jenkins-cli.jar -s http://192.168.0.191:8888/ build Jenkins
      pjos@ubuntu:~/tmp$ java -jar jenkins-cli.jar -s http://192.168.0.191:8888/ build Jenkins -s
      java.lang.NullPointerException
      at hudson.cli.BuildCommand.run(BuildCommand.java:108)
      at hudson.cli.CLICommand.main(CLICommand.java:187)
      at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:82)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:274)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:255)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:215)
      at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:287)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:679)

          [JENKINS-11347] Jenkins CLI: build command throws NPE when -s is used and the job is already in the execution queue

          Spotted the same myself last night but hadn't got around to logging it. It is caused by job.scheduleBuild2 returning null.

          Future<? extends AbstractBuild> f = job.scheduleBuild2(0, new CLICause(), a);
          if (!sync)  return 0;
          
          AbstractBuild b = f.get();    // wait for the completion
          

          Richard Mortimer added a comment - Spotted the same myself last night but hadn't got around to logging it. It is caused by job.scheduleBuild2 returning null. Future<? extends AbstractBuild> f = job.scheduleBuild2(0, new CLICause(), a); if (!sync) return 0; AbstractBuild b = f.get(); // wait for the completion

          Marco Miller added a comment -

          Cannot reproduce (anymore?) when using jenkins master commit b8ace77.

          Marco Miller added a comment - Cannot reproduce (anymore?) when using jenkins master commit b8ace77.

          Jesse Glick added a comment -

          By the way a stack trace, especially of a NullPointerException, is useless without knowing what version of Jenkins you were running at the time, so we can correlate line numbers with sources.

          Jesse Glick added a comment - By the way a stack trace, especially of a NullPointerException , is useless without knowing what version of Jenkins you were running at the time, so we can correlate line numbers with sources.

          Nether can I reproduce that problem any more. Working as expected. Verified on version 1.536

          Pawel Josefsson added a comment - Nether can I reproduce that problem any more. Working as expected. Verified on version 1.536

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/53a8ab20287eb35ea7fdc3fc51e1b9c79aea455c
          Log:
          Pull #979: noting.
          JENKINS-11347 JENKINS-16692 might have been fixed by this, but unclear.

          Compare: https://github.com/jenkinsci/jenkins/compare/2771d233075e...53a8ab20287e

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html http://jenkins-ci.org/commit/jenkins/53a8ab20287eb35ea7fdc3fc51e1b9c79aea455c Log: Pull #979: noting. JENKINS-11347 JENKINS-16692 might have been fixed by this, but unclear. Compare: https://github.com/jenkinsci/jenkins/compare/2771d233075e...53a8ab20287e

            marcomiller Marco Miller
            pjos Pawel Josefsson
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: