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

lib2to3 BaseFix class creates un-needed loggers leading to refleaks #56745

Closed
vsajip opened this issue Jul 11, 2011 · 4 comments
Closed

lib2to3 BaseFix class creates un-needed loggers leading to refleaks #56745

vsajip opened this issue Jul 11, 2011 · 4 comments
Labels
easy stdlib Python modules in the Lib dir topic-2to3 type-bug An unexpected behavior, bug, or error

Comments

@vsajip
Copy link
Member

vsajip commented Jul 11, 2011

BPO 12536
Nosy @vsajip, @benjaminp, @merwok

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2011-07-13.22:15:16.732>
created_at = <Date 2011-07-11.17:58:20.502>
labels = ['easy', 'expert-2to3', 'type-bug', 'library']
title = 'lib2to3 BaseFix class creates un-needed loggers leading to refleaks'
updated_at = <Date 2011-07-13.22:15:16.730>
user = 'https://github.com/vsajip'

bugs.python.org fields:

activity = <Date 2011-07-13.22:15:16.730>
actor = 'python-dev'
assignee = 'none'
closed = True
closed_date = <Date 2011-07-13.22:15:16.732>
closer = 'python-dev'
components = ['Library (Lib)', '2to3 (2.x to 3.x conversion tool)']
creation = <Date 2011-07-11.17:58:20.502>
creator = 'vinay.sajip'
dependencies = []
files = []
hgrepos = []
issue_num = 12536
keywords = ['easy']
message_count = 4.0
messages = ['140155', '140254', '140257', '140313']
nosy_count = 4.0
nosy_names = ['vinay.sajip', 'benjamin.peterson', 'eric.araujo', 'python-dev']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue12536'
versions = ['Python 3.3']

@vsajip
Copy link
Member Author

vsajip commented Jul 11, 2011

See bpo-12167 for background.

The BaseFix class creates a logger named with the filename when the set_filename method is called. This logger appears to never be used, but since set_filename could be called any number of times and loggers are effectively singletons and not garbage collected, this could lead to refleaks and unbounded memory usage for no benefit.

It's possible to output contextual information about a file being worked on without needing to create a logger with the filename.

I'm proposing that the references to the logger in BaseFix be removed, as the logger isn't used anyway, and the test suite runs without failures when the references are removed. This will allow progress on bpo-12167.

@vsajip vsajip added stdlib Python modules in the Lib dir topic-2to3 easy type-bug An unexpected behavior, bug, or error labels Jul 11, 2011
@merwok
Copy link
Member

merwok commented Jul 13, 2011

If the logger attribute is part of the official API and Benjamin doesn’t think it wise to just remove it, I think we should either start deprecating it (using a property), or set it to a shared logger object instead of creating one per file.

@benjaminp
Copy link
Contributor

I say kill the loggers.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jul 13, 2011

New changeset dd004e85e299 by Vinay Sajip in branch 'default':
Closes bpo-12536: Unused logger removed from lib2to3.
http://hg.python.org/cpython/rev/dd004e85e299

@python-dev python-dev mannequin closed this as completed Jul 13, 2011
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy stdlib Python modules in the Lib dir topic-2to3 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants