crashlytics: Fix flaky tests caused by EXC_GUARD on stdin#15583
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. |
|
re: CI– Unfortunately, it isn't a cure-all, but I think it's progress, considering the positive local testing. |
|
Nice find! |
|
cc: @themiswang |
Tip: Ignore whitespace when reviewing – https://github.com/firebase/firebase-ios-sdk/pull/15583/files?w=1
This PR addresses one source of flaky tests in the Crashlytics test suite.
Problem: A race condition occurred where FIRCLSBinaryImageInit zero-initialized the global context while a background thread from a previous test was still cleaning up. This caused a valid file descriptor to be overwritten with 0 (stdin). Attempting to close(0) triggers the operating system's EXC_GUARD protection, killing the process.
Solution: Patched FIRCLSFileClose to strictly ignore file descriptors <= STDERR_FILENO (0, 1, 2). This ensures the SDK never accidentally closes standard input/output streams, even if the file structure is improperly initialized to zero.
Process
open <xcresult path>on command line.Manual Testing
I ran 10 invocations of the test command for each of the following cases.
#no-changelog