Skip to content
New issue

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

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SIGPIPE handler causing infinite loop and ~100% CPU usage on journald restart #1786

Open
whage opened this issue May 8, 2018 · 1 comment

Comments

@whage
Copy link

whage commented May 8, 2018

in core/uwsgi.c a handler for a SIGPIPE signal is registered:

if (!uwsgi.ignore_sigpipe) {
    signal(SIGPIPE, (void *) &warn_pipe);
}

We have a systemd-based uWSGI setup which means that uWSGI is started by systemd and the default behavior in this case is to pipe its stdout and stderr to systemd-journald.

When journald is restarted it raises a SIGPIPE. A similar issue can be found here: cybozu-go/well#13

Since uWSGI tries to handle a SIGPIPE by logging it, the log message ends up in a broken pipe which in turn raises a SIGPIPE and we are stuck in an infinite loop.

The ignore-sigpipe config option (as seen in the if statement above) can be used to avoid this but it might be better to just ignore the SIGPIPE signal by default.

@unbit
Copy link
Owner

unbit commented May 8, 2018

Hi, thanks a lot for reporting (eventually feel free to make a pull request in systemd-related uwsgi-docs). Unfortunately not handling it could lead to unreported errors in other plugins that do not have a solid i/o error checking

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants