Skip to content

Agroal doesn’t reset read only when returning connection to pool #47466

@rodcheater

Description

@rodcheater

Describe the bug

If we call setReadOnly(true) on a connection we get from Agroal then later on when that connection is reused we unexpectedly get SQL errors when attempting to write to the database.

Expected behavior

The read only state is reset to its original state when returning a connection to the pool.

Actual behavior

The read only state is not reset, leading to the pooled connection being in an unexpected state the next time it is used.

How to Reproduce?

Reproducer: quarkus-reproducer.zip

Steps to reproduce

  1. Run the attached reproducer.
  2. Navigate to http://localhost:8080/hello in a browser.
  3. Note that the app logs Connection is read only: false followed by Connection is read only: true as expected.
  4. Refresh the page in the browser.

Expected result

The app again logs Connection is read only: false followed by Connection is read only: true.

Actual result

The app instead logs Connection is read only: true followed by Connection is read only: true, showing that the read only state has not correctly been reset.

Output of uname -a or ver

Darwin Rods-MacBook-Pro.local 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:40 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6031 arm64

Output of java -version

openjdk version "21.0.6" 2025-01-21 OpenJDK Runtime Environment Homebrew (build 21.0.6) OpenJDK 64-Bit Server VM Homebrew (build 21.0.6, mixed mode, sharing)

Quarkus version or git rev

3.21.3

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.9

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions