Aias00 opened a new issue, #7635:
URL: https://github.com/apache/shenyu/issues/7635

   ## Problem
   
   In standalone Admin mode, transactional configuration changes can reach 
gateway sync listeners before the database transaction commits. If that 
transaction rolls back, gateways can retain a change that is absent from the 
database.
   
   Verified by source inspection at `b4e115367`; an application-level rollback 
reproduction is still required. Suggested priority: P1.
   
   ## Evidence and reproduction
   
   - 
[DataChangedEventDispatcher.onApplicationEvent](https://github.com/apache/shenyu/blob/b4e115367fd57adc8aba332d655b1009932ba394/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/DataChangedEventDispatcher.java#L76)
 registers `afterCommit` only when `clusterProperties.isEnabled()` is true. 
With clustering disabled, it calls `dispatch` immediately, even inside an 
active transaction.
   - 
[RuleServiceImpl.createOrUpdate](https://github.com/apache/shenyu/blob/b4e115367fd57adc8aba332d655b1009932ba394/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/RuleServiceImpl.java#L175)
 is transactional. Its create path calls `RuleEventPublisher.onCreated`, which 
[publishes DataChangedEvent 
synchronously](https://github.com/apache/shenyu/blob/b4e115367fd57adc8aba332d655b1009932ba394/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/publish/RuleEventPublisher.java#L190).
   - Existing dispatcher commit/rollback tests enable clustering, leaving 
standalone transactions uncovered.
   
   Regression scenario: disable clustering, start a real transaction, 
create/update a rule, then force rollback after event publication (or simulate 
a commit failure). No sync listener should receive the rolled-back 
configuration.
   
   ## Proposed scope
   
   Apply transaction-aware dispatch in both standalone and cluster modes. 
Retain immediate dispatch when no transaction is active. Keep master selection 
and event forwarding behavior separate from the transaction boundary. Do not 
broaden this fix into a general event-bus redesign.
   
   ## Acceptance criteria
   
   - [ ] Active transactions do not dispatch or forward configuration changes 
before commit, with clustering enabled or disabled.
   - [ ] Rollback produces no sync-listener or forwarded change.
   - [ ] Successful commit dispatches each event once; non-transactional events 
still dispatch immediately.
   - [ ] Existing master/non-master behavior remains covered.
   - [ ] Add focused standalone commit/rollback tests and a database-backed 
rollback regression for the rule mutation path.
   
   ## Related
   
   #7312 introduced the cluster forwarding/commit boundary. #6684 covered a 
previous discovery-specific publish-before-commit problem. This issue tracks 
the remaining standalone dispatcher behavior on current master.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to