Crashlytics upload-symbols hangs forever on a dSYM whose DWARF file is 0–8 bytes

Open
#16,978 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
objective-c
Domain
tooling

Research direction

Start with the Crashlytics/upload-symbols tool named in the issue and reproduce the hang using the provided empty-DWARF dSYM. Trace the processing path after “Begin processing dSYM” and check how it handles a DWARF file too short to map. Done means the command exits with a non-zero status and an error instead of hanging.

Written by the indexing model from the issue text.

Description

api: crashlytics
Description

upload-symbols waits forever (0% CPU, no network connection opened) when the dSYM's DWARF file is empty or only a few bytes long. It should fail with an error.

Expected: a non-zero exit code and an error message, as for other broken DWARF files.

Actual: the process never exits. The main thread is stuck in -[NSOperationQueue addOperations:waitUntilFinished:], and nothing else is running:

Thread_… DispatchQueue_1: com.apple.main-thread  (serial)
  start  (in dyld)
    ???  (in upload-symbols)  0x12b30
      ???  (in upload-symbols)  0x156bc
        ???  (in upload-symbols)  0x15e68
          -[NSOperationQueue addOperations:waitUntilFinished:]  (in Foundation)
            __NSOPERATIONQUEUE_IS_WAITING_ON_AN_OPERATION__  (in Foundation)
              -[NSOperation waitUntilFinished]  (in Foundation)
                _pthread_cond_wait  (in libsystem_pthread.dylib)
                  __psynch_cvwait  (in libsystem_kernel.dylib)

(Output of sample after 8 seconds; the only other thread is idle in __workq_kernreturn.)

The hang happens before any network use: lsof -i shows no sockets, and it behaves the same with the network blocked.

How we ran into it. A Flutter app's generated "Crashlytics Upload Symbols" build phase has no input for the DWARF file, so Xcode can start the phase while dsymutil is still writing it. On our CI machine the DWARF file was 0 bytes at that moment and every Release archive hung until the build timed out (details in firebase/flutterfire#18887). A tool that fails fast would have shown the problem in the first build instead of hanging it.

What the tool does for other truncated DWARF files. We took the first N bytes of a real 8.2 MB DWARF file and ran upload-symbols 3.21 with the network blocked:

DWARF file size Result
0, 1, 4, 8 bytes hangs forever
16, 28, 32 bytes aborts within 1 s: NSInvalidArgumentException: *** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil (exit 134)
64 bytes up to the full file exits within 1 s with exit code 8

For a 1-byte file --debug prints Attempting to map range 8-16392 length 16384 past end of file 1 in: …, then nothing.

Versions. It is not a regression. The same hang happens with each of these upload-symbols builds (taken from the Crashlytics/upload-symbols file at the commits that changed it):

upload-symbols Commit Result for a 0-byte DWARF file
3.21 build 40 (12.19.0, 13.1.1) df0a71aeb hangs
3.20 build 39 5006c2ae2 hangs
3.18 build 37 95596c2dd hangs
3.17 build 36 280072266 hangs
3.16 build 35 da90539cc hangs
3.15 build 34 2fe63fffe hangs
Reproducing the issue

No Xcode project is needed. This creates a dSYM-shaped folder with an empty DWARF file and a placeholder plist (the app ID is fake):

mkdir -p App.dSYM/Contents/Resources/DWARF
: > App.dSYM/Contents/Resources/DWARF/App

cat > GoogleService-Info.plist <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>GOOGLE_APP_ID</key>
	<string>1:000000000000:ios:0000000000000000000000</string>
	<key>BUNDLE_ID</key>
	<string>com.example.app</string>
</dict>
</plist>
EOF

# upload-symbols from firebase-ios-sdk 13.1.1 (Crashlytics/upload-symbols)
./upload-symbols -gsp GoogleService-Info.plist -p ios App.dSYM

The command never returns. It also hangs when the folder has a Contents/Info.plist, and when the dSYM comes from a real build with its DWARF file truncated to 0 bytes (: > App.dSYM/Contents/Resources/DWARF/<name>).

With --debug the last lines are:

Found dSYM at path: App.dSYM
Begin processing dSYM at /…/App.dSYM/Contents/Resources/DWARF/App
Firebase SDK Version

13.1.1 (also 12.19.0; both ship the same upload-symbols, SHA-256 ad9cd5816b9abe1f…)

Xcode Version

27.0 on the CI machine where we first saw it. The repro above runs the tool on its own (macOS 26.6), so Xcode is not involved.

Installation Method

Swift Package Manager

Firebase Product(s)

Crashlytics

Targeted Platforms

iOS

Relevant Log Output
upload-symbols 3.21 build 40

Arguments:
Debug mode enabled
Google App ID: 1:000000000000:ios:0000000000000000000000
Platform: ios
DSYM Paths: ["App.dSYM"]

Inspecting next path: App.dSYM
Found dSYM at path: App.dSYM
Begin processing dSYM at /…/App.dSYM/Contents/Resources/DWARF/App

(Nothing follows. The process is still running after 15 s, 0.0% CPU, no open sockets.)

If using Swift Package Manager, the project's Package.resolved

No response

If using CocoaPods, the project's Podfile.lock

No response

Dominant language
C++
Stars
7k
Forks
1.8k
Avg merge
1d 1h
Merged PRs (30d)
70

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/firebase-ios-sdk

All issues in firebase/firebase-ios-sdk

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.