RockteMQ-AI commented on issue #2914: URL: https://github.com/apache/rocketmq-dashboard/issues/2914#issuecomment-5498234607
**Issue Evaluation** Category: `bug` | Status: **Confirmed** | Severity: **Medium** The reported race condition has been verified against `MybatisPlusCloudCredentialRepository.save()`. **Root Cause:** The check-then-act pattern (`selectById` → `insert`/`updateById`) is not atomic. When an update request races with deletion: 1. Thread A loads credential with id=N 2. Thread B deletes credential id=N 3. Thread A calls `save()` → `selectById(N)` returns null → falls through to `insert(entity)` with the stale id 4. The deleted row is recreated **Impact:** Cloud credentials (and potentially certificates if similar pattern exists) can be resurrected after deletion under concurrent access. **Suggested Fix:** Use database-level constraints or change the logic: when `id != null`, always attempt `updateById` first; only insert when `id == null`. A zero-row update should return a conflict error rather than falling through to insert. --- *Automated evaluation by RockteMQ-AI* -- 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]
