Bug 207916 - Add logging to help diagnose redirect issue
Summary: Add logging to help diagnose redirect issue
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Rollin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-18 15:10 PST by Keith Rollin
Modified: 2020-02-26 13:13 PST (History)
8 users (show)

See Also:


Attachments
Patch (38.41 KB, patch)
2020-02-18 15:13 PST, Keith Rollin
no flags Details | Formatted Diff | Diff
Patch (39.07 KB, patch)
2020-02-25 16:50 PST, Keith Rollin
no flags Details | Formatted Diff | Diff
Patch (39.43 KB, patch)
2020-02-26 11:52 PST, Keith Rollin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Rollin 2020-02-18 15:10:29 PST
We're seeing an issue where communication between the WebContent process and the Network process seems to come to a stop between NetworkResourceLoader::continueWillSendRedirectedRequest and NetworkResourceLoader::continueWillSendRequest. We do see a WebResourceLoader::willSendRequest log line between those two NetworkResourceLoader logging lines, but nothing else. Add a bunch of logging in this area to help determine what's happening.
Comment 1 Radar WebKit Bug Importer 2020-02-18 15:10:42 PST
<rdar://problem/59567875>
Comment 2 Keith Rollin 2020-02-18 15:13:19 PST
Created attachment 391100 [details]
Patch
Comment 3 Keith Rollin 2020-02-21 11:14:14 PST
bump.
Comment 4 Simon Fraser (smfr) 2020-02-25 12:58:33 PST
Comment on attachment 391100 [details]
Patch

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

> Source/WebCore/loader/PolicyChecker.cpp:56
> +#define RELEASE_LOG_ALWAYS(fmt, ...) RELEASE_LOG(Loading, "%p - PolicyChecker::" fmt, this, ##__VA_ARGS__)

Don't we normally use RELEASE_LOG_IF_ALLOWED?

> Source/WebCore/loader/PolicyChecker.cpp:133
> +        RELEASE_LOG_ALWAYS("checkNavigationPolicy: continuing because empty URL");

These all need to log some context (pageID, processIdentifier or something).
Comment 5 Keith Rollin 2020-02-25 13:01:39 PST
(In reply to Simon Fraser (smfr) from comment #4)
> Comment on attachment 391100 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=391100&action=review
> 
> > Source/WebCore/loader/PolicyChecker.cpp:56
> > +#define RELEASE_LOG_ALWAYS(fmt, ...) RELEASE_LOG(Loading, "%p - PolicyChecker::" fmt, this, ##__VA_ARGS__)
> 
> Don't we normally use RELEASE_LOG_IF_ALLOWED?

If possible. The policy for whether or not to perform logging is based on private browsing, which is based on the Session. I don't know if one is available here, but I'll double-check.

> 
> > Source/WebCore/loader/PolicyChecker.cpp:133
> > +        RELEASE_LOG_ALWAYS("checkNavigationPolicy: continuing because empty URL");
> 
> These all need to log some context (pageID, processIdentifier or something).

That information is usually applied in the RELEASE_LOG_ALWAYS macro, so you wouldn't see it at the call site. That said, I don't see any additional information in the macro. I'll see if there's anything appropriate.
Comment 6 Keith Rollin 2020-02-25 13:06:54 PST
There's no SessionID immediately available to the Policy checking. It doesn't have one as a member, and none is passed in as a parameter anywhere.

Similarly, there is no pageID or frameID information anywhere.

Indirectly, the PolicyChecker has a Frame reference. But this class doesn't have a SessionID or frameID, either.

ProcessID is standard as part of all logging.

In light of all this, can you think of anything else you'd like to see added to the logging?
Comment 7 Simon Fraser (smfr) 2020-02-25 13:28:00 PST
(In reply to Keith Rollin from comment #6)
> There's no SessionID immediately available to the Policy checking. It
> doesn't have one as a member, and none is passed in as a parameter anywhere.
> 
> Similarly, there is no pageID or frameID information anywhere.
> 
> Indirectly, the PolicyChecker has a Frame reference. But this class doesn't
> have a SessionID or frameID, either.
> 
> ProcessID is standard as part of all logging.
> 
> In light of all this, can you think of anything else you'd like to see added
> to the logging?

Can you get the FrameIdentifier via the FrameLoaderClient?

I'm not sure why FrameIdentifier doesn't live on Frame.

Do resource loads have some kind of identifier we can log?
Comment 8 Keith Rollin 2020-02-25 13:45:26 PST
(In reply to Simon Fraser (smfr) from comment #7)
> 
> Can you get the FrameIdentifier via the FrameLoaderClient?

I see pageID and frameID in FrameLoaderClient. I'll toss those in. Chris points out that the Frame has a Page reference, which will have a SessionID, so I can add that, too.

> Do resource loads have some kind of identifier we can log?

They do, but I don't think we have any in the context of PolicyChecker calls.
Comment 9 Keith Rollin 2020-02-25 16:47:03 PST
PolicyChecker logging now looks like:

2020-02-25 16:41:54.252851-0800 0x158edc5  Default     0x0                  35354  0    com.apple.WebKit.WebContent.Development: (WebCore) [com.apple.WebKit:Loading] 0x609c76bd0 - [pageID=19, frameID=3] PolicyChecker::checkNavigationPolicy: continuing because this policyAction from dispatchDecidePolicyForNavigationAction is Use
...
2020-02-25 16:41:56.238576-0800 0x158ed55  Default     0x0                  35352  0    com.apple.WebKit.WebContent.Development: (WebCore) [com.apple.WebKit:Loading] 0x6c1c96d20 - [pageID=10, frameID=3] PolicyChecker::checkNavigationPolicy: stopping because policyAction from dispatchDecidePolicyForNavigationAction is StopAllLoads
Comment 10 Keith Rollin 2020-02-25 16:50:51 PST
Created attachment 391703 [details]
Patch
Comment 11 Chris Dumez 2020-02-26 09:30:48 PST
Comment on attachment 391703 [details]
Patch

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

r=me with fixes

> Source/WebCore/ChangeLog:15
> +        Reviewed by NOBODY (OOPS!).

This comes *before* the description.

> Source/WebKit/ChangeLog:15
> +        Reviewed by NOBODY (OOPS!).

Ditto.

> Source/WebCore/loader/PolicyChecker.cpp:136
> +        RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: continuing because empty URL");

or because it is the same as last request.

> Source/WebCore/loader/PolicyChecker.cpp:155
> +            RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: ignoring because the content filter told us not to");

This should say that we are not continuing *with substitute data*, to indicate clearly that we are in the substitute data code path.

> Source/WebCore/loader/PolicyChecker.cpp:188
> +        RELEASE_LOG_IF_ALLOWED("checkNavigationPolicy: ignoring because mumble-content-filter-unblock-handler-mumble");

because ContentFilterUnblockHandler can handle the request

> Source/WebCore/loader/ResourceLoader.cpp:397
> +            RELEASE_LOG_IF_ALLOWED("willSendRequestInternal: resource load reached terminal state");

... after calling assignIdentifierToInitialRequest()

> Source/WebCore/loader/SubresourceLoader.cpp:192
> +        RELEASE_LOG_IF_ALLOWED("willSendRequestInternal: resource load canceled because request is invalid");

*new* request

> Source/WebCore/loader/SubresourceLoader.cpp:206
> +                RELEASE_LOG_IF_ALLOWED("willSendRequestInternal: resource load canceled because request is NULL (1)");

*new* request is null

> Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:817
> +        WEBFRAMELOADERCLIENT_RELEASE_LOG(Network, "dispatchDecidePolicyForResponse: continuing because the url string is empty");

s/empty/null
Comment 12 Keith Rollin 2020-02-26 11:52:10 PST
Created attachment 391763 [details]
Patch
Comment 13 WebKit Commit Bot 2020-02-26 13:13:01 PST
Comment on attachment 391763 [details]
Patch

Clearing flags on attachment: 391763

Committed r257505: <https://trac.webkit.org/changeset/257505>
Comment 14 WebKit Commit Bot 2020-02-26 13:13:03 PST
All reviewed patches have been landed.  Closing bug.