Crowd logs indicate errors relating to uk_token_id_hash duplicate key violation, cannot perform addBatch
Problem
The following error messages are seen in the atlassian-crowd.log
files:
ERROR: duplicate key value violates unique constraint "uk_token_id_hash"
Exception executing batch [could not perform addBatch]
2020-03-16 14:54:11,520 http-nio-8095-exec-5 ERROR [jdbc.batch.internal.BatchingBatch] HHH000315: Exception executing batch [java.sql.BatchUpdateException: ORA-00001: unique constraint (ZSZ157P.UK_TOKEN_ID_HASH) violated
], SQL: insert into cwd_token (directory_id, entity_name, random_number, identifier_hash, random_hash, created_date, last_accessed_date, last_accessed_time, duration, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2020-03-16 14:54:11,521 http-nio-8095-exec-5 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 1, SQLState: 23000
2020-03-16 14:54:11,521 http-nio-8095-exec-5 ERROR [engine.jdbc.spi.SqlExceptionHelper] ORA-00001: unique constraint (ZSZ157P.UK_TOKEN_ID_HASH) violated
2020-03-16 14:54:11,521 http-nio-8095-exec-5 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 1, SQLState: 23000
2020-03-16 14:54:11,521 http-nio-8095-exec-5 ERROR [engine.jdbc.spi.SqlExceptionHelper] ORA-00001: unique constraint (ZSZ157P.UK_TOKEN_ID_HASH) violated
What does this error mean?
Crowd has just created a new session token for a user or an integrated application which has just authenticated, and it is trying to insert the token in the database. Unfortunately the database rejects the insertion because the "new" token violates a unique constraint on the token's identifier hash column.
Crowd will acknowledge that a faster insert of a new token has already happened, the contents of the cwd_token table have changed, and will reuse the other token that was inserted since they are equivalent. Because Crowd recovers from the failed insertion, this error does not cause any request to fail.
Workaround
Switch Crowd to use in-memory token management (not available in Crowd Data Center). Otherwise the error messages may be safely disregarded.
Issue is being tracked in CWD-4585 - Exception executing batch [could not perform addBatch] errors being logged