UNCONFIRMED 116317
[GTK] Metabug: Memory leak detection using valgrind
https://bugs.webkit.org/show_bug.cgi?id=116317
Summary [GTK] Metabug: Memory leak detection using valgrind
Brian Holt
Reported 2013-05-17 08:19:27 PDT
Memory leak detection is a recurrent topic on webkit-dev but at present there exists only support for the Mac leaks tool. This meta-bug is to track work required to 1) launch the DRT under valgrind to generate a xml file with details of leaks found 2) to parse this file and display leak results 3) update the valgrind suppressions file(s) 4) raise bugs for known memory leaks/violations. A work-in-progress patch will be uploaded shortly.
Attachments
Patch (223.19 KB, patch)
2013-05-20 07:45 PDT, Brian Holt
no flags
Patch (141.44 KB, patch)
2013-06-06 02:29 PDT, Brian Holt
no flags
WIP patch (118.38 KB, patch)
2013-07-04 05:58 PDT, Brian Holt
no flags
Patch (78.15 KB, patch)
2013-07-11 09:30 PDT, Brian Holt
no flags
Patch (78.05 KB, patch)
2013-07-12 03:18 PDT, Brian Holt
no flags
Brian Holt
Comment 1 2013-05-20 07:45:50 PDT
Ryosuke Niwa
Comment 2 2013-05-20 11:29:14 PDT
You shouldn’t be copying the suppressions from Chromium. It’s got all sorts of things that are irrelevant for DRT.
Ryosuke Niwa
Comment 3 2013-05-20 11:30:56 PDT
I also don’t think we should be copying code from Chromium. It’s got all sorts of useless stuff in it.
Brian Holt
Comment 4 2013-05-21 06:10:23 PDT
As I mentioned in the email to webkit-dev, Chromium has a fairly mature process for memory leak and error detection. The simplest path to follow was to reuse Chromium code as a starting point. As you've suggested I'll start to strip away unnecessary code to simplify the patch. Any other suggestions, comments, feedback?
Brian Holt
Comment 5 2013-06-06 02:29:03 PDT
WebKit Commit Bot
Comment 6 2013-06-06 02:31:00 PDT
Attachment 203916 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py', u'Tools/Scripts/webkitpy/port/base.py', u'Tools/Scripts/webkitpy/port/common.py', u'Tools/Scripts/webkitpy/port/gdb_helper.py', u'Tools/Scripts/webkitpy/port/gtk.py', u'Tools/Scripts/webkitpy/port/gtk_leakdetector.py', u'Tools/Scripts/webkitpy/port/mac.py', u'Tools/Scripts/webkitpy/port/memcheck_analyze.py', u'Tools/Scripts/webkitpy/port/server_process.py', u'Tools/Scripts/webkitpy/port/server_process_unittest.py', u'Tools/valgrind/memcheck/suppressions.txt']" exit_code: 1 Tools/Scripts/webkitpy/port/gtk.py:174: [GtkPort.print_leaks_summary] Instance of 'GtkLeakDetector' has no 'parse_leaks_output' member [pylint/E1101] [5] Tools/Scripts/webkitpy/port/common.py:131: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] Tools/Scripts/webkitpy/port/common.py:134: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] Tools/Scripts/webkitpy/port/common.py:135: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] Tools/Scripts/webkitpy/port/gtk_leakdetector.py:78: [GtkLeakDetector.check_for_leaks] Undefined variable 'leaks_output' [pylint/E0602] [5] Tools/Scripts/webkitpy/port/memcheck_analyze.py:126: whitespace before '}' [pep8/E202] [5] Total errors found: 6 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 7 2013-06-06 02:34:36 PDT
Be sure to copy all copyright notices, etc... and be sure to follow the license terms of Chromium. I also don't think you should be adding your copyright notice if you're simply coping fils and stripping code.
Brian Holt
Comment 8 2013-06-06 02:40:59 PDT
I've gone through the suppressions file very carefully, removing all Chromium specific bits. After running $ Tools/Scripts/run-webkit-tests --gtk --leak --wrapper="valgrind" --run-singly LayoutTests/ there are no leaks/errors that are not in the suppressions file. I'll post the results of memcheck_analyse shortly.
Sergio Villar Senin
Comment 9 2013-07-04 03:46:54 PDT
Looks great, god job. Note that you have several suppressions that refer to the V8 engine, they're no longer valid.
Mario Sanchez Prada
Comment 10 2013-07-04 04:06:21 PDT
(In reply to comment #9) > Looks great, god job. ^^^ Good to know I work with a god! /me could not resist
Brian Holt
Comment 11 2013-07-04 05:58:14 PDT
Created attachment 206083 [details] WIP patch
Brian Holt
Comment 12 2013-07-11 09:30:00 PDT
WebKit Commit Bot
Comment 13 2013-07-11 09:32:21 PDT
Attachment 206472 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py', u'Tools/Scripts/webkitpy/port/base.py', u'Tools/Scripts/webkitpy/port/common.py', u'Tools/Scripts/webkitpy/port/gdb_helper.py', u'Tools/Scripts/webkitpy/port/gtk.py', u'Tools/Scripts/webkitpy/port/gtk_leakdetector.py', u'Tools/Scripts/webkitpy/port/mac.py', u'Tools/Scripts/webkitpy/port/memcheck_analyze.py', u'Tools/Scripts/webkitpy/port/server_process.py', u'Tools/Scripts/webkitpy/port/server_process_unittest.py', u'Tools/valgrind/memcheck/suppressions.txt']" exit_code: 1 Tools/Scripts/webkitpy/port/common.py:129: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] Tools/Scripts/webkitpy/port/common.py:132: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] Tools/Scripts/webkitpy/port/common.py:133: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] Total errors found: 3 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brian Holt
Comment 14 2013-07-11 09:33:30 PDT
This patch has proven itself as quite useful so far for finding and resolving leaks. I think that this patch is probably quite close so any feedback would be very welcome.
Brian Holt
Comment 15 2013-07-11 09:36:00 PDT
Comment on attachment 206472 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=206472&action=review This seems to be an issue with the style checker because Popen definitely has a member called pid. >> Tools/Scripts/webkitpy/port/common.py:129 >> + subprocess.call(["taskkill", "/T", "/F", "/PID", str(p.pid)]) > > [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] From http://docs.python.org/2/library/subprocess.html: Popen.pid The process ID of the child process. Note that if you set the shell argument to True, this is the process ID of the spawned shell.
Martin Robinson
Comment 16 2013-07-11 09:40:56 PDT
Nice. This is a big patch, so I haven't had time to review it. It's probably best when adding a lot of Python code to follow the style of the existing code though -- which is PEP8 as far as I know. Also, we typically don't abbreviate variable names and comments are complete sentences with periods at the end.
Brian Holt
Comment 17 2013-07-11 09:53:23 PDT
(In reply to comment #16) > Nice. This is a big patch, so I haven't had time to review it. It's probably best when adding a lot of Python code to follow the style of the existing code though -- which is PEP8 as far as I know. Also, we typically don't abbreviate variable names and comments are complete sentences with periods at the end. I've PEP8'ed the code so it passes the style check with the exception of the erroneous message about Popen.pid. I'll go back through all the code to check for variable names and comments, hopefully I can upload a new patch tomorrow.
Brian Holt
Comment 18 2013-07-12 03:18:41 PDT
WebKit Commit Bot
Comment 19 2013-07-12 03:21:36 PDT
Attachment 206519 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py', u'Tools/Scripts/webkitpy/port/base.py', u'Tools/Scripts/webkitpy/port/common.py', u'Tools/Scripts/webkitpy/port/gdb_helper.py', u'Tools/Scripts/webkitpy/port/gtk.py', u'Tools/Scripts/webkitpy/port/gtk_leakdetector.py', u'Tools/Scripts/webkitpy/port/mac.py', u'Tools/Scripts/webkitpy/port/memcheck_analyze.py', u'Tools/Scripts/webkitpy/port/server_process.py', u'Tools/Scripts/webkitpy/port/server_process_unittest.py', u'Tools/valgrind/memcheck/suppressions.txt']" exit_code: 1 Tools/Scripts/webkitpy/port/common.py:129: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] Tools/Scripts/webkitpy/port/common.py:132: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] Tools/Scripts/webkitpy/port/common.py:133: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] Total errors found: 3 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brian Holt
Comment 20 2013-07-12 03:37:38 PDT
(In reply to comment #19) > Attachment 206519 [details] did not pass style-queue: > > Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py', u'Tools/Scripts/webkitpy/port/base.py', u'Tools/Scripts/webkitpy/port/common.py', u'Tools/Scripts/webkitpy/port/gdb_helper.py', u'Tools/Scripts/webkitpy/port/gtk.py', u'Tools/Scripts/webkitpy/port/gtk_leakdetector.py', u'Tools/Scripts/webkitpy/port/mac.py', u'Tools/Scripts/webkitpy/port/memcheck_analyze.py', u'Tools/Scripts/webkitpy/port/server_process.py', u'Tools/Scripts/webkitpy/port/server_process_unittest.py', u'Tools/valgrind/memcheck/suppressions.txt']" exit_code: 1 > Tools/Scripts/webkitpy/port/common.py:129: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] > Tools/Scripts/webkitpy/port/common.py:132: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] > Tools/Scripts/webkitpy/port/common.py:133: [RunSubprocess] Instance of 'Popen' has no 'pid' member (but some types could not be inferred) [pylint/E1103] [5] > Total errors found: 3 in 12 files > > > If any of these errors are false positives, please file a bug against check-webkit-style. https://bugs.webkit.org/show_bug.cgi?id=118592 filed to fix the false positives.
Brian Holt
Comment 21 2013-07-17 03:00:21 PDT
Comment on attachment 206519 [details] Patch This bug should remain a metabug for tracking open leaks, so moving the leak tool itself to https://bugs.webkit.org/show_bug.cgi?id=118785.
Note You need to log in before you can comment on or make changes to this bug.