Changeset 178116 in webkit


Ignore:
Timestamp:
Jan 8, 2015 9:10:01 AM (9 years ago)
Author:
ap@apple.com
Message:

When WebProcess is slow to respond to IPC, that's mistakenly reported as crash
https://bugs.webkit.org/show_bug.cgi?id=140218

Reviewed by Darin Adler.

  • Scripts/webkitpy/port/driver.py:

(Driver.init): Removed _subprocess_was_unresponsive that was a modifier for
"process crashed" condition. These don't make sense together - it's either a crash
or a timeout, and we should detect those properly at a much lower level.
(Driver.run_test): Ditto.
(Driver._check_for_driver_crash_or_unresponsiveness): Split crash and unresponsiveness
cases.

  • WebKitTestRunner/TestController.h:
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::webProcessName):
(WTR::TestController::processDidCrash):
Factored out hardcoded child process names, as we now use these in two places.

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::dumpWebProcessUnresponsiveness): Dump an accurate child
process name, so that it can be sampled (fixes sampling on Mavericks and above).

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r178113 r178116  
     12015-01-08  Alexey Proskuryakov  <ap@apple.com>
     2
     3        When WebProcess is slow to respond to IPC, that's mistakenly reported as crash
     4        https://bugs.webkit.org/show_bug.cgi?id=140218
     5
     6        Reviewed by Darin Adler.
     7
     8        * Scripts/webkitpy/port/driver.py:
     9        (Driver.__init__): Removed _subprocess_was_unresponsive that was a modifier for
     10        "process crashed" condition. These don't make sense together - it's either a crash
     11        or a timeout, and we should detect those properly at a much lower level.
     12        (Driver.run_test): Ditto.
     13        (Driver._check_for_driver_crash_or_unresponsiveness): Split crash and unresponsiveness
     14        cases.
     15
     16        * WebKitTestRunner/TestController.h:
     17        * WebKitTestRunner/TestController.cpp:
     18        (WTR::TestController::webProcessName):
     19        (WTR::TestController::processDidCrash):
     20        Factored out hardcoded child process names, as we now use these in two places.
     21
     22        * WebKitTestRunner/TestInvocation.cpp:
     23        (WTR::TestInvocation::dumpWebProcessUnresponsiveness): Dump an accurate child
     24        process name, so that it can be sampled (fixes sampling on Mavericks and above).
     25
    1262015-01-08  Zan Dobersek  <zdobersek@igalia.com>
    227
  • trunk/Tools/Scripts/webkitpy/port/driver.py

    r177722 r178116  
    140140        self._driver_timed_out = False
    141141
    142         # WebKitTestRunner can report back subprocesses that became unresponsive
    143         # This could mean they crashed.
    144         self._subprocess_was_unresponsive = False
    145 
    146142        # stderr reading is scoped on a per-test (not per-block) basis, so we store the accumulated
    147143        # stderr output, as well as if we've seen #EOF on this driver instance.
     
    214210                pid_str = str(self._crashed_pid) if self._crashed_pid else "unknown pid"
    215211                crash_log = 'No crash log found for %s:%s.\n' % (self._crashed_process_name, pid_str)
    216                 # If we were unresponsive append a message informing there may not have been a crash.
    217                 if self._subprocess_was_unresponsive:
    218                     crash_log += 'Process failed to become responsive before timing out.\n'
    219212
    220213                # Print stdout and stderr to the placeholder crash log; we want as much context as possible.
     
    373366            self._driver_timed_out = True
    374367
    375     def _check_for_driver_crash(self, error_line):
     368    def _check_for_driver_crash_or_unresponsiveness(self, error_line):
    376369        if error_line == "#CRASHED\n":
    377370            self._crashed_process_name = self._server_process.name()
    378371            self._crashed_pid = self._server_process.pid()
    379         elif (error_line.startswith("#CRASHED - ")
    380             or error_line.startswith("#PROCESS UNRESPONSIVE - ")):
    381             # WebKitTestRunner/LayoutTestRelay uses this to report that the subprocess (e.g. WebProcess) crashed.
    382             match = re.match('#(?:CRASHED|PROCESS UNRESPONSIVE) - (\S+)', error_line)
     372            return True
     373        elif error_line.startswith("#CRASHED - "):
     374            match = re.match('#CRASHED - (\S+)', error_line)
    383375            self._crashed_process_name = match.group(1) if match else 'WebProcess'
    384376            match = re.search('pid (\d+)', error_line)
    385             pid = int(match.group(1)) if match else None
    386             self._crashed_pid = pid
    387             # FIXME: delete this after we're sure this code is working :)
    388             _log.debug('%s crash, pid = %s, error_line = %s' % (self._crashed_process_name, str(pid), error_line))
    389             if error_line.startswith("#PROCESS UNRESPONSIVE - "):
    390                 self._subprocess_was_unresponsive = True
    391                 self._port.sample_process(self._crashed_process_name, self._crashed_pid)
    392                 # We want to show this since it's not a regular crash and probably we don't have a crash log.
    393                 self.error_from_test += error_line
     377            self._crashed_pid = int(match.group(1)) if match else None
     378            _log.debug('%s crash, pid = %s' % (self._crashed_process_name, str(self._crashed_pid)))
    394379            return True
    395         return self.has_crashed()
     380        elif error_line.startswith("#PROCESS UNRESPONSIVE - "):
     381            match = re.match('#PROCESS UNRESPONSIVE - (\S+)', error_line)
     382            child_process_name = match.group(1) if match else 'WebProcess'
     383            match = re.search('pid (\d+)', error_line)
     384            child_process_pid = int(match.group(1)) if match else None
     385            _log.debug('%s is unresponsive, pid = %s' % (child_process_name, str(child_process_pid)))
     386            self._driver_timed_out = True
     387            if child_process_pid:
     388                self._port.sample_process(child_process_name, child_process_pid)
     389            self.error_from_test += error_line
     390            return True
     391        return False
    396392
    397393    def _command_from_driver_input(self, driver_input):
     
    500496
    501497            if err_line:
    502                 if self._check_for_driver_crash(err_line):
     498                if self._check_for_driver_crash_or_unresponsiveness(err_line):
    503499                    break
    504500                self.error_from_test += err_line
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r177995 r178116  
    753753}
    754754
     755const char* TestController::webProcessName()
     756{
     757    // FIXME: Find a way to not hardcode the process name.
     758#if PLATFORM(IOS)
     759    return  "com.apple.WebKit.WebContent";
     760#elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080
     761    return "com.apple.WebKit.WebContent.Development";
     762#else
     763    return "WebProcess";
     764#endif
     765}
     766
    755767void TestController::updateWebViewSizeForTest(const TestInvocation& test)
    756768{
     
    13721384#if PLATFORM(COCOA)
    13731385        pid_t pid = WKPageGetProcessIdentifier(m_mainWebView->page());
    1374         // FIXME: Find a way to not hardcode the process name.
    1375 #if PLATFORM(IOS)
    1376         const char* processName = "com.apple.WebKit.WebContent";
    1377 #elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080
    1378         const char* processName = "com.apple.WebKit.WebContent.Development";
     1386        fprintf(stderr, "#CRASHED - %s (pid %ld)\n", webProcessName(), static_cast<long>(pid));
    13791387#else
    1380         const char* processName = "WebProcess";
    1381 #endif
    1382         fprintf(stderr, "#CRASHED - %s (pid %ld)\n", processName, static_cast<long>(pid));
    1383 #else
    1384         fputs("#CRASHED - WebProcess\n", stderr);
     1388        fprintf(stderr, "#CRASHED - %s\n", webProcessName());
    13851389#endif
    13861390        fflush(stderr);
  • trunk/Tools/WebKitTestRunner/TestController.h

    r177870 r178116  
    105105    void reattachPageToWebProcess();
    106106
     107    static const char* webProcessName();
     108
    107109    WorkQueueManager& workQueueManager() { return m_workQueueManager; }
    108110
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r177870 r178116  
    202202void TestInvocation::dumpWebProcessUnresponsiveness(const char* errorMessage)
    203203{
    204     const char* errorMessageToStderr = 0;
     204    char errorMessageToStderr[1024];
    205205#if PLATFORM(COCOA)
    206     char buffer[64];
    207206    pid_t pid = WKPageGetProcessIdentifier(TestController::shared().mainWebView()->page());
    208     sprintf(buffer, "#PROCESS UNRESPONSIVE - WebProcess (pid %ld)\n", static_cast<long>(pid));
    209     errorMessageToStderr = buffer;
     207    sprintf(errorMessageToStderr, "#PROCESS UNRESPONSIVE - %s (pid %ld)\n", TestController::webProcessName(), static_cast<long>(pid));
    210208#else
    211     errorMessageToStderr = "#PROCESS UNRESPONSIVE - WebProcess";
     209    sprintf(errorMessageToStderr, "#PROCESS UNRESPONSIVE - %s", TestController::webProcessName());
    212210#endif
    213211
Note: See TracChangeset for help on using the changeset viewer.