summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelley Spoon <kelley.spoon@linaro.org>2023-10-17 14:31:55 -0500
committerKelley Spoon <kelley.spoon@linaro.org>2023-10-24 14:26:04 +0000
commitd4d0fe7bc261a7f1524ffaf9d6d819fb76c0845a (patch)
tree78a429dad878d6995445df7329edaa125af473dc
parentbca01e2be750b6d241fe4504fec5d65623d90c73 (diff)
gerrit: attempt to fix too fast respawn
When gerrit crashes, systemd will be blocked from restarting it by something and it will give up trying to restart the broken service. This leaves gerrit throwing a 503 error, which isn't detected until a human logs in and attempts to use it. Let's give systemd an explicit command to kill the gerrit process as well as make it aware of the jvm's successful exit values so that it will know to wait for a clean exit instead of running the start command too soon and exhausting its internal wait/retry limit. Change-Id: I23715ab7dc2078e277cc813c9b743913179ee011 Signed-off-by: Kelley Spoon <kelley.spoon@linaro.org> Reviewed-on: https://review.linaro.org/c/infrastructure/ansible-playbooks/+/45929
-rwxr-xr-xroles/gerrit/templates/gerrit.service13
1 files changed, 13 insertions, 0 deletions
diff --git a/roles/gerrit/templates/gerrit.service b/roles/gerrit/templates/gerrit.service
index 082083f4..d1918c29 100755
--- a/roles/gerrit/templates/gerrit.service
+++ b/roles/gerrit/templates/gerrit.service
@@ -9,6 +9,10 @@ Type=simple
WorkingDirectory={{ gerrit_root }}
Environment=GERRIT_HOME={{ gerrit_root }} JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin
ExecStart=/usr/bin/java -Xmx{{ gerrit_mem }} -jar ${GERRIT_HOME}/bin/gerrit.war daemon -d ${GERRIT_HOME}
+ExecStop=/bin/kill -s SIGINT $MAINPID
+# java has its own exit codes
+SuccessExitStatus=130 SIGINT
+SuccessExitStatus=143 SIGTERM
User={{ git_user}}
SyslogIdentifier=gerrit
Restart=on-failure
@@ -16,5 +20,14 @@ RestartSec=30s
StartLimitInterval=600s
StartLimitBurst=3
+# default gerrit ulimits from the init script... let's
+# just let the jvm crash itself rather than risk
+# systemd making the wrong choice
+LimitCORE=0
+LimitDATA=unlimited
+LimitFSIZE=unlimited
+LimitRSS=unlimited
+
+
[Install]
WantedBy=multi-user.target