Repository navigation
Logins and sending keep working after a restart (dovecot waits for MariaDB; stale PID files removed) - #102
Merged
Conversation
…er a restart supervisord starts mariadbd and dovecot together, so dovecot's SQL connection can fail before MariaDB listens. Since Debian's dovecot 1:2.4.1+dfsg1-6+deb13u7 (DSA-6526-1) a passdb lookup then fails at once and a reconnect is tried only on a later login, with a 5x growing delay (cap 1800 s). Actions run 37412510200 (diagnostic branch): unchanged master failed 4/4 suite runs and got stuck >360 s on the 2nd restart; with dovecot waiting for `mysqladmin ping` 4/4 suite runs (28/28) and 20/20 restarts passed, login within 17-23 s. A clean MariaDB shutdown alone did not help. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0174TWxjhknsgKUXC41iBwGQ
…ter a restart `docker restart` keeps /run, so amavisd.pid still names the previous run's PID; when that number now belongs to another user's process amavis dies on "Can't send SIG 0 ... Operation not permitted", supervisord gives up, and every submission message gets "451 4.3.0 queue file write error". Seen in PR #102's CI (run 37421098227) and on the 8th restart of run 37423269213. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0174TWxjhknsgKUXC41iBwGQ
lejmr
added a commit
that referenced
this pull request
Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rows touched: 4, 13, 14 (and 5-11 when they follow a failed restart in the same run)
Rows added: none - one extra-tier test under row 4: three restarts in a row, a login and a submitted message after each
Rows removed: none
Everything else in the table: this PR's CI run 37480595394 (29/29 passed)
What broke
Since builds from 2026-10-05 the weekly CI and Refresh fail. After a container restart, logins are refused with
[UNAVAILABLE] Temporary authentication failure(IMAP) or535 5.7.8 ... (reason unavailable)(SMTP). This lasts minutes, and can last up to 30 minutes. Users who restart the container are affected in the same way.Cause
mariadbdanddovecottogether. Dovecot's SQL connection can fail before MariaDB listens.1:2.4.1+dfsg1-6+deb13u7(DSA-6526-1, 2026-09-28) added patch0006-auth-passdb_sql-connect-before-expanding-query-varia.patch. Since then, a passdb lookup fails immediately with "Not connected to database" while the connection is down.SQL_CONNECT_MAX_DELAY).u6the lookup waited and recovered within 60 s, so the race went unnoticed. MariaDB itself did not change between the working and the failing builds.Evidence: Actions run 37412510200 (diagnostic branch, deleted since)
Native amd64, packages of 2026-10-06:
waiting for 1 -> 5 -> 25 -> 125 seconds before retrystop_grace_period: 90s)Change
image/build/gen-supervisord.sh: dovecot starts oncemysqladmin pinganswers, the same way sogod already does, then runsdovecot -Fas before.test/test_acceptance.py:test_row04_repeated_restarts_keep_login_and_sending_working. A single restart hits either race only sometimes.image/scripts/entrypoint.sh: stale PID files removed at start (second cause, below).CHANGELOG.md: two entries under Unreleased / Fixed.Second cause, found by this PR's first CI run
The first version (7db83ef) failed rows 5, 6, 7, 9, 13 and 14 with
451 4.3.0 Error: queue file write erroron submission. That is an independent race with the same trigger:docker restartkeeps/run.amavisd.pidtherefore still names the previous run's PID.kill(0, pid)and dies onEPERM:Can't send SIG 0 to process [690]: Operation not permitted.amavis entered FATAL state), and Postfix answers every submission/smtps message with 451 until the next restart.Waiting for MariaDB does not help: a variant where every DB user waits did worse. Fix:
entrypoint.shdeletes every*.pidunder/runbefore supervisord starts. It is PID 1 at that point, so every PID file there is stale.Evidence for the PR as it is now (97425ba), Actions run 37480650640 (diagnostic branch):
Before this fix, the same loop failed at the 8th restart (run 37423269213).
Relation to #101
#101 waits up to 300 s for a login. That cannot help: the lockout can last up to 30 minutes. Recommendation: close #101, or keep only its part that saves the servers' logs.
Checked locally
bash -n,py_compileandshellcheck -S warningwith CI's invocation: all OK.command=/bin/sh -c 'until mysqladmin ping -h 127.0.0.1 --silent 2>/dev/null; do sleep 1; done; exec /usr/sbin/dovecot -F'. It is the same as the variant tested in the diagnostic run, apart from the cap.After merge
Refresh builds from the release's tag, so a fix on
masterreaches:1.8.8only with a release:1.8.8-2via the Release button. Until then, the scheduled Refresh will keep failing.🤖 Generated with Claude Code
https://claude.ai/code/session_0174TWxjhknsgKUXC41iBwGQ