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

          Pawel Josefsson created issue -
          Pawel Josefsson made changes -
          Description Original: A call to CLI build with -s, wait for complitionm 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)
          New: 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)

          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 made changes -
          Assignee New: Marco Miller [ marcomiller ]
          Marco Miller made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          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.
          Marco Miller made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-16692 [ JENKINS-16692 ]

          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

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

              Created:
              Updated:
              Resolved: