PostgreSQL へのコネクションの問題によって Jira でスレッドがスタックする
Setting socketTimeoutException
is no longer advised as it may cause problems with longer database queries that Jira may perform, for example during upgrade tasks (please see: - JRASERVER-74314Getting issue details... STATUS ) This property will no longer be added to database configuration since Jira 9.4 and will be ignored for existing configurations.
特定のネットワーク セットアップにおいて、PostgreSQL データベースへのコネクションの問題によって Jira スレッドがスタックする場合があります。これは通常は、データベースからのレスポンスが Jira に渡されず、Jira がアクションの完了を待ち続ける場合に発生します。修正策は、指定した時間の経過後に各コネクションを終了するプロパティを手動で追加することです。
コンテキスト
We’ve encountered this problem only with the PostgreSQL database and specific network setup, where you have proxies between Jira and the database. The reason for it is that data packets sent from Jira to the database are lost, and the response is never returned by the proxy, which results in stuck threads.
Usually, with problems with the database, the connection would be terminated before that happens, but in these conditions it seems like the database is still performing the action Jira is waiting for. See related issue (fixed in 8.16)
ソリューション
この問題を解決するには、次の手順を実行します。
PostgreSQL の JDBC ドライバを 42.2.19 以降にアップグレードします。このドライバは、以降の手順で追加するプロパティをより良く処理できます。
- https://jdbc.postgresql.org/ からドライバをダウンロードします。
- Jira を停止します。
- 新しいドライバを
<jira-install>/lib
にコピーします。 - 古いものを取り除きます。
- Jira の起動
Edit the
dbconfig.xml
file, and add the following properties between the<jdbc-datasource> or
<jdbc-resource>
tags, see example below:( This file (located at the root of your JIRA home directory) defines all details for JIRA's database connection. This file is typically created by running the JIRA setup wizard on new installations of JIRA, or by configuring a database connection using the JIRA configuration tool.)-
<jira-database-config> ... <jdbc-datasource> ... <connection-properties>tcpKeepAlive=true;socketTimeout=240</connection-properties> </jdbc-datasource> </jira-database-config>
tcpKeepAlive:コネクションが引き続き実行されているかどうかを確認します。
socketTimeout:指定された時間 (秒) の経過後にコネクションを終了します。4 分は保守的な値であり、長時間かかる SQL クエリを実行することが多い場合は値を増やすことができます。
Jira を再起動します。
PostgreSQL の JDBC ドライバのバージョン
ドライバのバグにより、socketTimeout コネクション プロパティが適切に適用されていませんでした。バージョン 42.2.15 (2020-08-14) には次のバグ修正が含まれます。
- PostgreSQL JDBC Driver change log の "Make sure socketTimeout is enforced PR 1831, 210b27a6"
さらに、42.2.19 よりも前の JDBC バージョンでは、SocketTimeoutException が無視されるためにタイムアウトが期待どおり動作しないバグが存在します。バージョン 42.2.19 (2021-02-18) には次のバグ修正が含まれます。
- "properly set cancel socket timeout PR 2044 e551d1a6" from the PostgreSQL JDBC Changelog
socketTimeout コネクション プロパティが期待どおりに動作するよう、バージョン 42.2.19 以降を利用するようにしてください。