Uploaded image for project: 'Red Hat build of Keycloak'
  1. Red Hat build of Keycloak
  2. RHBK-2657

PersistentSessionsWorker: retry with 0 backoff ms. [GHI#35047]

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Before reporting an issue

      [X] I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

      Area

      core

      Describe the bug

      We released keycloak 26 and functional and performance wise everything is good.

      However around once a day a duplicate insert session happens , which results in 20.000 error messages in a 10 second time frame.

      We have reduced this number by overwriting PersistentSessionsWorker, with a back-off time of 100ms instead of "0" (during 5 instead of 10) which is in the code:

      Retry.executeWithBackoff((iteration) ->

      { .... }

      , Duration.of(10L, ChronoUnit.SECONDS), 0);

      The duplicate itself concerns 1 specific session id (1 of the 10.000 ?) around once a day, and doesn't seem to be a functional big issue:

      HHH100501: Exception executing batch [java.sql.BatchUpdateException: Duplicate entry 'b9f91c53-ec37-4aaf-b54d-12f793c58d09-1' for key 'OFFLINE_USER_SESSION.PRIMARY'], SQL: insert into OFFLINE_USER_SESSION (BROKER_SESSION_ID,CREATED_ON,DATA,LAST_SESSION_REFRESH,REALM_ID,USER_ID,VERSION,OFFLINE_FLAG,USER_SESSION_ID) values (?,?,?,?,?,?,?,?,?)

      (repeated 20.000 times of same entry id.)

      Version

      26.0.2

      Regression

      [ ] The issue is a regression

      Expected behavior

      when retry a insert session statement or others, use a backoff time > 0ms to avoid a bulk of same error messages.

      Actual behavior

      To many error messages because of back-off delay 0ms.

      How to Reproduce?

      generate a sql exception (like duplicate insert).

      Anything else?

      No response

              Unassigned Unassigned
              pvlha Pavel Vlha
              Keycloak Core IAM
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: