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

upssched v2.8.0 hogs CPU after a while (Debian 12 package) #1964

Closed
jimklimov opened this issue Jun 13, 2023 · 0 comments · Fixed by #1965
Closed

upssched v2.8.0 hogs CPU after a while (Debian 12 package) #1964

jimklimov opened this issue Jun 13, 2023 · 0 comments · Fixed by #1965
Labels
bug upssched Questions and issues about upssched (timer helper for upsmon)
Milestone

Comments

@jimklimov
Copy link
Member

Raised in https://alioth-lists.debian.net/pipermail/nut-upsuser/2023-June/013338.html

Per initial analysis in the thread, it seems that the tight loop runs when select() returns quickly but read() has nothing to report. Why - that is uncertain now. Possibly we miss the detection of a closed socket (disconnected client) and the raised "I am ready" flag is an attempt to convey that?..

Might be or not be related to #1274 which landed a couple of months before NUT v2.8.0 release: not on first sight, but need a repro case to say for sure.

One easy-pickings solution (to CPU hogging) would be to detect that we spend almost no time in the loop to read nothing, and induce a delay (e.g. select() would have waited a second... might as well try to usleep() the rest of it).

However it is best to reproduce the problem and understand why it happens - if we lost the ability to forget disconnected clients, it is a path to resource leak and crash later on. And might be somehow related to other upssched issues reported over the past year or two...

@jimklimov jimklimov added bug upssched Questions and issues about upssched (timer helper for upsmon) labels Jun 13, 2023
@jimklimov jimklimov added this to the 2.8.1 milestone Jun 13, 2023
jimklimov added a commit to jimklimov/nut that referenced this issue Jun 13, 2023
jimklimov added a commit to jimklimov/nut that referenced this issue Jun 13, 2023
jimklimov added a commit to jimklimov/nut that referenced this issue Jun 15, 2023
jimklimov added a commit to jimklimov/nut that referenced this issue Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug upssched Questions and issues about upssched (timer helper for upsmon)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant