-
Notifications
You must be signed in to change notification settings - Fork 938
experimentalTabSynchronization broken in 5.7.0 (Failed to obtain primary lease for action 'Collect garbage') #1436
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
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Thanks for the report! This is very possibly a bug in the experimental multi-tab synchronization support. In order to track this down, we will likely need a way to reproduce the problem so that we can debug what is going wrong. Failing that, it would be helpful if you can see if there is an earlier error being logged. The error you've reported suggests that the "The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab." error happened earlier, and hopefully it was logged with a more accurate callstack, that could help us track this down. Thanks! |
index.esm.js:77 [2018-12-21T10:18:05.142Z] @firebase/firestore: Firestore (5.5.9): Failed to obtain primary lease for action 'Collect garbage'. |
Not sure if the above helps. |
@varung Thanks! That definitely helps. I believe I know what the cause is and we'll work on getting a fix into an upcoming release. In the meantime I believe you could avoid the issue by disabling garbage collection with:
|
Only schedule garbage collections on the primary tab and gracefully ignore if they fail.
This should be fixed in the 5.7.2 release that went out last week. Thanks! |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
I had a react project that used firebase and worked well for several months. I then updated the code to the newest firebase sdk and to use multi-tab persistence. For the first time I saw the following console errors. (It's possible these occurred earlier and I did not notice, but I know for sure I did not get errors before October 2018. The app had been developed several months before October and ran well without problems.)
Steps to reproduce:
It seems to happen when multiple tabs are used, and multi-tab persistence is enabled. When it happens, it happens many times. (sometimes 100s).
index.cjs.js:151 Uncaught Error: FIRESTORE (5.5.9) INTERNAL ASSERTION FAILED: AsyncQueue is already failed: FirebaseError: The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.
at new t (index.cjs.js:346)
at index.cjs.js:11746
at index.cjs.js:8255
at e.wrapUserFunction (index.cjs.js:8241)
at e.wrapSuccess (index.cjs.js:8255)
at e.r.nextCallback (index.cjs.js:8225)
at index.cjs.js:8195
at index.cjs.js:8255
at e.wrapUserFunction (index.cjs.js:8241)
at e.wrapSuccess (index.cjs.js:8255)
at u (index.cjs.js:151)
at e.verifyNotFailed (index.cjs.js:7763)
at e.enqueue (index.cjs.js:7715)
at e.enqueueAndForget (index.cjs.js:7707)
at e.handleDelayElapsed (index.cjs.js:7669)
at index.cjs.js:7645
at Worker.worker.onmessage (HackTimer.js:134)
u @ index.cjs.js:151
e.verifyNotFailed @ index.cjs.js:7763
e.enqueue @ index.cjs.js:7715
e.enqueueAndForget @ index.cjs.js:7707
e.handleDelayElapsed @ index.cjs.js:7669
(anonymous) @ index.cjs.js:7645
worker.onmessage @ HackTimer.js:134
Relevant Code:
// Code that sets up firebase
import firebase from 'firebase'
firebase.initializeApp(config)
export default firebase;
export const provider = new firebase.auth.GoogleAuthProvider();
export const auth = firebase.auth();
export let db = firebase.firestore();
const settings = {/* your settings... */ timestampsInSnapshots: true};
db.settings(settings);
db.enablePersistence({experimentalTabSynchronization:true}).then(() => {
console.log("Woohoo! Multi-Tab Persistence!");
})
.catch(function(err) {
console.log("failed to enable persistence:" + err.code)
});
// as an example, this is the method of a react object that uses firebase
// example is handling when the user leaves a form element with onBlur
handleChangeAndSave = (e) => {
const t = e.target;
const value = (t.type === 'checkbox')?t.checked:t.value;
this.fbref().set({ [t.name]: value, _updated : new Date() }, {merge: true})
}
The text was updated successfully, but these errors were encountered: