New submission from Марк Коренберг <socketp...@gmail.com>:
logger use dict for loggers instead of WeakValueDictionary Now, when object returned by getLogger() gets unreferenced - it will not be garbage collected, as reference is stored in logging module. This will results in leaked file object, that cannot be closed in easy way. Some modules (notable yum) opens dozen of loggers that prevents me to unmount directory where logs placed. Now, I use workaround: ----------------------- try: # work with yum finally: yum_base_cli.close() yum_base_cli.closeRpmDB() yum_base_cli.doUnlock() del yum_base_cli # gc.collect() may be called here, but it does not actually change anything.... for logger_name,logger in cli.logging.Logger.manager.loggerDict.iteritems(): if not logger_name.startswith('yum'): continue for h in logger.handlers: h.flush() h.close() ----------------------- The problem in that logging module stores many references in lists and dicts. So just replacing {} with WeakValueDictionary() does not eliminate problem fully. I have checked, problem exists in all python versions ---------- components: Library (Lib) messages: 134714 nosy: mmarkk priority: normal severity: normal status: open title: logger use dict for loggers instead of WeakValueDictionary type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11950> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com