youngkermit8-coder opened a new issue, #2374: URL: https://github.com/apache/rocketmq-dashboard/issues/2374
### Description `InstanceService.createInstance` checks `findByName` before saving, while `rmq_instance.name` is also protected by the `uk_instance_name` unique index. The application precheck and database insert are separate operations. Two concurrent requests for the same instance name can both pass `requireUniqueInstanceName`. One insert succeeds and the other raises Spring's `DuplicateKeyException`. Because that exception is not translated by the service, `GlobalExceptionHandler` returns HTTP 500 instead of a resource-conflict response. This is distinct from #1925, which covers duplicate IDs in the frontend mock service rather than database-backed instance names. ### Reproduction 1. Start two database-backed instance-create requests with the same normalized name. 2. Allow both requests to complete their name lookup before either insert commits. 3. The first insert succeeds. 4. The second insert violates `uk_instance_name` and currently surfaces as HTTP 500. The same duplicate detected by the precheck currently returns 400, so the response also depends on request timing. ### Expected behavior Both an existing-name precheck and a concurrent unique-index violation should return HTTP 409 with the existing safe message `Instance name already exists: <name>`. No database exception details should reach the client. ### Scope Limit the change to duplicate database-backed instance creation and add regression coverage for the database-race loser. -- 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]
