superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.71k stars 319 forks source link

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

Closed daenney closed 1 year ago

daenney commented 1 year ago

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 https://github.com/superseriousbusiness/gotosocial/blob/e433e1ad5bc4ffc16eae46bd66e0ff6ce8fe7725/cmd/gotosocial/action/server/server.go#L65

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 commented 1 year ago

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

tsmethurst commented 1 year ago

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

NyaaaWhatsUpDoc commented 1 year ago

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