Skip to content

Conversation

@paulb777
Copy link
Member

@paulb777 paulb777 commented Nov 28, 2025

Fix firebase/firebase-ios-sdk#14645

Gemini's analysis:
✦ I understand you're seeing a crash on iOS 18.3.2 related to directory enumeration in GDTCORFlatFileStorage. Based on the crash log you provided, the issue appears to stem from directory
creation (_mkpath, fstatat) within the storeEvent method, rather than enumeration. This could be due to a file system issue or a problem with how the storage path is being constructed or
accessed.

✦ After reviewing GDTCORFlatFileStorage.m, I've confirmed that the crash likely occurs within the storeEvent:onComplete: method. Specifically, the call to GDTCORWriteDataToFile seems to be
the source of the issue, as this is where the directory creation happens.

The stack trace indicates a failure in the underlying file system calls (_mkpath and fstatat) during directory creation. This could be due to a bug in iOS 18.3.2. A potential workaround
is to check if the directory exists before attempting to create it. This avoids unnecessarily calling createDirectoryAtPath if the directory is already present, which may prevent the
crash.

I've analyzed GDTCORPlatform.m and found that GDTCORWriteDataToFile is responsible for creating the directory before writing an event to a file. The current implementation directly
attempts to create the directory, which, as we've seen, can cause a crash on iOS 18.3.2.

To address this, I will modify GDTCORWriteDataToFile to first check if the directory already exists. If it does not, the code will then proceed to create it. This preventative check
should avoid the crash. I'll now apply this change.

@google-oss-bot
Copy link

Coverage Report 1

Affected Products

  • GoogleDataTransport-ios-GoogleDataTransport.framework

    Overall coverage changed from 76.33% (5a9a019) to 62.95% (710ecdb) by -13.38%.

    FilenameBase (5a9a019)Merge (710ecdb)Diff
    GDTCCTCompressionHelper.m81.63%0.00%-81.63%
    GDTCCTNanopbHelpers.m56.30%0.00%-56.30%
    GDTCCTUploader.m62.00%54.00%-8.00%
    GDTCCTUploadOperation.m74.54%28.41%-46.13%
    GDTCCTURLSessionDataResponse.m100.00%0.00%-100.00%
    GDTCOREvent+GDTCCTSupport.m16.49%0.00%-16.49%
    GDTCORFlatFileStorage+Promises.m74.14%46.55%-27.59%
    GDTCORPlatform.m82.26%70.79%-11.46%
    GDTCORUploadBatch.m100.00%0.00%-100.00%

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/87morwAZkl.html

@paulb777
Copy link
Member Author

/gemini review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash in GDTCORFlatFileStorage when enumerating directory on iOS 18.3.2

2 participants