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

   **Issue Evaluation**
   
   Category: `bug` | Status: **Confirmed**
   
   The reported issue is valid. `InstanceService.createInstance` performs a 
`findByName` precheck and a separate database insert. These are not atomic, so 
two concurrent requests with the same name can both pass the precheck. The 
loser hits `DuplicateKeyException` from the `uk_instance_name` unique index, 
which is not caught and translated, resulting in HTTP 500 instead of HTTP 409.
   
   **Root Cause:** TOCTOU race between name uniqueness precheck and insert; 
unhandled `DuplicateKeyException`.
   **Impact:** Inconsistent error responses depending on timing; leaks internal 
DB exception details.
   **Severity:** Medium
   
   The proposed fix (catch `DuplicateKeyException` and return HTTP 409 with the 
existing safe message) is correct and minimal.
   
   An automated fix proposal can be generated. Reply `/approve` to proceed with 
PR generation.
   
   ---
   *Automated evaluation by github-manager*
   


-- 
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