Skip to content

fix(mail): drop stale Amavis pid files on container restart - #885

Open
Frtrillo wants to merge 1 commit into
oblien:mainfrom
Frtrillo:fix/mail-amavis-stale-pid-on-restart
Open

Frtrillo wants to merge 1 commit into
oblien:mainfrom
Frtrillo:fix/mail-amavis-stale-pid-on-restart

Conversation

@Frtrillo

Copy link
Copy Markdown
Contributor

Summary

  • On docker restart, openship-mail keeps leftover Amavis pid/lock/socket files in /var/run/amavis.
  • Net::Server then abort-loops (Pid_file already exists for running process) when that PID now belongs to another daemon (usually Dovecot).
  • Originating mail defers on 127.0.0.1:10026 even though Health still shows Amavis as running.

Changes

  • apps/email/docker/entrypoint.sh: Unlink stale Amavis runtime files and recreate /var/run/amavis before supervisord starts. This entrypoint is the first process in a fresh pid namespace, so those files cannot refer to a living Amavis.
  • apps/email/docker/supervisord.conf: Note why the entrypoint does this, next to the Amavis program.

This matches the existing ClamAV /run handling (issue #565): Debian's tmpfiles.d rule does not run under supervisord, and docker restart is not the same as docker recreate.

Test plan

  • Scoped to the mail engine image entrypoint; no API/dashboard behavior change
  • Recreate vs restart: docker restart openship-mail should leave Amavis listening on 127.0.0.1:10024 and 127.0.0.1:10026
  • supervisorctl status amavis should be RUNNING, not crash-looping on the leftover pid
  • Deferred originating mail should flush (postqueue -f) once Amavis is up
  • Health → Outbound delivery should not report connect to 127.0.0.1:10026: Connection refused after restart

Verified on a live ghcr.io/oblien/openship-mail:0.7.2 box: leftover pid 67 was Dovecot after restart; removing the pid file and restarting Amavis unstuck 6 deferred messages through SES.

Made with Cursor

docker restart keeps /run, so Amavis's leftover pid can now belong to
Dovecot and Net::Server abort-loops instead of listening on 10026.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant