firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

"Failed to obtain primary lease"

Open InputNeuron opened this issue 4 years ago • 3 comments

[REQUIRED] Describe your environment

  • Operating System version: MacOS 12.1
  • Browser version: Chrome 96.0.4664
  • Firebase SDK version: 8.10.0
  • Firebase Product: firestore

[REQUIRED] Describe the problem

We're seeing this error thousands of times in production. About 10k per week.

We're seeing it on:

image

... I don't have a way to reproduce this reliably.

I think it might be triggered in our chrome extension as there are probably no 'tabs' there to synchronize with? At least that's a theory but it doesn't explain why it's being triggered on Firefox or Safari.

What's the cause of this issue..

We've been seeing this happen for years and have no idea what is causing it.

Steps to reproduce:

Relevant Code:

// TODO(you): code here to reproduce the problem

InputNeuron avatar Jan 13 '22 22:01 InputNeuron

Just a drive-by comment. That error reporting seems to come from sentry? Might be worth posting the stacktrace that sentry gives you to help the firebase team out a bit.

simeon9696 avatar Jan 15 '22 14:01 simeon9696

It looks like our sentry isn't recording the stacktrace and we're trying to figure out why. Thanks @simeon9696

InputNeuron avatar Jan 15 '22 17:01 InputNeuron

Thanks for reporting. This is the expected behavior is you have persistence enabled with the default setting and your users open multiple tabs. Only the first tab will have access to persistence - all other tabs will not be able to access it. Instead, these tabs will use memory persistence. That means that these tabs will work but will not see any local data from the first tab. If you want to share IndexedDb access between tabs, you need to enable multi-tab synchronization. You can do this in v8 with enablePersistence({ synchronizeTabs: true }) or in v9 with enableMultiTabIndexedDbPersistence().

schmidt-sebastian avatar Jan 18 '22 16:01 schmidt-sebastian