From 89988a60c9b79fccf890e291d6a796ff429421cd Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 20 Jul 2022 14:41:15 -0400 Subject: [PATCH] Update postgres connections to use tcpKeepAlive and socketTimeout This fixes potential stuck threads in "some situations", as documented by Atlassian here: https://confluence.atlassian.com/jirakb/connection-problems-to-postgresql-result-in-stuck-threads-in-jira-1047534091.html --- Dockerfile | 2 +- bin/launch.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 55733c4..754070b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,7 +57,7 @@ RUN export GLIBC_VERSION=2.29-r0 \ && export MYSQL_FILE_TAR=$MYSQL_FILE_BASE.tar.gz \ && export MYSQL_FILE_BIN=$MYSQL_FILE_BASE-bin.jar \ && export MYSQL_DOWNLOAD_URL=https://dev.mysql.com/get/Downloads/Connector-J/$MYSQL_FILE_TAR \ - && export POSTGRESQL_DRIVER_VERSION=42.2.5 \ + && export POSTGRESQL_DRIVER_VERSION=42.4.0 \ && export POSTGRESQL_FILE=postgresql-$POSTGRESQL_DRIVER_VERSION.jar \ && export POSTGRESQL_DOWNLOAD_URL=https://jdbc.postgresql.org/download/$POSTGRESQL_FILE \ && rm -f $JIRA_LIB/mysql-connector-java*.jar \ diff --git a/bin/launch.sh b/bin/launch.sh index 491f4d6..0b115b7 100755 --- a/bin/launch.sh +++ b/bin/launch.sh @@ -24,6 +24,10 @@ if [ -n "$JIRA_DATABASE_URL" ]; then if [ "$JIRA_DB_TYPE" == "mssql" ]; then SCHEMA='dbo' fi + case $JIRA_DB_TYPE in postgres*) + # see https://confluence.atlassian.com/jirakb/connection-problems-to-postgresql-result-in-stuck-threads-in-jira-1047534091.html + PG_CONN_PROPERTIES="tcpKeepAlive=true;socketTimeout=240" + esac cat < ${JIRA_HOME}/dbconfig.xml @@ -49,6 +53,7 @@ if [ -n "$JIRA_DATABASE_URL" ]; then 300000 false true + $PG_CONN_PROPERTIES END