RESOLVED FIXED 63468
webkitpy should understand crash logs
https://bugs.webkit.org/show_bug.cgi?id=63468
Summary webkitpy should understand crash logs
Adam Barth
Reported 2011-06-27 10:43:26 PDT
webkitpy should understand crash logs
Attachments
Patch (11.66 KB, patch)
2011-06-27 10:45 PDT, Adam Barth
no flags
Patch (11.79 KB, patch)
2011-06-27 11:16 PDT, Adam Barth
no flags
Patch (6.35 KB, patch)
2011-06-27 11:29 PDT, Adam Barth
no flags
Patch (11.81 KB, patch)
2011-06-27 11:36 PDT, Adam Barth
eric: review+
Adam Barth
Comment 1 2011-06-27 10:45:48 PDT
Eric Seidel (no email)
Comment 2 2011-06-27 10:56:13 PDT
Comment on attachment 98748 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=98748&action=review > Tools/Scripts/webkitpy/common/system/crashlog.py:44 > + if sys.platform == "darwin": > + self._capture_log_darwin(process_name) Its funny how initing one of these does the search. I think I would have called this thing CrashLogs and had a most_recent_log(process_name=) function instead. > Tools/Scripts/webkitpy/common/system/crashlog.py:58 > + log_directory = self._filesystem.expanduser("~") > + log_directory = os.path.join(log_directory, "Library", "Logs") > + if self._filesystem.exists(os.path.join(log_directory, "DiagnosticReports")): > + log_directory = os.path.join(log_directory, "DiagnosticReports") > + else: > + log_directory = os.path.join(log_directory, "CrashReporter") I would have made this a separate function. > Tools/Scripts/webkitpy/common/system/executive.py:301 > + ps_process = self.popen(['ps', '-eo', 'pid,comm'], stdout=self.PIPE, stderr=self.PIPE) Really? Python doesn't offer us a better way than running ps? I guess not: http://ubuntuforums.org/showthread.php?t=463850 > Tools/Scripts/webkitpy/common/system/executive.py:311 > + return running_pids Do we need to sort these? Might add a comment which explains why we don't. Does this handle pid-wrapping? do we care? > Tools/Scripts/webkitpy/common/system/executive.py:323 > + while self.check_running_pid(pid): > + time.sleep(0.25) Can't we just waitpid? I guess on unix it has to be a child process? I wonder if the same restriction applies to windows?
Adam Barth
Comment 3 2011-06-27 11:15:51 PDT
(In reply to comment #2) > (From update of attachment 98748 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=98748&action=review > > > Tools/Scripts/webkitpy/common/system/crashlog.py:44 > > + if sys.platform == "darwin": > > + self._capture_log_darwin(process_name) > > Its funny how initing one of these does the search. I think I would have called this thing CrashLogs and had a most_recent_log(process_name=) function instead. I'm not sure I fully understand. You're saying we should use a free function instead of a constructor? What would the CrashLog class have in it? > > Tools/Scripts/webkitpy/common/system/crashlog.py:58 > > + log_directory = self._filesystem.expanduser("~") > > + log_directory = os.path.join(log_directory, "Library", "Logs") > > + if self._filesystem.exists(os.path.join(log_directory, "DiagnosticReports")): > > + log_directory = os.path.join(log_directory, "DiagnosticReports") > > + else: > > + log_directory = os.path.join(log_directory, "CrashReporter") > > I would have made this a separate function. Done. > > Tools/Scripts/webkitpy/common/system/executive.py:301 > > + ps_process = self.popen(['ps', '-eo', 'pid,comm'], stdout=self.PIPE, stderr=self.PIPE) > > Really? Python doesn't offer us a better way than running ps? I guess not: http://ubuntuforums.org/showthread.php?t=463850 This is what the internets recommended. > > Tools/Scripts/webkitpy/common/system/executive.py:311 > > + return running_pids > > Do we need to sort these? Might add a comment which explains why we don't. Does this handle pid-wrapping? do we care? I've sorted it. I'm sure it matters that much. I suspect that we'll have some race conditions because of parallelism, but we'll have to deal with them when they occur. > > Tools/Scripts/webkitpy/common/system/executive.py:323 > > + while self.check_running_pid(pid): > > + time.sleep(0.25) > > Can't we just waitpid? I guess on unix it has to be a child process? I wonder if the same restriction applies to windows? Under the covers, check_running_pid does what the perl code used to do and what the Internet recommends. The perl code specifically has a comment about not using waitpid for this purpose.
Adam Barth
Comment 4 2011-06-27 11:16:39 PDT
Adam Barth
Comment 5 2011-06-27 11:29:48 PDT
Eric Seidel (no email)
Comment 6 2011-06-27 11:35:27 PDT
Comment on attachment 98757 [details] Patch Missing your new file. ;(
Adam Barth
Comment 7 2011-06-27 11:36:47 PDT
Eric Seidel (no email)
Comment 8 2011-06-27 11:41:19 PDT
Comment on attachment 98759 [details] Patch LGTM.
Adam Barth
Comment 9 2011-06-27 11:47:49 PDT
Note You need to log in before you can comment on or make changes to this bug.