Conversation
…s deleted When a converge rule is deleted, renamed or disabled while its group cache still holds firing alerts, sendGroupAlert looked up the rule and dereferenced it without a null check. The NPE aborted the groupCacheMap iteration in runCheckAndSendGroups every check cycle, so every group ordered after the orphaned one stopped receiving converged alerts until the process restarted. Fall back to DEFAULT_REPEAT_INTERVAL, mirroring the null handling that shouldSendGroup already applies for the group wait and group interval. Signed-off-by: zjncs <18910855655@163.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed
When a converge rule is deleted, renamed or disabled while its group cache still holds firing alerts,
AlarmGroupReduce.sendGroupAlertlooks up the rule and dereferences it without a null check (hertzbeat-alerter/.../AlarmGroupReduce.java:294):refreshGroupDefinesclears and reloads only enabled rules (called on every rule add/update/delete fromAlertGroupConvergeServiceImpl), but entries ingroupCacheMapkeep theirgroupDefineName, so the lookup returns null for an orphaned group.Impact is worse than a one-off NPE:
runCheckAndSendGroupsiteratesgroupCacheMap.forEachand the NPE aborts the whole iteration each cycle (caught at the loop level), so every group ordered after the orphaned one stops receiving converged alerts, permanently, on every 1-second check cycle until restart.The sibling method
shouldSendGroupin the same file already null-checks the identical lookup forgroupWait/groupIntervaland falls back to defaults; this PR applies the same fallback torepeatInterval.Checklist
whenRuleDeleted_firingGroupCacheMustStillBeDispatchedinAlarmGroupReduceTest).mvn -pl hertzbeat-alerter -am test: 474 tests, 0 failures).Verification
java.lang.NullPointerException: Cannot invoke "AlertGroupConverge.getRepeatInterval()" because "ruleConfig" is nullatAlarmGroupReduce.java:294, logged byrunCheckAndSendGroups' catch, andinhibitAlarmis never invoked for the orphaned groupAlarmGroupReduceTesttests and the full alerter module suite pass (474 tests, 0 failures, 2 pre-existing skips)AI assistance disclosure: the bug analysis, fix and test in this PR were prepared with the help of an AI coding agent, and were verified locally by the author as described above.