Bound daemon startup and shutdown and exit with a useful code
start_daemon and stop_daemon polled "while True" with no bound, and no seaf-cli exit code was checked. A daemon that failed to start left the container spinning forever with nothing pointing at the cause, and there was no signal handling, so "docker stop" waited the full 10 second grace period and then SIGKILLed the process with the daemon still running. Readiness polling is now bounded by DAEMON_START_TIMEOUT and DAEMON_STOP_TIMEOUT. The stop timeout is 8 seconds so a graceful shutdown fits inside the docker stop grace period, and a test asserts that relation. SIGTERM and SIGINT raise GracefulShutdown, and the lifecycle moved into start.run(), which always stops the daemon on the way out and returns the process exit code: 0 on a clean finish or a stop signal, 1 on a daemon or configuration failure. seaf-cli exit codes are checked. A failed sync is reported per library and does not stop the remaining libraries, since one bad library should not take the container down. Verified in the built image: "docker stop" now returns in 0s with exit code 0 and the daemon stopped, against 10s and exit 137 before. A daemon that cannot start exits 1 with the failing command and its exit code in the log. Also bumps actions/setup-python to v7, which clears the last Node 20 deprecation warning; v7 only drops the unused pip-install input.
This commit is contained in:
1 parent
d1c0be2c24
commit
f3804b7e2e
8 files changed
+338
-56
No files matched your search
@@ -4,6 +4,13 @@ DEPRECATED_LIBS_DIR = "/data"
|
||||
DEFAULT_USERNAME = "seafile"
|
||||
STATUS_POLL_PERIOD = 1
|
||||
|
||||
# Bounds for daemon startup and shutdown, in seconds. The stop timeout has to
|
||||
# fit inside the grace period of "docker stop", which sends SIGKILL 10 seconds
|
||||
# after SIGTERM by default, otherwise shutdown is never graceful.
|
||||
DAEMON_POLL_PERIOD = 1
|
||||
DAEMON_START_TIMEOUT = 120
|
||||
DAEMON_STOP_TIMEOUT = 8
|
||||
|
||||
AVAILABLE_SEAFCLI_OPTIONS = {
|
||||
"delete_confirm_threshold",
|
||||
"disable_verify_certificate",
|
||||
|
||||
Reference in new issue
Block a user