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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let systemd start ejabberd in foreground #3429

Merged
merged 1 commit into from
Nov 25, 2020

Conversation

mtdcr
Copy link
Contributor

@mtdcr mtdcr commented Nov 19, 2020

Daemons started by systemd shouldn't fork into the background if
possible, because if multiple forked processes exist, systemd has
a hard time determining the main process ID.

In a memory constrained environment, the OOM killer may cause
ejabberd to exit without any trace. Because epmd keeps running,
systemd wouldn't notice the error condition, and as a result it
won't restart the server.

With ejabberd running in foreground, systemd is able to obtain the
correct exit code (137 in this case, instead of 0) and schedules a
restart. The administrator can then see what happend by looking at
systemctl status ejabberd.

Daemons started by systemd shouldn't fork into the background if
possible, because if multiple forked processes exist, systemd has
a hard time determining the main process ID.

In a memory constrained environment, the OOM killer may cause
ejabberd to exit without any trace. Because epmd keeps running,
systemd wouldn't notice the error condition, and as a result it
won't restart the server.

With ejabberd running in foreground, systemd is able to obtain the
correct exit code (137 in this case, instead of 0) and schedules a
restart. The administrator can then see what happend by looking at
systemctl status ejabberd.
@p1bot
Copy link
Collaborator

p1bot commented Nov 19, 2020

Hi @mtdcr, many thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes.

@p1bot p1bot added the cla-missing Contributor needs to sign Contribution License Agreement label Nov 19, 2020
@p1bot
Copy link
Collaborator

p1bot commented Nov 19, 2020

You did it @mtdcr!

Thank you for signing the ProcessOne Contribution License Agreement.

We will have a look at your contribution!

@p1bot p1bot removed the cla-missing Contributor needs to sign Contribution License Agreement label Nov 19, 2020
@badlop badlop merged commit f48f9fe into processone:master Nov 25, 2020
@badlop badlop added this to the ejabberd 20.xx milestone Nov 25, 2020
@badlop badlop modified the milestones: ejabberd 20.xx, ejabberd 20.12 Dec 16, 2020
@weiss
Copy link
Member

weiss commented Jan 26, 2021

I think we now need a proper way to configure whether log messages should continue to be written to file(s) and/or stdout (and therefore to the systemd journal). Right now, ejabberd will write to both.

@prefiks
Copy link
Member

prefiks commented Jan 27, 2021

@weiss 3516d20

@weiss
Copy link
Member

weiss commented Jan 27, 2021

You're the best 😄

(I guess real systemd fans might want the opposite: Just log to the journal. But I can have a look myself.)

@mtdcr mtdcr deleted the systemd-foreground branch April 10, 2021 18:41
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.

5 participants