From dd096ff1982f9684785d55bbfaed15d4ca7d5395 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Thu, 29 Oct 2020 21:57:29 +0300 Subject: [PATCH 1/2] fix(install): Increase stop timeout to 60 seconds This is to ensure clean shutdown of Celery, with fully drained queues. This is needed as versions may change the event format and not be backwards compatible. FWIW this is a hacky workaround without a strong guarantee that the queues will be empty. Ideally we'd shutdown everything first, spin up the workers and check for queues being drained every second or so. --- install.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index d5fafc5bb06..12a53cc0d80 100755 --- a/install.sh +++ b/install.sh @@ -15,6 +15,11 @@ MIN_DOCKER_VERSION='19.03.6' MIN_COMPOSE_VERSION='1.24.1' MIN_RAM=2400 # MB +# Increase the default 10 second SIGTERM timeout +# to ensure celery queues are properly drained +# between upgrades as event formats may change across +# versions +STOP_TIMEOUT=60 # seconds SENTRY_CONFIG_PY='sentry/sentry.conf.py' SENTRY_CONFIG_YML='sentry/config.yml' SYMBOLICATOR_CONFIG_YML='symbolicator/config.yml' @@ -76,7 +81,7 @@ cleanup () { fi if [[ -z "$MINIMIZE_DOWNTIME" ]]; then - $dc stop &> /dev/null + $dc stop -t $STOP_TIMEOUT &> /dev/null fi } trap_with_arg cleanup ERR INT TERM EXIT @@ -224,9 +229,9 @@ if [[ -n "$MINIMIZE_DOWNTIME" ]]; then else # Clean up old stuff and ensure nothing is working while we install/update # This is for older versions of on-premise: - $dc -p onpremise down --rmi local --remove-orphans + $dc -p onpremise down -t $STOP_TIMEOUT --rmi local --remove-orphans # This is for newer versions - $dc down --rmi local --remove-orphans + $dc down -t $STOP_TIMEOUT --rmi local --remove-orphans fi ZOOKEEPER_SNAPSHOT_FOLDER_EXISTS=$($dcr zookeeper bash -c 'ls 2>/dev/null -Ubad1 -- /var/lib/zookeeper/data/version-2 | wc -l | tr -d '[:space:]'') From 33600da04d92f44462aae647d01539d9148c1395 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Thu, 29 Oct 2020 23:10:12 +0300 Subject: [PATCH 2/2] better description Co-authored-by: Mark Story --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 12a53cc0d80..da0ed59863e 100755 --- a/install.sh +++ b/install.sh @@ -17,7 +17,7 @@ MIN_RAM=2400 # MB # Increase the default 10 second SIGTERM timeout # to ensure celery queues are properly drained -# between upgrades as event formats may change across +# between upgrades as task signatures may change across # versions STOP_TIMEOUT=60 # seconds SENTRY_CONFIG_PY='sentry/sentry.conf.py'