apache/druid · error · IllegalStateException
Could not create user [%s] due to concurrent update contenti
Error message
Could not create user [%s] due to concurrent update contention.
What it means
Thrown as IllegalStateException when createUserInternal exhausts all retries while trying to create a user in the authorizer user map via compare-and-swap. Concurrent modifications of the shared user map prevented the update from committing within the retry budget. This can also surface during startup via initSuperUsersAndGroupMapping.
Source
Thrown at extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authorization/db/updater/CoordinatorBasicAuthorizerMetadataStorageUpdater.java:669
}
private void createUserInternal(String prefix, String userName)
{
int attempts = 0;
while (attempts < numRetries) {
if (createUserOnce(prefix, userName)) {
return;
} else {
attempts++;
}
try {
Thread.sleep(ThreadLocalRandom.current().nextLong(UPDATE_RETRY_DELAY));
}
catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
}
throw new ISE("Could not create user [%s] due to concurrent update contention.", userName);
}
private void deleteUserInternal(String prefix, String userName)
{
int attempts = 0;
while (attempts < numRetries) {
if (deleteUserOnce(prefix, userName)) {
return;
} else {
attempts++;
}
try {
Thread.sleep(ThreadLocalRandom.current().nextLong(UPDATE_RETRY_DELAY));
}
catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
}View on GitHub (pinned to 9b90983fd2)
Solutions
- Verify a single coordinator leader is performing authorizer updates
- Reduce concurrent authorizer user-management traffic and retry the create
- Check metadata store health and latency
- Increase retry parameters or upgrade Druid if the contention pattern is known
Example fix
// before
client.createAuthorizerUser(authorizerName, userName); // ISE under contention
// after
try {
client.createAuthorizerUser(authorizerName, userName);
} catch (IllegalStateException e) {
backoffAndRetry(() -> client.createAuthorizerUser(authorizerName, userName));
} Defensive patterns
Strategy: retry
Validate before calling
// check existence first to avoid CAS churn
Response r = client.getAuthorizerUser(authorizerName, userName);
if (r.getStatus() == 200) { /* already exists */ return; } Try / catch
try {
client.createAuthorizerUser(authorizerName, userName);
} catch (IllegalStateException e) {
backoffAndRetry(() -> client.createAuthorizerUser(authorizerName, userName));
} Prevention
- Guarantee single-coordinator leadership for authorizer updates
- Avoid parallel authorizer user creation from multiple tools
- Watch metadata store health; slow stores increase CAS failure rates
When it happens
Trigger: Calling createUser on the authorizer storage updater (or cluster startup writing super-users) while other writers repeatedly change the same authorizer user map so every CAS fails.
Common situations: Multiple coordinators writing simultaneously (leadership ambiguity); concurrent admin/API user creation; slow or overloaded metadata store lengthening the contention window; init-time races when several nodes start with authorizer updates enabled.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Could not delete user [%s] due to concurrent update contenti
- Could not delete user[%s] due to concurrent update contentio
- Could not set credentials for user[%s] due to concurrent upd
- Could not create group mapping [%s] due to concurrent update
- Could not delete group mapping [%s] due to concurrent update
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/626e9babc2552044.
Report an issue: GitHub.