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

Logging errors on DB transaction retries [GHI#36728]

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • RHBK-2757 - Release Red Hat Build of KeyCloak

      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

      When retrying a transaction, Keycloak logs an error. This due to the JpaTransactionWrapper violating the either-lor-or-throw best practice, as it does both log AND throw.

      https://github.com/keycloak/keycloak/issues/35047#issuecomment-2608455509

      2025-01-22 14:25:47,058 ERROR [org.keycloak.transaction.JtaTransactionWrapper] (org.keycloak.models.sessions.infinispan.changes.PersistentSessionsWorker$BatchWorker) Exception during transaction operation. Request context: Non-HTTP task, Transaction: TransactionImple < ac, BasicAction: 0:ffff0afe0012:acd9:678a1500:12386 status: ActionStatus.ABORTED >
      

      Version

      main

      Regression

      [ ] The issue is a regression

      Expected behavior

      An exception should be either thrown or logged, but not both. Logging additional information in debug mode would be ok

      Actual behavior

      It is both logged as an error and thrown.

      How to Reproduce?

      See log

      Anything else?

      I'll prepare a PR

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

                Created:
                Updated:
                Resolved: