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

Brave freezes or hangs on launch when there are a large number of Cookies and other site data #9481

Closed
bsclifton opened this issue Apr 27, 2020 · 128 comments · Fixed by brave/brave-core#6126

Comments

@bsclifton
Copy link
Member

bsclifton commented Apr 27, 2020

Description

We have several reports from users on all Desktop OSes having a hang or complete freeze of the program when launching. After investigation, this appears to be due to a large number of entries under brave://settings/content/all

Clearing Cookies and other site data will resolve the issue until the user builds up a large number of sites again. @iefremov has characterized the problem (see #9481 (comment)) and we're working on a fix

Test plan

  1. QA to contact @bsclifton for minimal reproducible profile
  2. Put profile into place
  3. Launch version of Brave without this fix
  4. Confirm it takes a while to load
  5. Launch version of Brave with this fix
  6. Confirm it loads instantly

Original issue description

Below is the text from when we were diagnosing this issue. There were multiple problems in play and some of those were split out into separate issues. The text is being kept for posterity

GitHub issues

Newly updated Brave freezes after launch - Windows 10 #9372
- started happening with 1.7.98 (Chromium 81)
- multiple users experience freeze for 20 or more seconds, but it's fine after that
- useful crash dumps shared in issue 🎉 @bsclifton looking into these
- many users had rewards off or toggled rewards off for troubleshooting

Brave Beta hangs on start after update #9162
- user reported issue with 81.1.8.70 (Chromium 81)
- UI unusable to the point where menu can't be opened

System randomly freezing #9294
- seems to be GPU related
- one user reports disabling HW acceleration fixes problem

Possibly related issues

Community issues

Recommended user troubleshooting steps

Things that can help us narrow it down

  • If you're on macOS, check to see if you have the accessibility keyboard enabled under System Preferences > Accessibility > Keyboard > Accessibility Keyboard. There is a known crash if this is enabled... so until this is fixed, it's recommended you disable.
  • Try updating/re-installing your video drivers
  • Disable Sync unless you're using Brave 1.12 or newer
  • Ubuntu users who are using the Snap might try using the official repo

Steps that some people have used to fix the problem

We're working on a fix now - stay tuned.

  • Some folks who had toggled rewards and were having hangs every 1 - 3 days where BAT Ledger process takes 100% CPU and then goes back down may be fixed as of 1.8 🎉 Please make sure to update to latest version of Brave

Following these steps will lead to data loss. Please consider backing up your profile before attempting! If you're not sure how to do that, please ask here

Fixes that have already been released

Known problems (not being addressed)

  • 1.7.98 (1.7 hotfix 1) introduced migration code for cookie and no-script settings. This is only done once, but it could explain some UI hang that folks experience if they have a lot of cookie or no-script settings. @mkarolin looked into this; having over 300 different content settings could cause a problem- but once it finishes, it won't happen again. @bsclifton tried with as many as 100 content settings on an old laptop and it wasn't noticeable. If we wanted to investigate further, we can create an issue and look at WIP: Speed up shields settings migration. brave-core#5453
@bsclifton
Copy link
Member Author

bsclifton commented Apr 27, 2020

For folks that are experiencing lock-ups because of the publisher list being downloaded (for Brave Rewards), there are some great fixes coming in 1.8. One of those fixes a bug where this list continues to be downloaded even after flipping rewards to off
brave/brave-core#5356

We'll have a release candidate available soon which I'll try to share when it completes

@bsclifton
Copy link
Member Author

For anyone tracking this who would like to try the 1.8 release candidate, please download and try out https://github.com/brave/brave-browser/releases/tag/v1.8.84 and let us know if this improves behavior 😄

@riccardoangius
Copy link

riccardoangius commented Apr 27, 2020

Thank you. Clean install is still crashing on my side though.

Uploaded Crash Report ID 10280000-64a1-5604-0000-000000000000 (Local Context: 2caabdb7-d67a-4bb5-9da8-4c0c5bd35194)
Crash report captured on Monday, 27 April 2020 at 13:29:56, uploaded on Monday, 27 April 2020 at 13:33:21

╰─$ "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser" 130 ↵
[771:775:0427/132940.577124:ERROR:browser_switcher_service.cc(238)] XXX Init()
[771:70147:0427/132941.529922:ERROR:rewards_service_impl.cc(243)] Failed to read file: /Users/ric/Library/Application Support/BraveSoftware/Brave-Browser/Default/rewards_service/confirmations.json
[781:775:0427/132941.580832:ERROR:confirmations_impl.cc(770)] Failed to load confirmations state, resetting to default values
[771:26883:0427/132941.997449:ERROR:rewards_service_impl.cc(192)] Failed to read file: /Users/ric/Library/Application Support/BraveSoftware/Brave-Browser/Default/ledger_state
[781:775:0427/132941.997833:ERROR:ledger_impl.cc(113)] Failed to initialize wallet
[771:775:0427/132953.873775:ERROR:CONSOLE(0)] "Unchecked runtime.lastError: Cannot access contents of url "chrome://newtab/". Extension manifest must request permission to access this host.", source: chrome-extension://mnojpmjdmbbfmejpflffifhffcmidifd/_generated_background_page.html (0)
[0427/132956.629002:WARNING:process_memory_mac.cc(93)] mach_vm_read(0x7ffee7e27000, 0x2000): (os/kern) invalid address (1)
[0427/132956.789760:WARNING:system_snapshot_mac.cc(42)] sysctlbyname kern.nx: No such file or directory (2)
[0427/132957.004757:WARNING:crash_report_exception_handler.cc(239)] UniversalExceptionRaise: (os/kern) failure (5)
[813:775:0427/132957.038559:ERROR:child_thread_impl.cc(222)] Invalid PlatformChannel receive right
[1] 771 illegal hardware instruction "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"

EDIT: also tried the suggested flags, to no avail.

@onmyouji
Copy link

Same here on Windows 10, it still freezes.

brave.exe_200427_193816.zip

@Xyncgas
Copy link

Xyncgas commented Apr 27, 2020

YES

@Xyncgas
Copy link

Xyncgas commented Apr 27, 2020

how did the update get to stable by the way

@bsclifton
Copy link
Member Author

bsclifton commented Apr 27, 2020

@riccardoangius for your issue, when was the last time Brave worked for you? Do you know the version you had?

Looking at the call stack, it's a bit hard to tell. But I am seeing some USB/bluetooth keyboard problems. Can you please try turning off your bluetooth keyboard and then launching Brave (mouse-only).

The errors I'm seeing are saying you're missing the entitlement (Catalina thing) for this keyboard to allow bluetooth control. This might be something that needs to be added in System Preferences

@bsclifton
Copy link
Member Author

bsclifton commented Apr 27, 2020

how did the update get to stable by the way

This never came up in any of our testing - even now, there are crash reports... but there aren't many clues. Without a solid way to reproduce, it's very difficult to find the root cause ☹️

@Xyncgas did the release candidate work for you?

@riccardoangius
Copy link

riccardoangius commented Apr 27, 2020

@bsclifton thank you.

I have no BT keyboard, so I looked around a bit and stumbled upon this.

Looked around and indeed I hadn't enabled Accessibility Keyboard (as in the linked thread) but Typing feedback was on and turning it off solved it all for me.

I was checking the UX for an accessible app I was developing and completely forgot about it 🤦🏻‍♂️

@bsclifton
Copy link
Member Author

bsclifton commented Apr 27, 2020

@riccardoangius this is great! Thanks for finding 😄 I believe we captured the above issue (accessibility keyboard) with #7546 but haven't solved it yet

macOS users please do try turning this off, if that is an option for you. For those who need it, a fix should be coming in Chromium 83 which we're working through now (Chromium 82 was skipped by Chrome team). Expected to be released May 19th

@onmyouji
Copy link

Btw, is there any way to block/disable Brave automatic update?

I tested downgrading to Release Channel v1.7.92 and everything is working fine. But when I went to Help-About and try to update again, the same issue happened.

@bsclifton
Copy link
Member Author

bsclifton commented Apr 27, 2020

@onmyouji yes - I believe as a manual work-around you can install 1.7.92 and then find the BraveUpdate.exe. I believe this is in c:\Program Files (x86)\BraveSoftware\Brave-Browser. Use task manager to kill this process (I think you can also right click process and find it in task manager) and then you can rename this as BraveUpdate.exe.old or similar. It shouldn't re-launch

Having it work with 1.7.92 seems like it's a problem with the Chromium 81 upgrade we did. Thanks for helping us troubleshoot this 😄

@GitOutWest
Copy link

GitOutWest commented Apr 27, 2020

I’ll also mention that [Google] Chrome doesn’t have this problem. So I don't think it's Chromium 81.x all by itself.
Chrome: 81.0.4044.113 (Official Build) (64-bit), and now 81.0.4044.122 (Official Build) (64-bit).

@Xyncgas
Copy link

Xyncgas commented Apr 28, 2020

Although not crashing it freezes during start up for a few seconds

@intelligentpotato
Copy link

Just checked out the RC2, the issue is still there.

@euclaise
Copy link

From #9162

Thanks for confirming @the-sushi. Do you have to force kill Brave? or does it eventually crash?

I have to force kill it, else it just hangs.

@bsclifton
Copy link
Member Author

bsclifton commented Apr 28, 2020

@intelligentpotato what OS are you on?

As a troubleshooting step, for the more tech savvy folks - you can help us determine if the hanging is a profile-specific problem:

  • Profile directory will be under a folder which has a name like Brave-Browser / Brave-Browser-Beta / Brave-Browser-Dev / Brave-Browser-Nightly, depending on your release channel.
  • on macOS, rename the folder ~/Library/Application Support/BraveSoftware/<RELEASE_CHANNEL> out of the way. You can rename to just add .old at the end
  • on Windows, you can rename the folder at %userprofile%\AppData\Local\BraveSoftware\<RELEASE_CHANNEL>\User Data
  • on Linux, you can rename the folder at ~/.config/BraveSoftware/<RELEASE_CHANNEL>
  • location is different for snap users on Linux; I think it's something like ~/snap/66/BraveSoftware/<RELEASE_CHANNEL>

Quit all instances of Brave and then rename the folder. You can relaunch and you'll have a brand new profile. I'm curious if the problem still happens then (try visiting a few websites). If not, we know the bug is related to something about the user profile

After testing, you can go back to the folder you renamed, remove the new one which got created, and rename the folder back to the old name.

If you're not sure what I'm talking about in this post, please don't attempt the above steps 😄

@GitOutWest
Copy link

I think several people, including myself, have demonstrated that there's a profile-related issue in play. I had previously tried switching profiles by creating a new one, quitting Brave, then launching into the new one -- no hang.

I just tried your method, renaming the C:\Users\MyUserID\AppData\Local\BraveSoftware\Brave-Browser\User Data directory and then launching Brave into a new profile. Again, no hang. Previously under my default profile I had manually disabled all extensions (others also used --disable-extensions) but still got the (3-min) hang on launch.

Using your rename\UD method, I just tried with two extension (Acrobat & a password manager), and then quickly tried changing a few settings to set up Brave the way I like it (Download folder, home page, DNT enabled, turn off Brave Rewards button, etc.). After quitting & relaunching Brave, I never got a hang.

Whatever's going on, it doesn't seem to be a corrupted profile but rather something about a specific profile setting (lack of Brave Rewards, no Crypto Wallet, non-use of Tor, etc.).

@talisto
Copy link

talisto commented Apr 28, 2020

On MacOS 10.14.6, I updated to the Brave 1.8.84 RC but was still getting the lag on startup. However, I went into Settings > Additional Settings > Reset Settings > "Restore settings to their original defaults", which seems to have resolved it for me. So it's definitely profile-related. Using that reset method is much less destructive than torching the whole profile (it keeps bookmarks, history, extension settings, etc), so that's nice!

@bsclifton
Copy link
Member Author

bsclifton commented Apr 28, 2020

@GitOutWest thanks for taking the time to test that 😄 It's definitely appreciated as there are a few different types of issues happening to folks. Can you try the latest 1.8 release candidate? This is very likely what we're going to release soon:
https://github.com/brave/brave-browser/releases/tag/v1.8.86

This 1.8 release does specifically fix a bug where the Brave Rewards publishers list was being downloaded/installed even if you have rewards disabled. It also includes some optimizations for when rewards IS enabled and that list is downloaded. Basically, when that list is downloaded, a bunch of records are dropped and inserted in SQLite, which I believe is the freeze that a number of folks are reporting

There's definitely also a hardware related issue- where disabling HW acceleration solves some users. This might be something we see but Chrome doesn't see because Chrome is fetching the field trial values from finch server. We set the flag values at build time and don't reach out- so there's a potential that we have different driver workarounds / exclusion lists than Chrome

All of that said, there are still another two unknown issues: both freezing and crashing is happening to users who have never enabled Rewards... some on a brand new profile. I have several crash dumps and unfortunately, there isn't enough information to narrow the problem down. Having more crash reports and knowing more about the environment (which OS, does it work in Chrome, comparing brave://gpu to chrome://gpu, etc) will help

Some macOS users were resolved by disabling the virtual keyboard 😄 Bigtime thanks to @riccardoangius for confirming that works

@talisto let us know how that works! If doing the profile reset does fix you, then you've helped narrow down the problem for a lot of folks 😄 Thanks for trying and sharing that troubleshooting step

@bsclifton bsclifton removed the Epic label Jul 17, 2020
@bsclifton bsclifton changed the title Brave freezes or hangs on launch Brave freezes or hangs on launch when there are a large number of Cookies and other site data Jul 17, 2020
@bsclifton
Copy link
Member Author

Updated to a P2 now that we've been able to find the cause and we know the impact. Definitely something we would consider hotfixing for

@bsclifton
Copy link
Member Author

Assigning @bridiver as he had a possible fix

@bsclifton
Copy link
Member Author

Quick update for everybody watching this - we have a fix and are preparing a hotfix release 😄👍

Huge thanks to:

  • @ohbobva for providing a profile that reproduces the problem
  • @iefremov for diagnosing the issue to find the root cause
  • @bridiver for providing a root cause fix 😄

@LaurenWags
Copy link
Member

LaurenWags commented Jul 24, 2020

Verified passed with

Brave | 1.11.101 Chromium: 84.0.4147.89 (Official Build) (64-bit)
-- | --
Revision | 19abfe7bcba9318a0b2a6bc6634a67fc834aa592-refs/branch-heads/4147@{#852}
OS | macOS Version 10.14.6 (Build 18G3020)
  • Reproduced the hang on launch using 1.11.97 and minimal profile. Launched 5x and on my machine observed an average of ~15s hang each time.
  • Launched profile with 1.11.101 and launched 5x. On my machine I observed this went down to an average of ~3s.
  • Confirmed able to set cookies/site data without issue.

Verification PASSED on Win 10 x64 using the following build:

Brave | 1.11.101 Chromium: 84.0.4147.89 (Official Build) (64-bit)
--- | ---
Revision | 19abfe7bcba9318a0b2a6bc6634a67fc834aa592-refs/branch-heads/4147@{#852}
OS | Windows 10 OS Version 2004 (Build 19041.329)
  • Reproduced the hang on launch using 1.11.97 and minimal profile. Launched 5x and on my machine observed an average of ~15s hang each time.
  • Launched profile with 1.11.101 and launched 5x. On my machine I observed this went down to an average of ~3s.
  • Confirmed able to set cookies/site data without issue.

Verification PASSED on Mint 19.1 x64 using the following build:

Brave | 1.11.101 Chromium: 84.0.4147.89 (Official Build) (64-bit)
--- | ---
Revision | 19abfe7bcba9318a0b2a6bc6634a67fc834aa592-refs/branch-heads/4147@{#852}
OS | Linux
  • Reproduced the hang on launch using 1.11.97 and minimal profile. Launched 5x and on my machine observed an average of ~15s hang each time.
  • Launched profile with 1.11.101 and launched 5x. On my machine I observed this went down to an average of ~3s.
  • Confirmed able to set cookies/site data without issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.