-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[RTDB] Fix Fatal Exception: FirebaseDatabasePersistenceFailure #15563
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
base: main
Are you sure you want to change the base?
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. |
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses a FirebaseDatabasePersistenceFailure fatal exception by setting appropriate file protection attributes when creating the persistence directory. This change allows directory creation even when the device is locked. Additionally, the error reporting is improved by including the underlying NSError in the thrown exception, and the logic is made more robust by logging a warning instead of crashing if setting the 'do not backup' attribute fails. A new unit test has been added to verify the correct file protection attribute is set. The changes are well-implemented and address the issue effectively. I have one minor suggestion to enhance code safety.
8e29812 to
f63f3cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the directory already exists, it doesn't sound like the file protection attribute will be updated: true if createIntermediates is set and the directory already exists (from docs).
To handle this case, I think we need to instead set the attribute via this API: https://developer.apple.com/documentation/foundation/filemanager/setattributes(_:ofitematpath:)?language=objc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. PTAL
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively resolves a FirebaseDatabasePersistenceFailure fatal exception by adjusting the file protection attributes for the persistence directory. The change to NSFileProtectionCompleteUntilFirstUserAuthentication is appropriate and should prevent I/O errors when the app is in the background or the device is locked. Additionally, making error handling for setting backup exclusion and file attributes non-fatal improves the overall robustness of the persistence layer. The accompanying unit test and changelog update are well-done. I have one minor suggestion to enhance the test coverage.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses a FirebaseDatabasePersistenceFailure fatal exception by improving the robustness of the persistence directory setup. The changes include explicitly setting file protection attributes, making certain setup failures non-fatal, and enhancing error reporting. A comprehensive unit test has been added to validate the new file protection behavior. The changes look solid. I've added one minor suggestion to the new test to further improve its robustness.
Fix #4493