firebase / firebase/firebase-ios-sdk

FR: Disable GC when file protection is enabled

Open
#2,980 2 comments 4 reactions 0 assignees View on GitHub
api: firestore internal-bug-filed type: feature request
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

We discovered in #2846 that if an app opts into complete file protection with `NSFileProtectionComplete`, the background GC task can crash the process if it runs while the filesystem is locked. The issue is that GC generates LevelDB commits which modify the filesystem, and while file protection is active, LevelDB sees these as I/O errors.

As file protection becomes active, users can currently disable listeners and stop sending writes, but there's nothing they can currently do about the GC background task. This FR is a request to have the GC task check whether or not protection is enabled, and if so, treat that GC cycle as a no-op.

Googlers see b/147764079 for more information.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the background GC task and its LevelDB commit path, then inspect how NSFileProtectionComplete state is exposed to the SDK. The change is complete when a GC cycle is skipped while file protection is active, while normal GC behavior remains unchanged when protection is inactive.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, ios, objective-c
Domain
databases, mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.