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

Unregister file descriptors when streams close. #589

Merged
merged 1 commit into from
Mar 5, 2015

Conversation

hathawsh
Copy link
Contributor

@hathawsh hathawsh commented Mar 5, 2015

When I run MongoDB under Supervisor 4.0-dev, MongoDB closes its stdout stream and Supervisor reacts by spinning the CPU at 100%. This patch fixes the problem by unregistering file descriptors that are no longer readable or writable.

(Both MongoDB and Supervisor remained responsive; this bug was really just a pure CPU drain.)

… spins the CPU when a child process closes stdout or stderr.
mnaberez added a commit that referenced this pull request Mar 5, 2015
Unregister file descriptors when streams close.
@mnaberez mnaberez merged commit 20e47d8 into Supervisor:master Mar 5, 2015
@mnaberez mnaberez mentioned this pull request Mar 5, 2015
@msabramo
Copy link
Contributor

msabramo commented Mar 6, 2015

Cool! Thanks!

@drewp
Copy link

drewp commented Feb 18, 2017

I'm on 3.3.1 so I have this patch, but my supervisord is also at 100%. strace shows this repeating many times per second:

wait4(-1, 0x7ffd1fad6b4c, WNOHANG, NULL) = 0
poll([{fd=4, events=POLLIN|POLLPRI|POLLHUP}, {fd=7, events=POLLIN|POLLPRI|POLLHUP}, {fd=9, events=POLLIN|POLLPRI|POLLHUP}, {fd=10, events=POLLIN|POLLPRI|POLLHUP}, {fd=15, events=POLLIN|POLLPRI|POLLHUP}, {fd=22, events=POLLIN|POLLPRI|POLLHUP}, {fd=23, events=POLLIN|POLLPRI|POLLHUP}, {fd=26, events=POLLIN|POLLPRI|POLLHUP}, ...], 277, 1000) = 2 ([...])

(return from poll is always 2)

I am running mongodb, among 135+ other processes. According to /proc, the supervisord process has 718 open fds: 275 to log files, 411 are pipe:[...]. No process's log files are growing continuously.

Incidentally, mongodb (3.2.7) has written 30MB to its stdout and nothing to its stderr.

ubuntu 16.04.1, kernel 4.4.0-62-generic.

@drewp
Copy link

drewp commented Feb 18, 2017

Sorry, #807 is the more recent discussion of this symptom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants