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

Debug-only crash when locking wallet immediately after restore #33750

Open
StephenHeaps opened this issue Oct 19, 2023 · 0 comments
Open

Debug-only crash when locking wallet immediately after restore #33750

StephenHeaps opened this issue Oct 19, 2023 · 0 comments
Labels

Comments

@StephenHeaps
Copy link

StephenHeaps commented Oct 19, 2023

Description

On debug builds, a NOTREACHED(); is hit after restoring a wallet and immediately locking the wallet.
Hit on iOS, but I can reproduce using 1.59.x, 1.60.x and master of brave-core repo. Theory in Miscellaneous Information below.

Steps to Reproduce

  1. Restore a wallet
  2. Immediately lock the wallet
  3. Crashes in Account Discovery service on a NOTREACHED();: https://github.com/brave/brave-core/blob/master/components/brave_wallet/browser/account_discovery_manager.cc#L74

Actual result:

Crashes

Expected result:

Does not crash

Reproduces how often:

Easily reproduced (on iOS)

Brave version (brave://version info)

1.59+

Version/Channel Information:

  • Can you reproduce this issue with the current release?
  • Can you reproduce this issue with the beta channel?
  • Can you reproduce this issue with the nightly channel?

Other Additional Information:

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

Miscellaneous Information:

I suspect this is a race condition but I've not fully debugged it.

NOTREACHED is hit in account_discovery_manager.cc at L74:
https://github.com/brave/brave-core/blob/fffea2b96c7bc255a66101166461cfe7b1d81fdb/components/brave_wallet/browser/account_discovery_manager.cc#L74

This can be hit when KeyringService::GetDiscoveryAddress returns null:
https://github.com/brave/brave-core/blob/fffea2b96c7bc255a66101166461cfe7b1d81fdb/components/brave_wallet/browser/keyring_service.cc#L1753-L1758

KeyringService::GetDiscoveryAddress can return null when KeyringService::GetHDKeyringById returns null:
https://github.com/brave/brave-core/blob/fffea2b96c7bc255a66101166461cfe7b1d81fdb/components/brave_wallet/browser/keyring_service.cc#L1429-L1434

KeyringService::GetHDKeyringById returns null when _keyrings does not contain the keyring for the given id. _keyrings is cleared when wallet is locked:
https://github.com/brave/brave-core/blob/fffea2b96c7bc255a66101166461cfe7b1d81fdb/components/brave_wallet/browser/keyring_service.cc#L1930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

1 participant