Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-16405

JDBC connection confusion when transaction is suspended

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 26.1.1.Final
    • JCA
    • None
    • ---
    • ---

    Description

      WildFly gets confused about what JDBC connection to use when an application does the following on a single thread:

      1. Start a transaction.
      2. Get a JDBC connection.
      3. Suspend the transaction.
      4. Start a new transaction.
      5. Get a JDBC connection.

      Since there are two independent transactions, the connection at step 5 should be a different connection than the connection at step 2, but isn't. The WrappedConnectionJDK8 wrapper is a different instance, but the underlying physical connection is the same.

      I've attached a simple reproducer project that demonstrates the problem. You can run it with the stock standalone.xml configuration. H2 will report the same session (connection) ID for both transactions.

      This also affects higher-level functionality like JPA, but the default Hibernate configuration aggressively releases connections, which hides the problem. The problem will occur if using a different JPA provider (I discovered this in an application using EclipseLink) or if Hibernate is used and the "hibernate.connection.release_mode" persistence unit property is set to "ON_CLOSE".

      Attachments

        Activity

          People

            tadamski@redhat.com Tomasz Adamski
            rdicroce Richard DiCroce (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: