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

[bug] Setting maxprocs may log a scary but innocuous error #1398

Closed
daenney opened this issue Jan 29, 2023 · 3 comments · Fixed by #1402
Closed

[bug] Setting maxprocs may log a scary but innocuous error #1398

daenney opened this issue Jan 29, 2023 · 3 comments · Fixed by #1402
Labels
bug Something isn't working

Comments

@daenney
Copy link
Member

daenney commented Jan 29, 2023

Describe the bug with a clear and concise description of what the bug is.

@blackle brought this up in Matrix, because their instance logged

timestamp="29/01/2023 18:07:53.029" func=maxprocs.Set level=ERROR msg="maxprocs: Leaving GOMAXPROCS=1: CPU quota undefined"

This is a consequence of my change in #1336 and specifically

_, err := maxprocs.Set(maxprocs.Logger(log.Errorf))

Apparently, when it fails to set the limit because no quota was defined in the first place the library internally logs an error (it doesn't return an error, since there isn't actually a problem) https://github.com/uber-go/automaxprocs/blob/58f5aee66e9fc9138dd8ff4f966f101b51b7db63/maxprocs/maxprocs.go#L110-L113

We should probably change that to not be an error logger, perhaps even give it a no-op logger? We handle the error properly so other than that there should be no reason for the library to emit a log line itself. It might still be useful to get the log line from the lib, but that should probably be a "in development mode" only thing.

What's your GoToSocial Version?

git

GoToSocial Arch

No response

Browser version

No response

What happened?

No response

What you expected to happen?

No response

How to reproduce it?

No response

Anything else we need to know?

No response

@daenney daenney added the bug Something isn't working label Jan 29, 2023
@daenney
Copy link
Member Author

daenney commented Jan 29, 2023

@tsmethurst @NyaaaWhatsUpDoc Any preference on how to resolve it? I'm leaning towards a no-op logger for that thing

@tsmethurst
Copy link
Contributor

A no-op logger sounds fine to me, or change level to debug or something!

@NyaaaWhatsUpDoc
Copy link
Member

yep honestly the maxprocs internal logs seem to be a bit weird, am all for disabling them

daenney added a commit to daenney/gotosocial that referenced this issue Jan 30, 2023
This switches the logger to Debug. By default the library logs things
internally despite returning errors. Due to the way we had it hooked up
this resulted in scary error level logs being emitted for innocuous
errors. Now those errors will only be visible in debug mode.

Fixes: superseriousbusiness#1398
Relates to: superseriousbusiness#1336
tsmethurst pushed a commit that referenced this issue Jan 31, 2023
This switches the logger to Debug. By default the library logs things
internally despite returning errors. Due to the way we had it hooked up
this resulted in scary error level logs being emitted for innocuous
errors. Now those errors will only be visible in debug mode.

Fixes: #1398
Relates to: #1336
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants