Skip to content

gh-96159: Fix significant performance degradation in logging.TimedRotat… (GH-96182) #96182

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

Merged
merged 3 commits into from
Aug 23, 2022

Conversation

dgrisby
Copy link
Contributor

@dgrisby dgrisby commented Aug 22, 2022

This is a simple fix for #96159. The cost of checking for non-regular files is now only incurred when the rollover time is reached, rather than on every single log message.

A similar change could be made to RotatingFileHandler, but does seek() and tell() calls on the file, which are probably bad to do on special files, so I thought it was safer to leave it with the file type check on every call.

@dgrisby dgrisby requested a review from vsajip as a code owner August 22, 2022 18:01
@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@ghost
Copy link

ghost commented Aug 22, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@dgrisby dgrisby changed the title Bug #96159: Significant performance degradation in logging.TimedRotat… gh-#96159: Significant performance degradation in logging.TimedRotat… Aug 22, 2022
@dgrisby dgrisby changed the title gh-#96159: Significant performance degradation in logging.TimedRotat… gh-96159: Significant performance degradation in logging.TimedRotat… Aug 22, 2022
@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

…otatingFileHandler due to fix to python#89564

Only check for special files when the rollover time has passed, rather
than cheking on every log message.
@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@vsajip vsajip changed the title gh-96159: Significant performance degradation in logging.TimedRotat… gh-96159: Fix significant performance degradation in logging.TimedRotat… (GH-96182) Aug 23, 2022
@vsajip vsajip merged commit 1499d73 into python:main Aug 23, 2022
@vsajip vsajip added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Aug 23, 2022
@miss-islington
Copy link
Contributor

Thanks @dgrisby for the PR, and @vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @dgrisby for the PR, and @vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-96195 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Aug 23, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 23, 2022
…medRotat… (pythonGH-96182)

(cherry picked from commit 1499d73)

Co-authored-by: Duncan Grisby <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 23, 2022
…medRotat… (pythonGH-96182)

(cherry picked from commit 1499d73)

Co-authored-by: Duncan Grisby <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Aug 23, 2022
@bedevere-bot
Copy link

GH-96196 is a backport of this pull request to the 3.11 branch.

vsajip pushed a commit that referenced this pull request Aug 23, 2022
vsajip pushed a commit that referenced this pull request Aug 23, 2022
mdboom pushed a commit to mdboom/cpython that referenced this pull request Aug 24, 2022
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.

4 participants