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

SQL error when logging in for first time (per user) after Keycloak upgrade [GHI#40171]

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

      After upgrading from an older version to Keycloak 26.2.5, there is a step where the password is upgraded from the past format to argon2.

      When the user tries to login they get an "Internal server error" message and in the Keycloak logs I see:
      Caused by: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; statement executed: update CREDENTIAL set CREATED_DATE=?,CREDENTIAL_DATA=?,PRIORITY=?,SALT=?,SECRET_DATA=?,TYPE=?,USER_ID=?,USER_LABEL=?,VERSION=? where ID=? and VERSION=?

      If they retry the login again, they're logged in and the password is upgraded.

      Version

      26.2.5

      Regression

      [x] The issue is a regression

      Expected behavior

      I would expect the user to be logged in and the password upgrade to happen seamlessly.

      Actual behavior

      The first login attempt fails, the second login attempt succeeds.

      How to Reproduce?

      Upgrade from a much older version of Keycloak (using stepped upgrades between major changes like the move from Wildfly to Quarkus and then first Quarkus to latest Quarkus), and try to login.

      Anything else?

      No response

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

                Created:
                Updated:
                Resolved: