apache / apache/rocketmq-dashboard

[Studio][Bug] Alert acknowledgement can diverge from active alert state

Open
#4,203 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 14h
Merged PRs (30d)
58

Description

### Description

`AlertService#acknowledgeAlert` persists two related pieces of state:

1. it marks the selected `rmq_system_alert` event as acknowledged; and
2. for the matching FIRING occurrence, it changes `rmq_alert_state` to ACKED.

The service method currently has no transaction boundary. If the second database write throws after the event update succeeds, the request fails but the event remains acknowledged while the active state remains FIRING. The state machine may then continue producing reminder notifications for an event that the UI already shows as acknowledged.

This is distinct from the expected stale-occurrence case where `AlertStateRepository#acknowledge` returns `false`: an old event may still be acknowledged without changing a newer incident. The inconsistent state here is caused by a persistence exception midway through the current occurrence update.

### Expected behavior

The event acknowledgement and matching active-state acknowledgement should commit or roll back atomically when both writes are attempted.

### Proposed fix

Add a transaction boundary to `AlertService#acknowledgeAlert` and cover both rollback-on-failure and successful retry with an H2-backed integration test.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with AlertService#acknowledgeAlert and trace the event update alongside AlertStateRepository#acknowledge. Use the H2-backed integration test setup to cover a persistence failure, confirming both writes roll back, then verify a successful retry commits both acknowledgements.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.