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

Fix high cpu usage caused by fd leak #1581

Merged
merged 1 commit into from
May 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions supervisor/supervisord.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ def runforever(self):
raise
except:
combined_map[fd].handle_error()
else:
# if the fd is not in combined_map, we should unregister it. otherwise,
# it will be polled every time, which may cause 100% cpu usage
self.options.logger.warn('unexpected read event from fd %r' % fd)
try:
self.options.poller.unregister_readable(fd)
except:
pass

for fd in w:
if fd in combined_map:
Expand All @@ -237,6 +245,12 @@ def runforever(self):
raise
except:
combined_map[fd].handle_error()
else:
self.options.logger.warn('unexpected write event from fd %r' % fd)
try:
self.options.poller.unregister_writable(fd)
except:
pass

for group in pgroups:
group.transition()
Expand Down