Bug 225818

Summary: [WebKitTestRunner] Forward WebContent termination reason
Product: WebKit Reporter: Jonathan Bedard <jbedard>
Component: Tools / TestsAssignee: Jonathan Bedard <jbedard>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
none
Patch none

Description Jonathan Bedard 2021-05-14 12:05:38 PDT
We should print the reason a WebContent process was terminated to aid in debugging.
Comment 1 Radar WebKit Bug Importer 2021-05-14 12:05:56 PDT
<rdar://problem/78027164>
Comment 2 Jonathan Bedard 2021-05-14 12:09:18 PDT
Created attachment 428645 [details]
Patch
Comment 3 Chris Dumez 2021-05-14 13:26:44 PDT
Comment on attachment 428645 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428645&action=review

> Tools/WebKitTestRunner/TestController.cpp:2163
> +        fprintf(stderr, "Terminating %s (pid %ld) ", webProcessName(), static_cast<long>(pid));

Isn't this going to look confusing?
"""
Terminating WebProcess (pid: 123) because the process crashed
#CRASHED - WebProcess (pid: 123)
"""

Why are we saying we are terminating a process when the process actually crashed?

Maybe it should be something like:
fprintf(stderr, "%s terminated (pid %ld) ", webProcessName(), static_cast<long>(pid));

> Tools/WebKitTestRunner/TestController.cpp:2182
> +            return;

Note that you are not calling fflush() in this early return case even though you printed something.

> Tools/WebKitTestRunner/TestController.cpp:2185
>          fflush(stderr);

Note the call to fflush() here.
Comment 4 Jonathan Bedard 2021-05-14 13:42:23 PDT
Comment on attachment 428645 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428645&action=review

>> Tools/WebKitTestRunner/TestController.cpp:2163
>> +        fprintf(stderr, "Terminating %s (pid %ld) ", webProcessName(), static_cast<long>(pid));
> 
> Isn't this going to look confusing?
> """
> Terminating WebProcess (pid: 123) because the process crashed
> #CRASHED - WebProcess (pid: 123)
> """
> 
> Why are we saying we are terminating a process when the process actually crashed?
> 
> Maybe it should be something like:
> fprintf(stderr, "%s terminated (pid %ld) ", webProcessName(), static_cast<long>(pid));

The #CRASHED string will not show up in run-webkit-test's output, that's a control statement that triggers some logic in webkitpy about collecting crashes. I was trying to match the name of the API

I'm good with your phrasing, though, indicating the termination has already occurred.

>> Tools/WebKitTestRunner/TestController.cpp:2182
>> +            return;
> 
> Note that you are not calling fflush() in this early return case even though you printed something.

My rationale here is that the processDidCrash callback was not triggered in the case originally, and the whole reason we call flush is because we may call exit at the end of this function. That being said, I suppose flush can't do any harm in the early return case.
Comment 5 Jonathan Bedard 2021-05-14 13:51:45 PDT
Created attachment 428654 [details]
Patch
Comment 6 Chris Dumez 2021-05-14 13:53:00 PDT
Comment on attachment 428654 [details]
Patch

r=me
Comment 7 Jonathan Bedard 2021-05-14 17:01:14 PDT
Created attachment 428687 [details]
Patch
Comment 8 EWS 2021-05-14 22:02:14 PDT
Committed r277533 (237761@main): <https://commits.webkit.org/237761@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 428687 [details].