Translated message

A translation of this page exists in English.

DB のフェイルオーバーが発生したときにデータソースの回復に時間がかかりすぎる

Solution In Progress - Updated -

Issue

DB サーバーが突然ダウンし、RST パケットを送信せずにフェイルオーバーした場合 (例: AWS RDS)、データソースにプールされた JDBC 接続が、破損した状態のままになりますが、プールから削除されません。
アプリケーションが次回これらの接続を使用しようとしたときに、タイムアウトエラーが発生して失敗します。

これを防ぐために、Quarkus データソースは、バックグラウンド (quarkus.datasource.jdbc.background-validation-interval) または接続がプールからプルされたとき (quarkus.datasource.jdbc.validate-on-borrow) における接続の検証をサポートしています。
しかし、現在の実装では、検証クエリーにクエリータイムアウトが設定されていないため、標準のソケットタイムアウトに達するまで待機することになります。

 Apr 01 11:02:09 rhbk kc.sh[1786]: 2025-04-01 11:02:09,862 WARN  [io.quarkus.agroal.runtime.DataSources] (org.keycloak.models.sessions.infinispan.changes.PersistentSessionsWorker$BatchWorker) Connection validation failed: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:399)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:517)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:434)

[omitted]

Apr 01 11:02:09 rhbk kc.sh[1786]: Caused by: java.net.SocketTimeoutException: Read timed out
Apr 01 11:02:09 rhbk kc.sh[1786]:         at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:288)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:314)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:355)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:808)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:192)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:159)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:144)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:76)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.core.PGStream.receiveChar(PGStream.java:476)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2174)
Apr 01 11:02:09 rhbk kc.sh[1786]:         at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372)
Apr 01 11:02:09 rhbk kc.sh[1786]:         ... 52 more

Environment

  • Red Hat build of Keycloak (RHBK)
    • 22.0
    • 24.0
    • 26.0
  • Red Hat build of Quarkus (RHBQ)
    • 3.15

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content