Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Sync v2 takes too long to auto-update after waking phone up from sleep #11714

Open
urbenlegend opened this issue Sep 14, 2020 · 24 comments
Assignees
Labels
feature/sync OS/Android Fixes related to Android browser functionality OS/Desktop priority/P4 Planned work. We expect to get to it "soon".

Comments

@urbenlegend
Copy link

Description

I've noticed that Brave on Android is frequently behind on sync updates and takes anywhere from 1-5 minutes after launching Brave before re-attempting sync. This makes sync features like Send tab to device and Open Tabs Sync almost unusable. This most frequently occurs after not using Brave for a few minutes or when the phone has been asleep for a while.

When Brave is in this state, chrome://sync-internals reports NETWORK_CONNECTION_UNAVAILABLE with a retry time that is often before the current system time. See the screenshot below

Steps to reproduce

  1. Make sure Brave isn't active by going to the phone's home screen.
  2. Turn off the phone screen and let it go to sleep.
  3. Wait 15 minutes (could be shorter, but just playing it safe).
  4. Turn on the phone screen and launch Brave.
  5. Immediately go to chrome://sync-internals
  6. Note that what you see is similar to the below screenshot.
  7. During this time, try to send a tab or two to your phone via desktop Brave.
  8. Note that the Send to device tab notification does not appear on the phone.
  9. Wait for a few minutes for Brave to auto-initiate a sync update
  10. Note that all pending Send to device tab notifications appear all at once.

Actual result

Sending a tab to my Android device frequently takes anywhere from 1-5 minutes because of the issue in the screenshot below.
signal-2020-09-14-145330

Expected result

Sending a tab to Android should trigger an immediate Sync update on my phone and show tab notifications. I should not have to browse to chrome://sync-internals and manually trigger an update. This is poor UX.

Issue reproduces how often

Easily reproduced

Version/Channel Information:

  • Can you reproduce this issue with the current Play Store version? Yes
  • Can you reproduce this issue with the latest stable Github build? Yes
  • Can you reproduce this issue with the current Play Store Beta version? Not tested
  • Can you reproduce this issue with the current Play Store Nightly version? Not tested

Device details

  • Install type (ARM, x86): ARM
  • Device type (Phone, Tablet, Phablet): Pixel 2XL Phone
  • Android version: 11

Brave version

1.13.87

Website problems only

  • Does the issue resolve itself when disabling Brave Shields? No
  • Does the issue resolve itself when disabling Brave Rewards? No
  • Is the issue reproducible on the latest version of Chrome? No

Additional information

I believe this is at the core of some of the other tab sync issues, like #10707

@urbenlegend urbenlegend added the OS/Android Fixes related to Android browser functionality label Sep 14, 2020
@AlexeyBarabash
Copy link
Contributor

today I noticed the same on my daily desktop browser, all types have Backed off status,

parameter status
Throttled or Backoff true
Download Step Result SYNCER_OK
Commit Step Result SERVER_RETURN_TRANSIENT_ERROR

@AlexeyBarabash AlexeyBarabash self-assigned this Sep 15, 2020
@AlexeyBarabash AlexeyBarabash added the priority/P2 A bad problem. We might uplift this to the next planned release. label Sep 15, 2020
@AlexeyBarabash
Copy link
Contributor

Marking P2 because I have now the profile with exactly the same problem.

@urbenlegend
Copy link
Author

urbenlegend commented Sep 16, 2020

Today I encountered this bug on my Surface Pro Windows tablet, except that it never seems to come out of Backed off state even after waiting for several minutes. Sync is much slower. Now it takes about the same amount of time to send a tab between my PC and my tablet as it does between my PC and my Android device. This was not the case before when brave://sync-internals reported everything was normal.

I have a feeling Sync v2 doesn't handle devices coming back from sleep very well. To fix the issue below, I had to leave the sync chain on my tablet and rejoin. The SERVER_RETURN_CONFLICT message in Commit Step Result seems like the main culprit.

Untitled

@AlexeyBarabash
Copy link
Contributor

It is unclear why exactly that happened and impossible to find out for the current moment.

The way to recover Backed off state - toggle off all types, restart the browser and toggle on required types back - this makes the browser re-fetch all the sync data from the beginning and then send its commits. Status will be green again.

I still continue look on my sync chain, maybe will have more luck with guaranteed reproducing of the issue.

@urbenlegend
Copy link
Author

@AlexeyBarabash This issue is pretty reproducible on Android. It happens almost 100% of the time after waking the phone up from sleep and launching Brave. It takes a good 2-3 minutes before status changes to green.

Perhaps the issue we're seeing on desktop, your SERVER_RETURN_TRANSIENT_ERROR and my SERVER_RETURN_CONFLICT may have different root causes than on Android?

@AlexeyBarabash
Copy link
Contributor

@urbenlegend

if you see the yellow status for 3 minutes after and then it goes to green - this may be considered as expected. When there are conflicts this means device cannot send own changes into the sync server, the device must download the latest changes, resolve conflict locally (accept remote/merge/overwrite with local) and then send the changes back to server.

Perhaps the issue we're seeing on desktop, your SERVER_RETURN_TRANSIENT_ERROR and my SERVER_RETURN_CONFLICT may have different root causes than on Android?

Yes, mine was observed on the desktop and hadn't gone away no matter how long I waited, it had been there until I re-toggled the sync category, History and Open Tabs.

@urbenlegend
Copy link
Author

if you see the yellow status for 3 minutes after and then it goes to green - this may be considered as expected.

This would mean that we're waiting up to 3 minutes for things like Open Tab sync and Send Tab to Device. That isn't a good user experience. Things seem to be syncing much faster in regular Chrome.

resolve conflict locally (accept remote/merge/overwrite with local) and then send the changes back to server.

Shouldn't the browser resolve those changes automatically? Seems a bit intense to expect the user to go to brave://sync-internals, check status, and then toggle Sync on and off.

@urbenlegend
Copy link
Author

urbenlegend commented Oct 6, 2020

I reproduced this again today. I don't know the exact steps otherwise I would list them here, but I was testing out different shield configuration settings under Settings->Shields, clearing out Site and Shield settings, and restarting the browser frequently. After a few rounds of changing those settings and restarting the browser, I discovered that I was again not able to effectively send tabs from one device to another. brave://sync-internals once again shows a SERVER_RETURN_CONFLICT.

Perhaps try reproducing by toggling Shields global settings a few times and restarting the browser in rapid succession?

EDIT: I should also mention that my computer experienced a few hard crashes as well, so maybe Brave was in the middle of sync when that happened? Not sure, really wish I could provide more details and steps to reproduce, but it is what it is.

@urbenlegend
Copy link
Author

I am now getting SERVER_RETURN_TRANSIENT_ERROR on at least one of my devices every other day. It makes Sync horribly unreliable. Has there been any progress on this?

@snowbound
Copy link

I find Sync v2 unreliable on the desktop under Version 1.20.85 Chromium: 88.0.4324.96 (Official Build) beta (64-bit) between two Win10 20H2 computers. Computer A sees all the Open Tabs from computer B yet computer B only sees two open tabs from computer A. starting a new sync chain fixes it but it will probably go again. Computer A is a laptop and as such is hibernating each day and I am wondering if that is the issue with computer A not being able to see the Open Tabs reliably even when the laptop has been in use for hours.

@lazymonkey2
Copy link

it was working fine on windows machine (3 windows 10 desktops).
then I recently added and android device and now I get SERVER_RETURN_CONFLICT errors.

@urbenlegend
Copy link
Author

Has there been any updates on this? This bug really hinders the sync experience on Android and is a frequent source of complaints on the Brave subreddit. Currently, I haven't run into any other issues besides the NETWORK_CONNECTION_UNAVAILABLE issue that I first posted about in the bug report. Brave just refuses to initiate sync when the phone is coming out of sleep. Is there a way to force sync?

@snowbound
Copy link

Well my current situation after battling with this issue on the desktop to a laptop for months, in my case is that I disabled sync. I rarely use my laptop these days and my phone is iOS and open tabs sync is non-existant.

@MrGreenPro94
Copy link

Why i can t send my Pages to a other Device?

@urbenlegend
Copy link
Author

@MrGreenPro94 You can, it just takes a really long time the pages to get there. It can take anywhere from 1-3 minutes.

@MrGreenPro94
Copy link

@urbenlegend i use now a extensions as work arouns and it make it easier. I use Pocket

@AlexeyBarabash AlexeyBarabash added priority/P3 The next thing for us to work on. It'll ride the trains. and removed priority/P2 A bad problem. We might uplift this to the next planned release. labels Jan 9, 2023
@AlexeyBarabash AlexeyBarabash removed the priority/P3 The next thing for us to work on. It'll ride the trains. label Jan 9, 2023
@AlexeyBarabash AlexeyBarabash added the priority/P4 Planned work. We expect to get to it "soon". label Jan 9, 2023
@urbenlegend
Copy link
Author

@AlexeyBarabash Any progress on this bug? I am still seeing this issue on Android and it always delays sync by a few minutes whenever it happens.

@AlexeyBarabash
Copy link
Contributor

@urbenlegend no, unfortunately. I made another attempt today to reproduce it with Android <=> Windows devices chain, but no luck.

@urbenlegend
Copy link
Author

@urbenlegend no, unfortunately. I made another attempt today to reproduce it with Android <=> Windows devices chain, but no luck.

Are you saying that it works for you even after a long period of not using the phone? I can only trigger the bug when I start using Brave after my phone has been sitting idle for a while. It seems like the sync service has a hard time resuming operation from an idle state.

@AlexeyBarabash
Copy link
Contributor

@urbenlegend , yes.
Yesterday I didn't do long pauses while tried to reproduce the issue. But today after more than 15 hours of inactivity I checked it and sync was ok, all datatypes statuses were green.

@urbenlegend
Copy link
Author

@AlexeyBarabash Do you have battery optimization enabled or disabled for Brave? I am wondering if it has something to do with power management.

@AlexeyBarabash
Copy link
Contributor

@urbenlegend it is default, marked as Optimized at Google Pixel 6, Android 13:

                                                                Screenshot                                                                              image

I believe when the app is not used, it gets terminated.

@vfonic
Copy link

vfonic commented Apr 22, 2023

I have this issue happening...always. The tab takes about a couple of minutes to "arrive" between devices. Every. Time.

And, seeing that there are so many other people mentioning this, I wouldn't discard this issue so quickly.

I'm on macOS and Android. Is there anything I can do to try to fix this on my end?

Thanks!

@markuszeller
Copy link

It happens to be slow regardless of what types of devices are involved. Even from desktop to desktop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/sync OS/Android Fixes related to Android browser functionality OS/Desktop priority/P4 Planned work. We expect to get to it "soon".
Projects
Status: P3, P4, & P5 backlog
Development

No branches or pull requests

7 participants