Mikhail Cherkasov created IGNITE-5773:
-----------------------------------------

             Summary: Scheduler throwing NullPointerException
                 Key: IGNITE-5773
                 URL: https://issues.apache.org/jira/browse/IGNITE-5773
             Project: Ignite
          Issue Type: Bug
    Affects Versions: 2.0
         Environment: Oracle Hotspot 1.8_121
Ignite 2.0.0
Springmix 4.3.7

            Reporter: Mikhail Cherkasov
            Assignee: Alexey Goncharuk
            Priority: Critical
             Fix For: 2.1


NPE occurs during deploying a service as cluster singleton. Ignite scheduler is 
used as a cron for this purpose, however NPE occurs for ignite version 2.0.0.

Below is the log information for the exception:

2017-06-06 13:21:08 ERROR GridServiceProcessor:495 - Failed to initialize 
service (service will not be deployed): AVxezSbWNphcxa1CYjfP
java.lang.NullPointerException
        at 
org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.schedule(ScheduleFutureImpl.java:299)
        at 
org.apache.ignite.internal.processors.schedule.IgniteScheduleProcessor.schedule(IgniteScheduleProcessor.java:56)
        at 
org.apache.ignite.internal.IgniteSchedulerImpl.scheduleLocal(IgniteSchedulerImpl.java:109)
        at 
com.mypackage.state.services.MyService.startScheduler(MyService.scala:172)
        at com.mypackage.state.services.MyService.init(MyService.scala:149)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor.redeploy(GridServiceProcessor.java:1097)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor.processAssignment(GridServiceProcessor.java:1698)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor.onSystemCacheUpdated(GridServiceProcessor.java:1372)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor.access$300(GridServiceProcessor.java:117)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor$ServiceEntriesListener$1.run0(GridServiceProcessor.java:1339)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor$DepRunnable.run(GridServiceProcessor.java:1753)
        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)
2017-06-06 13:21:08:868 ERROR application - Unable to initialise GRID:
class org.apache.ignite.IgniteException: null
        at 
org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:949)
        at 
org.apache.ignite.internal.IgniteServicesImpl.deployClusterSingleton(IgniteServicesImpl.java:122)
        at 
com.mypackage.state.mypackage1.InitialiseGrid$$anonfun$apply$1.apply(InitialiseGrid.scala:22)
        at 
com.mypackage.state.mypackage1.InitialiseGrid$$anonfun$apply$1.apply(InitialiseGrid.scala:19)
        at 
scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
        at 
com.mypackage.state.mypackage1.InitialiseGrid$.apply(InitialiseGrid.scala:19)
        at com.mypackage.state.Application$.main(Application.scala:54)
        at com.mypackage.state.Application.main(Application.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sbt.Run.invokeMain(Run.scala:67)
        at sbt.Run.run0(Run.scala:61)
        at sbt.Run.sbt$Run$$execute$1(Run.scala:51)
        at sbt.Run$$anonfun$run$1.apply$mcV$sp(Run.scala:55)
        at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
        at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
        at sbt.Logger$$anon$4.apply(Logger.scala:85)
        at sbt.TrapExit$App.run(TrapExit.scala:248)
        at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteCheckedException: null
        at 
org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7242)
        at 
org.apache.ignite.internal.util.future.GridFutureAdapter.resolve(GridFutureAdapter.java:258)
        at 
org.apache.ignite.internal.util.future.GridFutureAdapter.get0(GridFutureAdapter.java:189)
        at 
org.apache.ignite.internal.util.future.GridFutureAdapter.get(GridFutureAdapter.java:139)
        at 
org.apache.ignite.internal.AsyncSupportAdapter.saveOrGet(AsyncSupportAdapter.java:112)
        at 
org.apache.ignite.internal.IgniteServicesImpl.deployClusterSingleton(IgniteServicesImpl.java:119)
        ... 20 more
Caused by: java.lang.NullPointerException
        at 
org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.schedule(ScheduleFutureImpl.java:299)
        at 
org.apache.ignite.internal.processors.schedule.IgniteScheduleProcessor.schedule(IgniteScheduleProcessor.java:56)
        at 
org.apache.ignite.internal.IgniteSchedulerImpl.scheduleLocal(IgniteSchedulerImpl.java:109)
        at 
com.mypackage.state.services.MyService.startScheduler(MyService.scala:172)
        at com.mypackage.state.services.MyService.init(MyService.scala:149)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor.redeploy(GridServiceProcessor.java:1097)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor.processAssignment(GridServiceProcessor.java:1698)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor.onSystemCacheUpdated(GridServiceProcessor.java:1372)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor.access$300(GridServiceProcessor.java:117)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor$ServiceEntriesListener$1.run0(GridServiceProcessor.java:1339)
        at 
org.apache.ignite.internal.processors.service.GridServiceProcessor$DepRunnable.run(GridServiceProcessor.java:1753)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        ... 1 more

This exception occurs right on start up when try to add a services to the cron.

The scheduler from example us used: 
https://apacheignite.readme.io/docs/cron-based-scheduling .

Below is the example, similar to the issue raised by another user, link for the 
reference 
(http://apache-ignite-users.70518.x6.nabble.com/Fwd-NPE-at-ScheduleFutureImpl-line-177-td13435.html

private def startScheduler() = {
   ignite.scheduler.scheduleLocal(new Runnable() {
      override def run() =
         try {
            Logger.info("Tick tock")
            /** Do Stuff! */
         }
         catch { case e:Exception => Logger.error("I poked, I failed!", e) }
   }, "* * * * *")}  

I think the scheduler processor does not match the expected processor
interface. This results to a bad state.

IgniteKernal is responsible to start each processors :
org.apache.ignite.internal.IgniteKernal.startProcessor(GridProcessor):
proc.start(cfg.isActiveOnStart());

But the
org.apache.ignite.internal.processors.schedule.IgniteScheduleProcessor does
not implement it (missing boolean parameter) :

    /** {@inheritDoc} */
    @Override public void start() throws IgniteCheckedException {
        sched = new Scheduler();
        sched.start();
    }

That's why the default (empty) impl is used. And the "sched" attribute stay
null.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to