Bug 189037 - Add error information to help debug test failure in WKNavigation.ProcessCrashDuringCallback
Summary: Add error information to help debug test failure in WKNavigation.ProcessCrash...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks: 189148
  Show dependency treegraph
 
Reported: 2018-08-27 17:15 PDT by Sihui Liu
Modified: 2018-08-30 11:20 PDT (History)
8 users (show)

See Also:


Attachments
Patch (6.37 KB, patch)
2018-08-27 17:18 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (6.42 KB, patch)
2018-08-28 10:13 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (6.42 KB, patch)
2018-08-28 12:13 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch for landing (6.26 KB, patch)
2018-08-28 13:48 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sihui Liu 2018-08-27 17:15:29 PDT
WKNavigation.ProcessCrashDuringCallback is failing after r235321, which seems to be an irrelevant change. Add some error information to help debug the failure.
Comment 1 Sihui Liu 2018-08-27 17:18:33 PDT
Created attachment 348242 [details]
Patch
Comment 2 Sihui Liu 2018-08-28 10:13:31 PDT
Created attachment 348304 [details]
Patch
Comment 3 Chris Dumez 2018-08-28 11:59:47 PDT
What does the failure look like?
Comment 4 Sihui Liu 2018-08-28 12:03:25 PDT
(In reply to Chris Dumez from comment #3)
> What does the failure look like?

https://build.webkit.org/builders/Apple%20High%20Sierra%20Debug%20WK2%20%28Tests%29/builds/4651/steps/run-api-tests/logs/stdio
        
        /Volumes/Data/slave/highsierra-debug/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:232
        Value of: !!error
          Actual: false
        Expected: true
Comment 5 Chris Dumez 2018-08-28 12:08:55 PDT
Comment on attachment 348304 [details]
Patch

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

> Tools/TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:233
> +            EXPECT_EQ(error.code, WKErrorWebContentProcessTerminated);

I believe the parameters are reversed. Left side should be expected value iirc.
Comment 6 Sihui Liu 2018-08-28 12:13:54 PDT
Created attachment 348320 [details]
Patch
Comment 7 Sihui Liu 2018-08-28 12:16:28 PDT
(In reply to Chris Dumez from comment #5)
> Comment on attachment 348304 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=348304&action=review
> 
> > Tools/TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:233
> > +            EXPECT_EQ(error.code, WKErrorWebContentProcessTerminated);
> 
> I believe the parameters are reversed. Left side should be expected value
> iirc.

I saw this WKContentExtensionStoreStore.mm so I thought it's correct... Fixed.
Comment 8 Chris Dumez 2018-08-28 12:18:57 PDT
(In reply to Sihui Liu from comment #7)
> (In reply to Chris Dumez from comment #5)
> > Comment on attachment 348304 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=348304&action=review
> > 
> > > Tools/TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:233
> > > +            EXPECT_EQ(error.code, WKErrorWebContentProcessTerminated);
> > 
> > I believe the parameters are reversed. Left side should be expected value
> > iirc.
> 
> I saw this WKContentExtensionStoreStore.mm so I thought it's correct...
> Fixed.

Yes, people get it wrong all the time.
Comment 9 Chris Dumez 2018-08-28 12:21:08 PDT
Comment on attachment 348320 [details]
Patch

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

r=me

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:4576
> +            NSError* callbackError = [NSError errorWithDomain:WKErrorDomain code:static_cast<int>(error) userInfo:nil];

FYI, we use star on right size for NS types. But in this case, I'd rather we drop this local variable completely:
completionHandlerBlock(nil, [NSError errorWithDomain:WKErrorDomain code:static_cast<int>(error) userInfo:nil]);

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:4591
> +            NSError* callbackError = [NSError errorWithDomain:WKErrorDomain code:static_cast<int>(error) userInfo:nil];

ditto.

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:4605
> +            NSError* callbackError = [NSError errorWithDomain:WKErrorDomain code:static_cast<int>(error) userInfo:nil];

ditto.
Comment 10 Sihui Liu 2018-08-28 13:48:02 PDT
Created attachment 348338 [details]
Patch for landing
Comment 11 WebKit Commit Bot 2018-08-28 14:26:29 PDT
Comment on attachment 348338 [details]
Patch for landing

Clearing flags on attachment: 348338

Committed r235440: <https://trac.webkit.org/changeset/235440>
Comment 12 WebKit Commit Bot 2018-08-28 14:26:30 PDT
All reviewed patches have been landed.  Closing bug.
Comment 13 Radar WebKit Bug Importer 2018-08-28 14:27:25 PDT
<rdar://problem/43814405>
Comment 14 Ryan Haddad 2018-08-29 16:25:43 PDT
Do we now have the needed information to resolve the issue? This test is consistently failing on iOS bots.

https://build.webkit.org/builders/Apple%20iOS%2011%20Simulator%20Release%20WK2%20%28Tests%29/builds/7110/steps/run-api-tests/logs/stdio
Comment 15 Chris Dumez 2018-08-29 16:47:53 PDT
(In reply to Ryan Haddad from comment #14)
> Do we now have the needed information to resolve the issue? This test is
> consistently failing on iOS bots.
> 
> https://build.webkit.org/builders/
> Apple%20iOS%2011%20Simulator%20Release%20WK2%20%28Tests%29/builds/7110/steps/
> run-api-tests/logs/stdio

Probably the WebView is getting destroyed *before* we realize the WebProcess has exited. When The WebView gets destroyed, we call WebPageProxy::close() which causes error WKErrorWebViewInvalidated as we see in the new test output.
Comment 16 Chris Dumez 2018-08-29 16:53:36 PDT
(In reply to Chris Dumez from comment #15)
> (In reply to Ryan Haddad from comment #14)
> > Do we now have the needed information to resolve the issue? This test is
> > consistently failing on iOS bots.
> > 
> > https://build.webkit.org/builders/
> > Apple%20iOS%2011%20Simulator%20Release%20WK2%20%28Tests%29/builds/7110/steps/
> > run-api-tests/logs/stdio
> 
> Probably the WebView is getting destroyed *before* we realize the WebProcess
> has exited. When The WebView gets destroyed, we call WebPageProxy::close()
> which causes error WKErrorWebViewInvalidated as we see in the new test
> output.

We should probably drop this line:
webView = nullptr;

Not sure why I did this in the first place.