mozilla-mobile / mozilla-vpn-client

A fast, secure and easy to use VPN. Built by the makers of Firefox.
https://vpn.mozilla.org
Other
470 stars 113 forks source link

[Intermittent] “Unable to connect” / “No internet connection” banners displayed when attempting to sign in / sign up #8895

Open data-sync-user opened 10 months ago

data-sync-user commented 10 months ago

Important details:

Affected VPN versions

Tested platforms:

Prerequisites:

Steps to reproduce:

  1. Sign in with the account from prerequisites;
  2. Observe the behavior;

Expected result:

Actual result:

Notes:

┆Issue is synchronized with this Jira Bug ┆Reporter: Bianca Hidecuti

data-sync-user commented 10 months ago

➤ Lesley Norton commented:

Thanks Bianca Hidecuti - does this repro in previous versions or is this new to 2.20?

data-sync-user commented 10 months ago

➤ Bianca Hidecuti commented:

Lesley Norton, we have seen this only in 2.20 as of yesterday (and only on Stage server), but we are not sure if this is related with the build / version of the VPN or if there are some issues with Guardian / FxA as well, since some sign in issues were encountered on web too (see https://mozilla-hub.atlassian.net/browse/FXA-8866 ( https://mozilla-hub.atlassian.net/browse/FXA-8866|smart-link )).

However, besides the red banners, we were able to see a “Sign in failed - No internet connection” modal 2 or 3 times when we were unable to authenticate (this cannot be triggered when being disconnected from the internet). Was this implemented in 2.20? Thanks!

!modal.png|width=372,height=678!

data-sync-user commented 10 months ago

➤ Bianca Hidecuti commented:

We were unable to reproduce this in the last 2 days, using Mozilla VPN 2.20.0 (2.202401041847), across platforms.

If this will be encountered again, we will reopen the ticket.

Marking this verified as fixed.

data-sync-user commented 9 months ago

➤ Raluca Monica Ilban commented:

Reopening the ticket as it is reproducible again using Mozilla VPN build 2.20.0 (2.202401282210).

Unable to connect red banner is displayed when user tries to sign in.

Attaching logs.

[^mozillavpn-2024-1-29.log] [^mozillavpn.log]

data-sync-user commented 9 months ago

➤ Lesley Norton commented:

tl;dr

Some requests to FxA are timing out and the TimeoutError is being handled in two places AuthenticationInAppSession and ErrorHandler. The former leads to the ‘Signin failed’ modal, and the latter triggers the ‘Unable to connect’ red banner.

Details

Notable logs:

9.01.2024 11:44:37.673] (NetworkRequest) Debug: Network request created by TaskAuthenticate [29.01.2024 11:44:52.755] (NetworkRequest) Error: Network request timeout [29.01.2024 11:44:52.755] (AuthenticationInAppSession) Error: Failed to check the account status QNetworkReply::TimeoutError [29.01.2024 11:44:52.756] (ErrorHandler) Debug: Handling error ErrorHandler::DependentConnectionError [29.01.2024 11:44:52.756] (ErrorHandler) Error: Alert: ErrorHandler::ConnectionFailedAlert{quote}Was this implemented in 2.20? Thanks!{quote}

Bianca Hidecuti no, this modal was implemented along with the rest of the in-app auth flow. We show this modal when a request to FXA (https://api.accounts.firefox.com/v1/account/login, specifically) times out. (https://github.com/mozilla-mobile/mozilla-vpn-client/blob/9d6188addb0014a86aae6fdb84b160f808ad7b1e/src/authenticationinapp/authenticationinappsession.cpp#L314 ( https://github.com/mozilla-mobile/mozilla-vpn-client/blob/9d6188addb0014a86aae6fdb84b160f808ad7b1e/src/authenticationinapp/authenticationinappsession.cpp#L314 )). We then assume that the request has timed out because no internet is available, return the user to authentication start, and pop the “Sign-in failed. No internet connection” modal. The request could time out for any number of reasons though so this is lazy handling on our end.

{quote}Unable to connect red banner is displayed when user tries to sign in.{quote}

This happens when a TimeoutError is caught in the ErrorHandler ( https://github.com/mozilla-mobile/mozilla-vpn-client/blob/9d6188addb0014a86aae6fdb84b160f808ad7b1e/src/errorhandler.cpp#L131-L132 ) , reclassified as that ‘DependentConnectionError’ we see in the logs and triggers the ‘Unable to Connect’ banner. ( https://github.com/mozilla-mobile/mozilla-vpn-client/blob/9d6188addb0014a86aae6fdb84b160f808ad7b1e/nebula/ui/components/MZSystemAlert.qml#L51-L57 )

Next steps

  1. We need to determine why requests are timing out. Bianca Hidecuti are you seeing this on production or just stage?
  2. We should determine what to do when these requests timeout and we’ve confirmed that the internet is available (try again? how many times?) and be smarter about how and when we show these messages generally.
data-sync-user commented 9 months ago

➤ Lesley Norton commented:

(2024-01-31) tl;dr

Some requests to FxA are timing out and the TimeoutError is being handled in two places AuthenticationInAppSession and ErrorHandler. The former leads to the ‘Signin failed’ modal, and the latter triggers the ‘Unable to connect’ red banner.

Details

Notable logs:

9.01.2024 11:44:37.673] (NetworkRequest) Debug: Network request created by TaskAuthenticate [29.01.2024 11:44:52.755] (NetworkRequest) Error: Network request timeout [29.01.2024 11:44:52.755] (AuthenticationInAppSession) Error: Failed to check the account status QNetworkReply::TimeoutError [29.01.2024 11:44:52.756] (ErrorHandler) Debug: Handling error ErrorHandler::DependentConnectionError [29.01.2024 11:44:52.756] (ErrorHandler) Error: Alert: ErrorHandler::ConnectionFailedAlert{quote}Was this implemented in 2.20? Thanks!{quote}

Bianca Hidecuti no, this modal was implemented along with the rest of the in-app auth flow. We show this modal when a request to FXA (https://api.accounts.firefox.com/v1/account/login, specifically) times out. (https://github.com/mozilla-mobile/mozilla-vpn-client/blob/9d6188addb0014a86aae6fdb84b160f808ad7b1e/src/authenticationinapp/authenticationinappsession.cpp#L314 ( https://github.com/mozilla-mobile/mozilla-vpn-client/blob/9d6188addb0014a86aae6fdb84b160f808ad7b1e/src/authenticationinapp/authenticationinappsession.cpp#L314 )). We then assume that the request has timed out because no internet is available, return the user to authentication start, and pop the “Sign-in failed. No internet connection” modal. The request could time out for any number of reasons though so this is lazy handling on our end.

{quote}Unable to connect red banner is displayed when user tries to sign in.{quote}

This happens when a TimeoutError is caught in the ErrorHandler ( https://github.com/mozilla-mobile/mozilla-vpn-client/blob/9d6188addb0014a86aae6fdb84b160f808ad7b1e/src/errorhandler.cpp#L131-L132 ) , reclassified as that ‘DependentConnectionError’ we see in the logs and triggers the ‘Unable to Connect’ banner. ( https://github.com/mozilla-mobile/mozilla-vpn-client/blob/9d6188addb0014a86aae6fdb84b160f808ad7b1e/nebula/ui/components/MZSystemAlert.qml#L51-L57 )

Next steps

  1. We need to determine why requests are timing out. Bianca Hidecuti are you seeing this on production or just stage?
  2. We should determine what to do when these requests timeout and we’ve confirmed that the internet is available (try again? how many times?) and be smarter about how and when we show these messages generally.
data-sync-user commented 9 months ago

➤ Bianca Hidecuti commented:

Lesley Norton, thanks for the answers!

  1. So far we were able to see this only on Stage server. Regarding the modal and the banner:
    1. we saw the modal only when the ticket was filed, and if I recall correctly, the banner was displayed after closing the modal. Few days ago when we encountered the issue again, only the banner was displayed.

I have a question about the following:

{quote}We then assume that the request has timed out because no internet is available, return the user to authentication start, and pop the “Sign-in failed. No internet connection” modal.{quote}

If there was no internet available at the time, shouldn't we be able to trigger the modal when disconnecting from the internet? Thanks!

data-sync-user commented 9 months ago

➤ Lesley Norton commented:

{quote}If there was no internet available at the time, shouldn't we be able to trigger the modal when disconnecting from the internet?{quote}

You would certainly think so. Mind attaching logs for this flow with wifi turned off?

data-sync-user commented 9 months ago

➤ Bianca Hidecuti commented:

Lesley Norton, I am attaching logs for the IAA flow while there is no internet connection (I’ve disconnected from the internet while being in the password screen and pressed the “Sign in” button).

[^mozillavpn-2024-2-1.log]

data-sync-user commented 8 months ago

➤ Bianca Hidecuti commented:

We were able to reproduce this today (02/19) while creating a new account within the client using the 2.21 version, on macOS 12.6.6 and on Android 10 - Stage server:

Attaching logs as well.

[^unable to connect 2.21 mozillavpn-2024-2-19_1.log] [^MozillaVPN_Logs_2024-40-19-14-40-07.txt]

data-sync-user commented 8 months ago

➤ Bianca Hidecuti commented:

Lesley Norton, I was also able to see the “No internet connection” modal on Mozilla VPN 2.21 - stage server. Attaching logs.

[^modal mozillavpn-2024-2-19_1.log]

!Снимок экрана 2024-02-19 в 16.00.13.png|width=357,height=670!