Subject
Something else that requires developers attention
Description
Since v14 introduced logic for better compatibility with container restarts in #3929 , there has been a regression for unclean container exits. When resuming a container, the old process PID files may still be present in this scenario, such as Dovecot causing a crash loop when supervisorctl tries to start the service.
Lines will be repeatedly spammed to logs /var/log/mail.log and /var/log/syslog like:
2024-08-02T00:14:06.432847+00:00 mail dovecot: master: Fatal: Dovecot is already running with PID 133 (read from /run/dovecot/master.pid)
2024-08-02 00:14:07,133 WARN exited: dovecot (exit status 89; not expected)
To fix this regression, the logic from this setup call will need to be run:
|
_register_setup_function '_setup_apply_fixes_after_configuration' |
|
function _setup_apply_fixes_after_configuration() { |
|
_log 'trace' 'Removing leftover PID files from a stop/start' |
|
find /var/run/ -not -name 'supervisord.pid' -name '*.pid' -delete |
|
touch /dev/shm/supervisor.sock |
|
|
|
_log 'debug' 'Checking /var/mail permissions' |
|
if ! _chown_var_mail_if_necessary; then |
|
_dms_panic__general 'Failed to fix /var/mail permissions' |
|
fi |
|
|
|
_log 'debug' 'Removing files and directories from older versions' |
|
rm -rf /var/mail-state/spool-postfix/{dev,etc,lib,pid,usr,private/auth} |
|
|
|
_rspamd_get_envs |
|
# /tmp/docker-mailserver/rspamd/dkim |
|
if [[ -d ${RSPAMD_DMS_DKIM_D} ]]; then |
|
_log 'debug' "Ensuring '${RSPAMD_DMS_DKIM_D}' is owned by '_rspamd:_rspamd'" |
|
chown -R _rspamd:_rspamd "${RSPAMD_DMS_DKIM_D}" |
|
fi |
|
} |
The logic probably should be relocated to target/scripts/startup/check-stack.sh, and the restart condition branch should still run _check:
|
else |
|
# container was restarted |
|
_early_variables_setup |
|
|
|
_log 'info' 'Container was restarted. Skipping setup routines.' |
|
_log 'info' "Welcome to docker-mailserver ${DMS_RELEASE}" |
|
|
|
_register_functions |
|
fi |
Originally caught and detailed here: #4146 (comment)
Subject
Something else that requires developers attention
Description
Since v14 introduced logic for better compatibility with container restarts in #3929 , there has been a regression for unclean container exits. When resuming a container, the old process PID files may still be present in this scenario, such as Dovecot causing a crash loop when
supervisorctltries to start the service.Lines will be repeatedly spammed to logs
/var/log/mail.logand/var/log/sysloglike:To fix this regression, the logic from this setup call will need to be run:
docker-mailserver/target/scripts/start-mailserver.sh
Line 121 in 4f1d075
docker-mailserver/target/scripts/startup/setup-stack.sh
Lines 85 to 104 in 4f1d075
The logic probably should be relocated to
target/scripts/startup/check-stack.sh, and the restart condition branch should still run_check:docker-mailserver/target/scripts/start-mailserver.sh
Lines 184 to 192 in 2f8ad14
Originally caught and detailed here: #4146 (comment)