Issue 12361: Memory Leak in File Logging (original) (raw)

Created on 2011-06-18 23:37 by japerk, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg138620 - (view) Author: Jacob Perkins (japerk) Date: 2011-06-18 23:37
I have a custom proxy server that was using a WatchedFileHandler for logging requests (the files were rotated with logrotate). It was leaking memory, and I had to use supervisord's memmon plugin to restart it whenever it exceed a certain threshold. I eventually tried disabling the WatchedFileHandler, and memory usage flattened out. I also have a StreamHandler logging the requests, so I have to conclude the leak is in WatchedFileHandler or FileHandler. This is with Python 2.6.6.
msg138627 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-06-19 11:54
Thanks for the report, but more information from the failing system may be needed to find the problem. Although 2.6 does not contain full unit test coverage, the default branch does - and I tested there with resource leak checking turned on, with no leaks being detected. An eyeball inspection fails to show where a leak could be occurring: WatchedFileHandler just makes stat() calls and, if appropriate, calls flush/close on the existing stream and open on the new one. Test output: vinay@eta-jaunty:~/projects/python/default$ ./python Lib/test/regrtest.py -R :: test_logging [1/1] test_logging beginning 9 repetitions 123456789 ......... 1 test OK.
msg138894 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-06-24 08:44
Marked as pending since no further information is available. I will close this issue in two weeks unless more information becomes available; even after this, if you get more information, you can re-open this issue. Also please note that Python 2.6 is closed for changes other than security-related ones.
msg139388 - (view) Author: Jacob Perkins (japerk) Date: 2011-06-29 01:31
Sorry about this. Turns out the flattening of memory usage was a temporary coincidence, and I eventually tracked the bug down to an old version of MySQLdb.
History
Date User Action Args
2022-04-11 14:57:18 admin set github: 56570
2011-06-29 01:31:35 japerk set status: pending -> closedresolution: not a bugmessages: +
2011-06-24 08:44:48 vinay.sajip set status: open -> pendingmessages: +
2011-06-20 18:36:21 eric.araujo set versions: + Python 2.7, - Python 2.6
2011-06-19 11:54:49 vinay.sajip set messages: +
2011-06-19 08:41:13 vinay.sajip set assignee: vinay.sajip
2011-06-19 04:21:04 r.david.murray set nosy: + vinay.sajip
2011-06-18 23:37:00 japerk create