rocketmq icon indicating copy to clipboard operation
rocketmq copied to clipboard

[ISSUE #7269]Fix broker initialization fails, TimerMessageStore#shutdown throws a NullPointerException

Open mxsm opened this issue 2 years ago • 5 comments
trafficstars

Which Issue(s) This PR Fixes

Fixes #7269

Brief Description

  • Fix broker initialization fails, TimerMessageStore#shutdown throws a NullPointerException

How Did You Test This Change?

mxsm avatar Aug 27 '23 07:08 mxsm

Codecov Report

Attention: Patch coverage is 36.66667% with 19 lines in your changes missing coverage. Please review.

Project coverage is 42.63%. Comparing base (f82718a) to head (3f9caed). Report is 302 commits behind head on develop.

Files Patch % Lines
...apache/rocketmq/store/timer/TimerMessageStore.java 36.66% 7 Missing and 12 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #7270   +/-   ##
==========================================
  Coverage      42.62%   42.63%           
+ Complexity      9459     9456    -3     
==========================================
  Files           1151     1151           
  Lines          82677    82688   +11     
  Branches       10773    10783   +10     
==========================================
+ Hits           35244    35255   +11     
+ Misses         43028    43016   -12     
- Partials        4405     4417   +12     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 27 '23 07:08 codecov-commenter

it's a little weird that I didn't reproduce it on my machine, seems that your broker didn't start as expected so it occurs NPE when shutting down according to your pr. Maybe you should try to catch the error log when starting rather than shutting down

@joeCarf Take a look at the configuration I provided in the ISSUE. This configuration has issues. When loading the storage file fails and returns false, the shutdown operation is triggered. However, at this point, certain variables in TimerMessageStore haven't been initialized, leading to a NullPointerException. It's reasonable to perform a shutdown of certain already started services due to the startup failure caused by errors. This part isn't problematic.

mxsm avatar Aug 27 '23 13:08 mxsm

it's a little weird that I didn't reproduce it on my machine, seems that your broker didn't start as expected so it occurs NPE when shutting down according to your pr. Maybe you should try to catch the error log when starting rather than shutting down

@joeCarf Take a look at the configuration I provided in the ISSUE. This configuration has issues. When loading the storage file fails and returns false, the shutdown operation is triggered. However, at this point, certain variables in TimerMessageStore haven't been initialized, leading to a NullPointerException. It's reasonable to perform a shutdown of certain already started services due to the startup failure caused by errors. This part isn't problematic.

I wonder in what circumstances the loading the storage file part will fail? Is the failure as expected? If not, I think the problem is not here

joeCarf avatar Aug 27 '23 13:08 joeCarf

ping @RongtongJin

mxsm avatar Sep 01 '23 15:09 mxsm

@RongtongJin This PR can be merged?

mxsm avatar Dec 24 '23 16:12 mxsm