Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Postfix service should proxy signals received #3118

Merged
merged 1 commit into from
Feb 26, 2023

Conversation

polarathene
Copy link
Member

Description

postfix start-fg was not properly responding to signals received to stop. This caused supervisorctl restart postfix and supervisor stop postfix to not work as expected (stopping the Postfix master process, before attempting to start the service again).

Supervisor does not support custom commands for restarting or stopping a service, relying only on managing the process via a signal. In the past we used a wrapper script to TRAP the signals and trigger commands that way.

However there is a feature which allows us to proxy signals to a different process by referencing a PID file. As Postfix master process creates a pid file when started, we can avoid a wrapper script and the supervisorctl functionality works as intended 馃憤


Fixes #3116

This is a fix to a change scheduled for upcoming v12: #3033

Type of change

  • Bug fix (non-breaking change which fixes an issue)

`postfix start-fg` was not properly responding to signals received to stop. This caused `supervisorctl restart postfix` and `supervisor stop postfix` to not work as expected (_stopping the Postfix master process, before attempting to start the service again_).

Supervisor does not support custom commands for restarting or stopping a service, relying only on managing the process via  a signal. In the past we used a wrapper script to TRAP the signals and trigger commands that way.

However there is a feature which allows us to proxy signals to a different process by referencing a PID file. As Postfix master process creates a pid file when started, we can avoid a wrapper script and the `supervisorctl` functionality works as intended 馃憤
@polarathene
Copy link
Member Author

polarathene commented Feb 26, 2023

We probably should have the process tests check that supervisorctl stop service actually stops a service? It would better detect this kind of issue upfront I think.

Presently we kill them to check that they restart, and this worked for Postfix because the actual Master process was killed directly, not the postfix start-fg (ps displays as /bin/sh /usr/lib/postfix/sbin/postfix-script start-fg) which supervisor is managing directly.

@polarathene polarathene merged commit 1592698 into master Feb 26, 2023
@polarathene polarathene deleted the fix/supervisorctl-postfix branch February 26, 2023 06:32
@georglauterbach
Copy link
Member

Very nice solution! 鉂わ笍

georglauterbach added a commit that referenced this pull request Feb 28, 2023
This commit also includes the removal of files as mentioned in #3118 (see
#3116 (comment)).

This is a cleanup measure. The old socket file is the primary focus of
this commit (and its assocated PR), but I figured this would be _the_
chance to incorporate the removal of the other, unneeded files in order
to not open yet another PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Restarting postfix fails
3 participants