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

NullPointerException on Shutdown without Start #2481

Closed
nils-christian opened this issue Nov 11, 2022 · 3 comments
Closed

NullPointerException on Shutdown without Start #2481

nils-christian opened this issue Nov 11, 2022 · 3 comments
Assignees
Labels
Priority 3: Could Low priority. Issues that are nice to have but have a straightforward workaround. Status: Resolved Use to signal that work on this issue is done. Type: Bug Use to signal issues that describe a bug within the system.
Milestone

Comments

@nils-christian
Copy link
Contributor

Hi,

We noticed an interesting behaviour of (at least) the MessageHandlerRegistrar which fails with a NPE when it is stopped but not started.

Basic information

  • Axon Framework version: 4.6.2
  • JDK version: 11
  • Complete executable reproducer if available (e.g. GitHub Repo):
final Configuration configuration = DefaultConfigurer
		.defaultConfiguration( )
		.registerQueryHandler( c -> new Object( ) )
		.buildConfiguration( );
configuration.shutdown( );

Steps to reproduce

Please take a look at the above code.

Expected behaviour

The shutdown should - in my opinion - never fail with a NPE, even if it has never been started. Either make sure that the components can handle this (no exception at all) or make sure that shutdown can not be called without being started first (IllegalStateException with clear message).

Actual behaviour

The shutdown fails with a NullPointerException in MessageHandlerRegistrar.

@nils-christian nils-christian added the Type: Bug Use to signal issues that describe a bug within the system. label Nov 11, 2022
smcvb added a commit that referenced this issue Nov 11, 2022
Check if the registration is non-null before invoking shutdown, as this
may cause a NullPointerException. If it is null, log an info level
message stating this situation.

#2481
@smcvb smcvb added Priority 3: Could Low priority. Issues that are nice to have but have a straightforward workaround. Status: In Progress Use to signal this issue is actively worked on. labels Nov 11, 2022
@smcvb
Copy link
Member

smcvb commented Nov 11, 2022

Definitely a caveat, but a good catch regardless.
Luckily the fix is easy as well.

I do notice that the Configuration#shutdown will swallow the exception into a warning log statement.
It does so to keep shutting down, instead of breaking the system mid-shutdown.
Nonetheless, the exception is unhelpful noise that should not be generated.

@smcvb
Copy link
Member

smcvb commented Nov 11, 2022

And I created a PR for it.

smcvb added a commit that referenced this issue Nov 11, 2022
Remove undesired test case

#2481
smcvb added a commit that referenced this issue Nov 28, 2022
[#2481] Check `MessageHandlerRegistrar` registration to be non-null
@smcvb
Copy link
Member

smcvb commented Dec 2, 2022

Closing this issue, since it's resolved in pull request #2482.

@smcvb smcvb closed this as completed Dec 2, 2022
@smcvb smcvb added Status: Resolved Use to signal that work on this issue is done. and removed Status: In Progress Use to signal this issue is actively worked on. labels Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority 3: Could Low priority. Issues that are nice to have but have a straightforward workaround. Status: Resolved Use to signal that work on this issue is done. Type: Bug Use to signal issues that describe a bug within the system.
Projects
None yet
Development

No branches or pull requests

2 participants