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

Refactored logger internals #3428

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Refactored logger internals #3428

wants to merge 4 commits into from

Conversation

lminiero
Copy link
Member

After a static code analysis with Coverity last week, and the issue opened in #3427, we decided to try and refactor the way logging is performed internally, which is what this PR does.

Rather than using growing and reusable buffers as before, we switched to an async queue with smaller allocations for each item passed to the logger. While this increases the number of allocations, it's much more thread safe than before: fixing the broken behaviour the old code could have (and in practice pretty much never had, except for rare occurrences like the issue above) would have meant expanding the scope of the existing mutexes, which could have risked bottlenecks in potentially critical parts of the code (we definitely don't want queueing something for the logs to wait).

I took advantage of this refactoring to also fix another sometimes inconsistent behaviour, that is some initial lines that would always be missing when using log files or external loggers. The new queueing mechanism now takes that into account.

We performed some stress testing and comparisons, and apparently the new approach is slightly faster in the tests we made. Please do test the PR, especially if you have "chatty" Janus instances, and let us know if you encounter any issues before we merge this. It's a PR for master, at the moment, but I'll backport it to 0.x too when done.

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

Successfully merging this pull request may close these issues.

2 participants