Two com.atproto.server.createAccount requests in the same millisecond produce the same signing key id. The second insert violates the unique constraint and the request returns 500 InternalError.
Steps #
Send several createAccount requests in parallel, each with their own handle and email, against a server with PDS_DID_PLC_URL set. Some will return:
{
"error": "InternalError",
"message": "internal error"
}
...and the server logs:
internal storage error error=insert signing_key: error returned from database: (code: 1555) UNIQUE constraint failed: signing_key.id
Cause #
I'm pretty confident it's this bit in crates/atproto-pds/src/account/manager.rs:
let signing_key_id = format!("sk-{}", chrono::Utc::now().timestamp_millis());
Seems like the timestamp isn't unique under concurrency. A UUID, TID, or an id derived from the DID should fix the issue.
Good find