Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-4585

Exception executing batch [could not perform addBatch] errors being logged

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Highest Highest
    • 5.0.6, 5.1.3, 4.4.6
    • 2.8.3, 2.11.0, 2.12.0, 3.0.1, 3.0.2, 3.2.0, 3.2.1, 3.2.3, 3.3.3, 3.7.1, 4.0.0, 4.1.0, 5.1.2
    • Database

      Said errors are appearing in our Crowd logs a bit. Not a massive amount, but 50-100 occurrences per day. Can't really tell if it's actually causing anything or not though.

      We migrated our user data from a Crowd 2.7.x version to 2.8.3 earlier, and these started appearing pretty much at that point.

      ERROR: duplicate key value violates unique constraint "uk_token_id_hash"
      Exception executing batch [could not perform addBatch]

      This seems more or less the same as https://confluence.atlassian.com/display/CROWDKB/Crowd+hanging+after+upgrade+to+2.7, and perhaps CWD-3688, although it was supposedly fixed in 2.7.1 (we are running 2.8.3).

      2015-12-09 02:04:56,760 ajp-bio-8011-exec-8447 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: 23505
      2015-12-09 02:04:56,760 ajp-bio-8011-exec-8447 ERROR [engine.jdbc.spi.SqlExceptionHelper] 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', 4708640468633722119, 'hVtW5FElx8qNjHjM06Kw8A00', 'P7bz06P1t18hRS4vJ0OCfg00', '2015-12-09 02:04:56.756000 +02:00:00', '2015-12-09 02:04:56.756000 +02:00:00', 1449619496756, 60, 5747171) was aborted.  Call getNextException to see the cause.
      2015-12-09 02:04:56,760 ajp-bio-8011-exec-8447 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: 23505
      2015-12-09 02:04:56,760 ajp-bio-8011-exec-8447 ERROR [engine.jdbc.spi.SqlExceptionHelper] ERROR: duplicate key value violates unique constraint "uk_token_id_hash"
        Detail: Key (identifier_hash)=(hVtW5FElx8qNjHjM06Kw8A00) already exists.
      2015-12-09 02:04:56,760 ajp-bio-8011-exec-8447 ERROR [jdbc.batch.internal.BatchingBatch] HHH000315: Exception executing batch [could not perform addBatch]
      
      2015-12-09 11:42:57,933 ajp-bio-8011-exec-8698 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: 23505
      2015-12-09 11:42:57,933 ajp-bio-8011-exec-8698 ERROR [engine.jdbc.spi.SqlExceptionHelper] 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, 'repo-hiq-fi-subversion', 1732528840858537267, 'NRNepD5oLeamwJtpub0tFQ00', '25P22OgqoPXQMBd3BK9Z7w00', '2015-12-09 11:42:57.924000 +02:00:00', '2015-12-09 11:42:57.924000 +02:00:00', 1449654177924, 60, 5747585) was aborted.  Call getNextException to see the cause.
      2015-12-09 11:42:57,933 ajp-bio-8011-exec-8698 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: 23505
      2015-12-09 11:42:57,933 ajp-bio-8011-exec-8698 ERROR [engine.jdbc.spi.SqlExceptionHelper] ERROR: duplicate key value violates unique constraint "uk_token_id_hash"
        Detail: Key (identifier_hash)=(NRNepD5oLeamwJtpub0tFQ00) already exists.
      2015-12-09 11:42:57,933 ajp-bio-8011-exec-8698 ERROR [jdbc.batch.internal.BatchingBatch] HHH000315: Exception executing batch [could not perform addBatch]
      

      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. 

            [CWD-4585] Exception executing batch [could not perform addBatch] errors being logged

            Renata Dornelas made changes -
            Remote Link Original: This issue links to "Page (Atlassian Documentation)" [ 483207 ]
            rtkachuk (Inactive) made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 783710 ]
            Bruno Rosa made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 771869 ]
            Pawel Cieszko made changes -
            Remote Link Original: This issue links to "KRAK-3669 (Bulldog)" [ 494050 ] New: This issue links to "KRAK-3669 (JIRA Server (Bulldog))" [ 494050 ]
            rtkachuk (Inactive) made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            SET Analytics Bot made changes -
            UIS Original: 157 New: 158
            SET Analytics Bot made changes -
            UIS Original: 158 New: 157
            SET Analytics Bot made changes -
            UIS Original: 155 New: 158
            SET Analytics Bot made changes -
            UIS Original: 152 New: 155
            rtkachuk (Inactive) made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 761744 ]

              Unassigned Unassigned
              9f14f721d3c4 Antti Pöllä
              Affected customers:
              37 This affects my team
              Watchers:
              66 Start watching this issue

                Created:
                Updated:
                Resolved: