-
Notifications
You must be signed in to change notification settings - Fork 614
onCancel not called on permission error #28
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
Hi @yh1224, thanks for letting us know about this. We currently have a backlog of issues to work through, and will prioritize this accordingly. I suspect that this has something to do with our persistence cache, and all but one listener return results from cache. Please don't quote me on this until we verify this assumption though! Thank you. |
FWIW I think the issue may be related to the fact that when we listen to a query, we'll treat a query that loads all data (even if it has an orderBy) as a "default" query (no query constraints, etc.): firebase-android-sdk/firebase-database/src/main/java/com/google/firebase/database/core/SyncTree.java Line 779 in 8982700
I believe this means that the orderBy() and non-orderBy() queries will be de-duped into a single backend listen request. But when we get a listen error and cancel the event registrations, we seem to treat orderBy and non-orderBy queries as distinct. This comment makes that sound intentional, but I don't understand why. It seems like it should match the other code. :-/ firebase-android-sdk/firebase-database/src/main/java/com/google/firebase/database/core/SyncTree.java Line 591 in 8982700
So I think the fix is somewhere in that code, but given the complexity and age of this code it may be a semi-risky thing to mess with. |
Closing this due to inactivity. Please re-open if this is still an issue. |
Environment
Problem
addListener to the reference which has no permissions, then
onCancel will be called with DatabaseError: Permission denied.
But adding more than two listeners to the same reference with and without orderBy,
onCancel called for only listeners with orderBy, not for listeners without orderBy.
Steps to reproduce:
Add listeners by different order, then onCancel called for all listeners.
The text was updated successfully, but these errors were encountered: