RockteMQ-AI commented on issue #2287:
URL: 
https://github.com/apache/rocketmq-dashboard/issues/2287#issuecomment-5311670966

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Confirmed** | Severity: **High**
   
   The reported race condition has been verified against the codebase.
   
   **Root Cause:** `CloudCredentialService.create()` (line 66) calls 
`findByVendorAndAccessKey` then `save()` without `@Transactional`. Two 
concurrent requests with the same `(vendor, accessKey)` both pass the check, 
then the second insert hits the `uk_vendor_access_key` unique constraint 
(`schema.sql:228`) and throws an unhandled `DuplicateKeyException` → raw 500.
   
   **Compounding factors:**
   - No `@Transactional` on the create path, widening the race window
   - Repository `save()` uses `selectById` on a fresh UUID (always null for new 
records), always taking the insert path
   - Existing test only covers sequential duplicates, not concurrent ones
   
   **Fix direction:** Add `@Transactional` to the service method, catch 
`DuplicateKeyException` and return a structured 409 response, add concurrent 
regression test.
   
   An automated fix proposal can be generated. Reply `/approve` to proceed with 
PR generation.
   
   ---
   *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]

Reply via email to