Crowd application logs display "Duplicate key value violates unique constraint 'uk_token_id_hash' error messages"

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

Crowd application logs display messages related to a duplicate key error when inserting a record in the table cwd_token:

atlassian-crowd.log
2020-08-31 12:49:27,070 http-nio-8095-exec-184 ERROR [jdbc.batch.internal.BatchingBatch] HHH000315: Exception executing batch [java.sql.BatchUpdateException: Batch entry 0 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 (-1, 'jira-sso', 1746888137086717727, 'iiH8D8QKe870wPTXutR43g', 'J1RPQLcknVRpOggENbjVU___________amlyYS1zc28', '2020-08-31 12:49:27.057000+00', '2020-08-31 12:49:27.057000+00', 1598878167057, 60, 11438428) was aborted: ERROR: duplicate key value violates unique constraint "uk_token_id_hash"
  Detail: Key (identifier_hash)=(iiH8D8QKe870wPTXutR43g) already exists.
  Location: File: nbtinsert.c, Routine: _bt_check_unique, Line: 433
  Server SQLState: 23505  Call getNextException to see other errors in the batch.], 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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

環境

Crowd Server

診断

No side-effect is perceived on the application. The only symptom is those log messages.

原因

The cwd_token table is responsible for holding session information about users logged in Crowd. Whenever a user logs into Crowd, a new hash is inserted in that table to control the session timeout.

Those error messages don't point to an application error. It means that Crowd has just created a new session token for a user or an integrated application which have just authenticated, and it is trying to insert the token in the database. The database then rejects the insertion because the "new" token violates a unique constraint on the token's identifier hash column.

Crowd will just acknowledge that someone was faster, the contents of the cwd_token table have changed, and will reuse another existing token that someone has inserted since they are equivalent. Because Crowd recovers from the failed insertion, this error does not cause any request to fail.

ソリューション

We have two alternatives regarding those messages. We can either:

  • Ignore it, since it will not harm users or applications; or
  • Change the session storage to In-memory, instead of Database, as documented in Session configuration
最終更新日 2020 年 9 月 3 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.