Canceling a slow loading navigation without triggering a net error for HTTPS-Upgrades

357 views
Skip to first unread message

Mustafa Emre Acer

unread,
Sep 19, 2024, 7:00:46 PM9/19/24
to Christopher Thompson, navigat...@chromium.org

I'm trying to cancel a navigation timeout (set by SetNavigationTimeout) without triggering a visible net error as a fix for crbug.com/41488861. I'd appreciate any suggestions that could prevent these noisy error pages for what's supposed to be "silent" upgrades.


Context:


HTTPS-Upgrades feature opportunistically upgrades HTTP navigations HTTPS. If the upgraded HTTPS load takes long, the upgrade is canceled and the original HTTP URL is loaded as a fallback. We call this fast-fallback.


To support fast-fallbacks, we introduced the concept of navigation timeouts:


Presently, an upgraded HTTPS load is initiated with a timeout of 3 seconds. When it times out, the HTTPS upgrade interceptor handles the failed upgrade and initiates a fallback navigation. A fallback navigation is initiated by first allowlisting the HTTP URL (so that it's not upgraded again), then loading it again in the same tab. A URL is also allowlisted if it's part of a redirect chain. 


In https://crbug.com/41488861#comment22, a combination of a slow redirect and a redirect loop is causing the net error to be visible for a short while.


This scenario seems to happen frequently enough that it's impacting our metrics for an HTTPS-Upgrade related launch.

As a potential fix, I tried introducing a CancelNavigationTimeout() and calling it on redirects, but obviously this breaks the fast-fallback logic. E.g. If an upgraded URL (https://a.com) redirects to https://slow.com, we won't fast-fallback and the upgrade will hang.


Thanks!

Mustafa


Mustafa Emre Acer

unread,
Sep 19, 2024, 7:00:52 PM9/19/24
to Christopher Thompson, navigat...@chromium.org
Another incomplete idea was to introduce a new net error code to be returned only for navigation timeouts and also exclude it from net error pages. It wasn't clear to us if this is feasible. 

Rakina Zata Amni

unread,
Sep 20, 2024, 9:06:54 AM9/20/24
to Mustafa Emre Acer, Christopher Thompson, navigat...@chromium.org
Is the problem about the navigation cancellation that's caused by the navigation timeout commits an error page, while the new navigation is still ongoing? Is it possible to use a pre-existing error code for the navigation timeout cancellation, that makes the navigation be silently cancelled instead of committing an error page (e.g. ERR_ABORTED)?

--
You received this message because you are subscribed to the Google Groups "navigation-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to navigation-de...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/navigation-dev/CAHafXh3jWg6ecGk0JjAMZGHt29qG1WAw8DYuK2JpiHSK5oCquA%40mail.gmail.com.

Chris Thompson

unread,
Sep 20, 2024, 9:11:28 PM9/20/24
to Mustafa Emre Acer, Rakina Zata Amni, navigat...@chromium.org
Interestingly, I quickly tried modifying NavigationUrlLoaderImpl::SetNavigationTimeout() to use ERR_ABORTED and it looks like it is correctly triggering the HttpsUpgradesInterceptor::MaybeCreateLoaderForResponse() flow for serving the followup redirect in the common case (e.g., navigating to http://httpbin.org/delay/10) and in the simple redirect-to-timeout case (e.g., https://httpbin.org/redirect-to?url=http%3A%2F%2Fhttpbin.org%2Fdelay%2F10). But it doesn't work for the slightly more complicated redirect-loop-with-timeout bug repro case (crbug.com/41488861#comment22) -- there instead of the flash of the net error page we get a real aborted navigation which prevents the followup redirect entirely.

On Fri, Sep 20, 2024 at 2:05 PM Mustafa Emre Acer <mea...@chromium.org> wrote:
Also, apologies, I used the wrong URL for the "original thread" link. It should be https://groups.google.com/a/chromium.org/g/navigation-dev/c/BrXS3578Vew/m/qLTYANB8CAAJ instead.

On Fri, Sep 20, 2024 at 1:58 PM Mustafa Emre Acer <mea...@chromium.org> wrote:
Hi Rakina,

> Is the problem about the navigation cancellation that's caused by the navigation timeout commits an error page, while the new navigation is still ongoing?

Yes. And because the timed-out navigation is allowlisted (because it was part of a redirect chain), its error page will show briefly, until the fallback navigation completes.

>  Is it possible to use a pre-existing error code for the navigation timeout cancellation, that makes the navigation be silently cancelled instead of committing an error page (e.g. ERR_ABORTED)?

It appears that ERR_ABORTED aborts the whole navigation including subsequent redirects. Is that expected? With ERR_TIMEOUT, SetNavigationTimeout() cancels the current redirect hop, but subsequent navigations (including the fallback navigation) still take place. 

Mustafa Emre Acer

unread,
Sep 20, 2024, 9:11:28 PM9/20/24
to Chris Thompson, Rakina Zata Amni, navigat...@chromium.org
Indeed, I was testing with the redirect-loop-with-timeout repro case in that bug and saw the same behavior. I also quickly tried adding a new error code (HTTPS_UPGRADE_TIMED_OUT), and the flash of the net error still appeared, this time with the updated error code. So a custom error code doesn't seem appropriate either.

Mustafa Emre Acer

unread,
Sep 20, 2024, 9:11:28 PM9/20/24
to Rakina Zata Amni, Christopher Thompson, navigat...@chromium.org
Also, apologies, I used the wrong URL for the "original thread" link. It should be https://groups.google.com/a/chromium.org/g/navigation-dev/c/BrXS3578Vew/m/qLTYANB8CAAJ instead.

On Fri, Sep 20, 2024 at 1:58 PM Mustafa Emre Acer <mea...@chromium.org> wrote:
Hi Rakina,

> Is the problem about the navigation cancellation that's caused by the navigation timeout commits an error page, while the new navigation is still ongoing?

Yes. And because the timed-out navigation is allowlisted (because it was part of a redirect chain), its error page will show briefly, until the fallback navigation completes.

>  Is it possible to use a pre-existing error code for the navigation timeout cancellation, that makes the navigation be silently cancelled instead of committing an error page (e.g. ERR_ABORTED)?

It appears that ERR_ABORTED aborts the whole navigation including subsequent redirects. Is that expected? With ERR_TIMEOUT, SetNavigationTimeout() cancels the current redirect hop, but subsequent navigations (including the fallback navigation) still take place. 

On Fri, Sep 20, 2024 at 6:06 AM Rakina Zata Amni <rak...@chromium.org> wrote:

Mustafa Emre Acer

unread,
Sep 20, 2024, 9:11:28 PM9/20/24
to Rakina Zata Amni, Christopher Thompson, navigat...@chromium.org
Hi Rakina,

> Is the problem about the navigation cancellation that's caused by the navigation timeout commits an error page, while the new navigation is still ongoing?

Yes. And because the timed-out navigation is allowlisted (because it was part of a redirect chain), its error page will show briefly, until the fallback navigation completes.

>  Is it possible to use a pre-existing error code for the navigation timeout cancellation, that makes the navigation be silently cancelled instead of committing an error page (e.g. ERR_ABORTED)?

It appears that ERR_ABORTED aborts the whole navigation including subsequent redirects. Is that expected? With ERR_TIMEOUT, SetNavigationTimeout() cancels the current redirect hop, but subsequent navigations (including the fallback navigation) still take place. 

On Fri, Sep 20, 2024 at 6:06 AM Rakina Zata Amni <rak...@chromium.org> wrote:
Reply all
Reply to author
Forward
0 new messages