Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractAsyncExecutor modifications cause an NPE when Spring is used #109

Closed
rgreig opened this issue Dec 22, 2016 · 1 comment
Closed

Comments

@rgreig
Copy link

rgreig commented Dec 22, 2016

Using the latest 6.0.0 snapshot, I get an NPE when using the SpringAsyncExecutor, e.g.

Exception in thread "flowable-acquire-async-jobs" java.lang.NullPointerException
at org.flowable.engine.impl.asyncexecutor.DefaultAsyncJobExecutor.getRemainingCapacity(DefaultAsyncJobExecutor.java:254)
at org.flowable.engine.impl.asyncexecutor.AcquireAsyncJobsDueRunnable.run(AcquireAsyncJobsDueRunnable.java:53)
at java.lang.Thread.run(Thread.java:745)

I believe this is a result of the recent commit 3c22315 - pull request #44. It introduced two additional methods that are called from the start() method in AbstractAsyncExecutor:

  • initializeRunnables();
  • startAdditionalComponents();

The problem is that the SpringAsyncExecutor overrides initAsyncJobExecutionThreadPool() to do nothing, since it relies on the spring executor framework. However, startAdditionalComponents (which is not overridden) requires certain data structures to be initialised that would have been done in the initAsyncJobExecutionThreadPool method.

I have thrown together a "fix" which at least resolves the problem but it is a little bit messy - the SpringAsyncExecutor does need to ensure that the timer acquisition thread is created so it cannot simply override the startAdditionalComponents method to do nothing.

It does appear that the inheritance hierarchy is not really correct - should SpringAsyncExecutor really inherit from DefaultAsyncJobExecutor?

I am happy to submit a pull request with what I have done but not sure it is a great fix!

@tijsrademakers
Copy link
Contributor

Thanks for reporting the issue. It should be fixed now, and there's a unit test added to test this specific case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants