puniverse / quasar

Fibers, Channels and Actors for the JVM
http://docs.paralleluniverse.co/quasar/
Other
4.56k stars 575 forks source link

NullPointException throw in co.paralleluniverse.strands.concurrent.ReentrantLock.lock() invokation #315

Closed kimffy24 closed 4 years ago

kimffy24 commented 5 years ago

[ERROR] Failed to execute the taskContinueAction, asyncActionName: PublishEventAsync, contextInfo: [eventStream: [messageId=2d2d4bf920ed3ffff5825e7d8, commandId=2abc4bf920ed3ffff5825b878, aggregateRootId=4ffc3bf920e6d5fef7e3753b8, aggregateRootTypeName=pro.jiefzz.ejoker.demo.simple.transfer.domain.bankAccount.BankAccount, version=3, events=pro.jiefzz.ejoker.demo.simple.transfer.domain.bankAccount.domainEvents.TransactionPreparationAddedEvent|, items=CommandReplyAddress:null|]] java.lang.NullPointerException at co.paralleluniverse.strands.Strand.park(Strand.java:536) at co.paralleluniverse.strands.concurrent.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:838) at co.paralleluniverse.strands.concurrent.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:872) at co.paralleluniverse.strands.concurrent.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1203) at co.paralleluniverse.strands.concurrent.ReentrantLock$NonfairSync.lock(ReentrantLock.java:207) at co.paralleluniverse.strands.concurrent.ReentrantLock.lock(ReentrantLock.java:285) at com.jiefzz.ejoker.commanding.ProcessingCommandMailbox.completeMessage(ProcessingCommandMailbox.java:129) at com.jiefzz.ejoker.commanding.ProcessingCommandMailbox.completeMessageAsync(ProcessingCommandMailbox.java:123) at com.jiefzz.ejoker.eventing.impl.DefaultEventService.completeCommandAsync(DefaultEventService.java:513) at com.jiefzz.ejoker.eventing.impl.DefaultEventService.lambda$publishDomainEventAsync$31(DefaultEventService.java:482) at com.jiefzz.ejoker.z.common.io.IOHelper.taskContinueAction(IOHelper.java:162) at com.jiefzz.ejoker.z.common.io.IOHelper.tryAsyncAction2(IOHelper.java:108) at com.jiefzz.ejoker.z.common.io.IOHelper.tryAsyncAction2(IOHelper.java:90) at com.jiefzz.ejoker.eventing.impl.DefaultEventService.publishDomainEventAsync(DefaultEventService.java:468) at com.jiefzz.ejoker.eventing.impl.DefaultEventService.publishDomainEventAsync(DefaultEventService.java:152) at com.jiefzz.ejoker.eventing.impl.DefaultEventService.lambda$null$11(DefaultEventService.java:236) at com.jiefzz.ejoker.z.common.task.context.AbstractNormalWorkerGroupService.lambda$submitInternal$0(AbstractNormalWorkerGroupService.java:65) at com.jiefzz.equasar.QuasarFiberExector.lambda$execute$bdec3e64$1(QuasarFiberExector.java:118) at co.paralleluniverse.fibers.Fiber.run(Fiber.java:1097) at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) at co.paralleluniverse.fibers.FiberForkJoinScheduler$FiberForkJoinTask.exec1(FiberForkJoinScheduler.java:271) at co.paralleluniverse.concurrent.forkjoin.ParkableForkJoinTask.doExec(ParkableForkJoinTask.java:117) at co.paralleluniverse.concurrent.forkjoin.ParkableForkJoinTask.exec(ParkableForkJoinTask.java:74) at jsr166e.ForkJoinTask.doExec(ForkJoinTask.java:261) at jsr166e.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:902) at jsr166e.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:995) at jsr166e.ForkJoinPool.runWorker(ForkJoinPool.java:1628) at jsr166e.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

The Scene is producer send a message and this message should be handled and should be confirmed. All the process of handling and confirm are in Fiber's context, And every processing are all in different Fiber. Now this Error occur in confirm process.

In com.jiefzz.ejoker.commanding.ProcessingCommandMailbox.completeMessage(ProcessingCommandMailbox.java:129) I invoke ReentrantLock.lock. There a NullPointException throws while in concurrent execution.

lock object declare in https://github.com/kimffy24/EJoker/blob/quasar2/src/main/java/com/jiefzz/ejoker/commanding/ProcessingCommandMailbox.java#L35 lock only use at https://github.com/kimffy24/EJoker/blob/quasar2/src/main/java/com/jiefzz/ejoker/commanding/ProcessingCommandMailbox.java#L129

kimffy24 commented 4 years ago

I found thad NPE will throw while an uninstrumented method invoke an instrumented method and Fiber.park() is called in the instrumented method.