Uploaded image for project: 'Livy (READ-ONLY)'
  1. Livy (READ-ONLY)
  2. LIVY-236

Job API throws NPE when return value is Void (null)

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.3
    • Fix Version/s: 0.3
    • Component/s: API
    • Labels:
      None

      Description

      Job API will throw NPE if return value is explicitly defined as Void and return null. Void should be expected since some Jobs actually doesn't require returned value.

        java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at com.cloudera.livy.client.http.JobHandleImpl.get(JobHandleImpl.java:201)
        at com.cloudera.livy.client.http.JobHandleImpl.get(JobHandleImpl.java:101)
        at com.cloudera.livy.test.JobApiIT.com$cloudera$livy$test$JobApiIT$$waitFor(JobApiIT.scala:295)
        at com.cloudera.livy.test.JobApiIT$$anonfun$13.apply$mcV$sp(JobApiIT.scala:219)
        at com.cloudera.livy.test.JobApiIT$$anonfun$13.apply(JobApiIT.scala:210)
        at com.cloudera.livy.test.JobApiIT$$anonfun$13.apply(JobApiIT.scala:210)
        at org.scalatest.Transformer$$anonfun$apply$1.apply$mcV$sp(Transformer.scala:22)
        at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
        at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
        at org.scalatest.Transformer.apply(Transformer.scala:22)
        ...
        Cause: java.lang.NullPointerException:
        at java.nio.ByteBuffer.wrap(ByteBuffer.java:396)
        at com.cloudera.livy.client.http.JobHandleImpl$JobPollTask.run(JobHandleImpl.java:239)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        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)
        ...
      

      To reproduce this issue, job implementation could be:

      val job = new Job[Void] {
            override def call(jc: JobContext): Void = {
              null
            }
          }
      
          val result = waitFor(client2.submit(job))
      

        Attachments

          Activity

            People

            • Assignee:
              jerryshao Saisai Shao
              Reporter:
              jerryshao Saisai Shao
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: