Skip to content

fix(ios): Add wait logic for dSYM generation in Xcode build phase#5653

Open
antonis wants to merge 9 commits intomainfrom
antonis/dsym-fix
Open

fix(ios): Add wait logic for dSYM generation in Xcode build phase#5653
antonis wants to merge 9 commits intomainfrom
antonis/dsym-fix

Conversation

@antonis
Copy link
Contributor

@antonis antonis commented Feb 11, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Fixes a race condition where the upload script runs before dSYM files are fully generated, causing main app dSYM to be missing from Sentry.
This fix should avoid regressions like:

caused by #5617

💡 Motivation and Context

Fixes #5288

💚 How did you test it?

CI, Manually

local test 1

#!/bin/bash
# Test script to verify dSYM upload fix
# Usage: ./test-dsym-fix.sh [test-project-path]

set -e

PROJECT_PATH="${1:-.}"
SDK_PATH="$(cd "$(dirname "$0")/../../.." && pwd)"

echo "=== Sentry React Native dSYM Fix Testing ==="
echo ""
echo "SDK Path: $SDK_PATH"
echo "Project Path: $PROJECT_PATH"
echo ""

# Function to check Sentry debug files
check_sentry_debug_files() {
    echo "=== Checking Sentry Debug Files ==="
    echo ""
    echo "Please check Sentry Debug Files manually:"
    echo "1. Go to: https://sentry.io"
    echo "2. Navigate to: Settings > Projects > [Your Project] > Debug Files"
    echo "3. Look for recent uploads with 'debug' tag"
    echo ""
    echo "Expected to see:"
    echo "  ✓ Main app dSYM with 'debug' tag (~145MB)"
    echo "  ✓ Framework dSYMs"
    echo ""
    read -p "Press Enter to continue..."
}

# Test with current version
test_current_version() {
    echo "=== Phase 1: Testing with v7.12.1 (current stable) ==="
    echo ""

    cd "$PROJECT_PATH"

    echo "Installing @sentry/react-native@7.12.1..."
    yarn add @sentry/react-native@7.12.1 || npm install @sentry/react-native@7.12.1

    echo ""
    echo "Cleaning and regenerating native code..."
    npx expo prebuild --clean

    echo ""
    echo "Building with EAS..."
    echo "Watch for 'Upload Debug Symbols to Sentry' in logs"
    echo ""

    eas build --platform ios --profile production --local 2>&1 | tee build-v7.12.1.log

    echo ""
    check_sentry_debug_files
}

# Test with our fix
test_with_fix() {
    echo "=== Phase 2: Testing with dSYM wait fix ==="
    echo ""

    cd "$SDK_PATH"
    echo "Building SDK..."
    yarn build

    cd "$PROJECT_PATH"

    echo ""
    echo "Linking to local SDK..."
    yarn link "$SDK_PATH/packages/core" || npm link "$SDK_PATH/packages/core"

    echo ""
    echo "Cleaning and regenerating native code..."
    npx expo prebuild --clean

    echo ""
    echo "Building with debug logging enabled..."
    echo "Look for:"
    echo "  - 'DEBUG: DWARF_DSYM_FOLDER_PATH=...'"
    echo "  - 'DEBUG: DWARF_DSYM_FILE_NAME=...'"
    echo "  - 'Verified main app dSYM is complete'"
    echo ""

    SENTRY_DSYM_DEBUG=true eas build --platform ios --profile production --local 2>&1 | tee build-with-fix.log

    echo ""
    check_sentry_debug_files
}

# Main menu
echo "Choose test to run:"
echo "1) Test current v7.12.1 (reproduce issue)"
echo "2) Test with fix (verify solution)"
echo "3) Run both tests"
echo ""
read -p "Enter choice [1-3]: " choice

case $choice in
    1)
        test_current_version
        ;;
    2)
        test_with_fix
        ;;
    3)
        test_current_version
        echo ""
        echo "========================================"
        echo ""
        test_with_fix
        ;;
    *)
        echo "Invalid choice"
        exit 1
        ;;
esac

echo ""
echo "=== Testing Complete ==="
echo ""
echo "Build logs saved:"
echo "  - build-v7.12.1.log (if tested)"
echo "  - build-with-fix.log (if tested)"
echo ""
echo "Please compare the results in Sentry Debug Files"

local test 2

#!/bin/bash
# Manual test script for dSYM wait functionality
# This simulates the wait behavior without needing a full Xcode build

set -x

# Create a test directory
TEST_DIR="/tmp/sentry-dsym-wait-test-$$"
mkdir -p "$TEST_DIR"

echo "=== Test 1: dSYM appears immediately ==="
DSYM_DIR="$TEST_DIR/test1"
mkdir -p "$DSYM_DIR/TestApp.app.dSYM"
export DWARF_DSYM_FOLDER_PATH="$DSYM_DIR"
export DWARF_DSYM_FILE_NAME="TestApp.app.dSYM"
export SENTRY_DSYM_WAIT_MAX_ATTEMPTS=3
export SENTRY_DSYM_WAIT_INTERVAL=1

# Source the wait function
source "$(dirname "$0")/sentry-xcode-debug-files.sh" 2>/dev/null || {
    # If sourcing fails, extract just the wait function
    eval "$(sed -n '/^wait_for_dsym_files()/,/^}/p' "$(dirname "$0")/sentry-xcode-debug-files.sh")"
}

wait_for_dsym_files
echo "Test 1 result: $?"
echo ""

echo "=== Test 2: dSYM appears after delay ==="
DSYM_DIR2="$TEST_DIR/test2"
mkdir -p "$DSYM_DIR2"
export DWARF_DSYM_FOLDER_PATH="$DSYM_DIR2"
export DWARF_DSYM_FILE_NAME="DelayedApp.app.dSYM"

# Create dSYM in background after 2 seconds
(sleep 2 && mkdir -p "$DSYM_DIR2/DelayedApp.app.dSYM" && echo "Background: Created dSYM") &

wait_for_dsym_files
echo "Test 2 result: $?"
echo ""

echo "=== Test 3: dSYM never appears (timeout) ==="
DSYM_DIR3="$TEST_DIR/test3"
mkdir -p "$DSYM_DIR3"
export DWARF_DSYM_FOLDER_PATH="$DSYM_DIR3"
export DWARF_DSYM_FILE_NAME="NeverExists.app.dSYM"
export SENTRY_DSYM_WAIT_MAX_ATTEMPTS=2

wait_for_dsym_files
echo "Test 3 result: $?"
echo ""

echo "=== Test 4: Wait disabled ==="
export SENTRY_DSYM_WAIT_ENABLED=false
wait_for_dsym_files
echo "Test 4 result: $?"
echo ""

# Cleanup
rm -rf "$TEST_DIR"
echo "=== All tests complete ==="

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Feb 11, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(ios): Add wait logic for dSYM generation in Xcode build phase by antonis in #5653
  • chore(deps): update JavaScript SDK to v10.39.0 by github-actions in #5674
  • fix(spotlight): Add Sentry Spotlight dependency for debug builds by romtsn in #5667
  • chore(deps): bump github/codeql-action from 4.32.2 to 4.32.3 by dependabot in #5669
  • chore(deps): bump faraday from 1.10.4 to 1.10.5 in /samples/react-native-macos by dependabot in #5671
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.21.2 to 2.21.4 by dependabot in #5668
  • chore(deps): bump getsentry/craft from 2.21.2 to 2.21.4 by dependabot in #5670
  • feat: v8: Expose iOS options to ignore views from subtree traversal by antonis in #5663
  • chore(deps): bump faraday from 1.10.4 to 1.10.5 in /samples/react-native by dependabot in #5658
  • chore(deps): bump faraday from 1.10.4 to 1.10.5 in /performance-tests by dependabot in #5659

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 411.83 ms 453.48 ms 41.65 ms
Size 43.75 MiB 48.42 MiB 4.67 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
2f9fb30+dirty 416.78 ms 444.94 ms 28.16 ms
8d89cc9+dirty 537.83 ms 536.02 ms -1.81 ms
6fee48d+dirty 407.42 ms 437.71 ms 30.29 ms
d751a5d+dirty 434.24 ms 486.08 ms 51.84 ms
05bef0e+dirty 349.78 ms 334.04 ms -15.74 ms
f8d19f8+dirty 422.98 ms 421.98 ms -1.00 ms
cd5f27f+dirty 494.04 ms 516.62 ms 22.58 ms
1ef8a04+dirty 415.16 ms 415.22 ms 0.06 ms
459a438+dirty 417.09 ms 406.52 ms -10.57 ms
5c16cdc+dirty 423.48 ms 452.35 ms 28.88 ms

App size

Revision Plain With Sentry Diff
2f9fb30+dirty 43.75 MiB 48.05 MiB 4.29 MiB
8d89cc9+dirty 17.75 MiB 19.68 MiB 1.94 MiB
6fee48d+dirty 17.75 MiB 19.68 MiB 1.94 MiB
d751a5d+dirty 17.75 MiB 19.68 MiB 1.94 MiB
05bef0e+dirty 17.75 MiB 19.70 MiB 1.95 MiB
f8d19f8+dirty 43.75 MiB 48.08 MiB 4.33 MiB
cd5f27f+dirty 43.75 MiB 48.41 MiB 4.66 MiB
1ef8a04+dirty 43.75 MiB 48.05 MiB 4.29 MiB
459a438+dirty 17.75 MiB 19.70 MiB 1.95 MiB
5c16cdc+dirty 17.75 MiB 19.68 MiB 1.94 MiB

Previous results on branch: antonis/dsym-fix

Startup times

Revision Plain With Sentry Diff
498344c+dirty 431.10 ms 465.72 ms 34.62 ms

App size

Revision Plain With Sentry Diff
498344c+dirty 43.75 MiB 48.41 MiB 4.66 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1214.78 ms 1211.13 ms -3.65 ms
Size 3.38 MiB 4.78 MiB 1.40 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
682f0f5+dirty 1208.48 ms 1212.46 ms 3.98 ms
817b2c1+dirty 1211.96 ms 1215.58 ms 3.62 ms
7be1f99+dirty 1226.69 ms 1217.76 ms -8.93 ms
d081295+dirty 1214.40 ms 1211.27 ms -3.13 ms
d73150f+dirty 1198.44 ms 1210.06 ms 11.62 ms
ee69ed5+dirty 1206.79 ms 1213.98 ms 7.19 ms
5c16cdc+dirty 1209.32 ms 1210.67 ms 1.35 ms
5602cc4+dirty 1216.49 ms 1211.58 ms -4.91 ms
000da7a+dirty 1214.31 ms 1221.91 ms 7.61 ms
d9f44bb+dirty 1227.85 ms 1226.00 ms -1.85 ms

App size

Revision Plain With Sentry Diff
682f0f5+dirty 3.44 MiB 4.59 MiB 1.15 MiB
817b2c1+dirty 3.38 MiB 4.60 MiB 1.22 MiB
7be1f99+dirty 2.63 MiB 3.81 MiB 1.18 MiB
d081295+dirty 3.41 MiB 4.59 MiB 1.18 MiB
d73150f+dirty 3.38 MiB 4.60 MiB 1.22 MiB
ee69ed5+dirty 3.41 MiB 4.59 MiB 1.18 MiB
5c16cdc+dirty 2.63 MiB 3.96 MiB 1.33 MiB
5602cc4+dirty 3.41 MiB 4.67 MiB 1.25 MiB
000da7a+dirty 2.63 MiB 3.91 MiB 1.28 MiB
d9f44bb+dirty 3.38 MiB 4.60 MiB 1.22 MiB

Previous results on branch: antonis/dsym-fix

Startup times

Revision Plain With Sentry Diff
498344c+dirty 1215.84 ms 1217.31 ms 1.47 ms

App size

Revision Plain With Sentry Diff
498344c+dirty 3.38 MiB 4.78 MiB 1.39 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1222.32 ms 1222.79 ms 0.47 ms
Size 3.38 MiB 4.78 MiB 1.40 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
9b50d32+dirty 1210.36 ms 1218.41 ms 8.05 ms
b1579bc+dirty 1223.02 ms 1220.98 ms -2.04 ms
7480abe+dirty 1219.84 ms 1223.60 ms 3.76 ms
652f785+dirty 1216.42 ms 1212.21 ms -4.21 ms
73f2455+dirty 1219.85 ms 1218.29 ms -1.56 ms
161947d+dirty 1203.45 ms 1217.83 ms 14.38 ms
74979ac+dirty 1212.33 ms 1212.54 ms 0.21 ms
c94a927+dirty 1211.33 ms 1223.31 ms 11.97 ms
d9f44bb+dirty 1205.74 ms 1208.40 ms 2.66 ms
df1f7df+dirty 1217.00 ms 1213.27 ms -3.73 ms

App size

Revision Plain With Sentry Diff
9b50d32+dirty 3.41 MiB 4.59 MiB 1.18 MiB
b1579bc+dirty 3.38 MiB 4.60 MiB 1.22 MiB
7480abe+dirty 3.19 MiB 4.53 MiB 1.35 MiB
652f785+dirty 3.41 MiB 4.57 MiB 1.16 MiB
73f2455+dirty 3.41 MiB 4.58 MiB 1.17 MiB
161947d+dirty 3.19 MiB 4.56 MiB 1.37 MiB
74979ac+dirty 3.38 MiB 4.60 MiB 1.22 MiB
c94a927+dirty 3.19 MiB 4.56 MiB 1.37 MiB
d9f44bb+dirty 3.38 MiB 4.60 MiB 1.22 MiB
df1f7df+dirty 3.44 MiB 4.59 MiB 1.15 MiB

Previous results on branch: antonis/dsym-fix

Startup times

Revision Plain With Sentry Diff
498344c+dirty 1229.67 ms 1225.22 ms -4.45 ms

App size

Revision Plain With Sentry Diff
498344c+dirty 3.38 MiB 4.78 MiB 1.39 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 366.54 ms 390.96 ms 24.42 ms
Size 43.94 MiB 49.28 MiB 5.34 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
c9e95bd+dirty 339.32 ms 401.24 ms 61.92 ms
2b89ce9+dirty 372.22 ms 417.06 ms 44.84 ms
2f9fb30+dirty 383.06 ms 404.56 ms 21.50 ms
f70acbf+dirty 520.12 ms 558.91 ms 38.79 ms
64cd15c+dirty 488.79 ms 483.54 ms -5.24 ms
785ffb1+dirty 380.65 ms 451.83 ms 71.18 ms
f8d19f8+dirty 374.17 ms 383.40 ms 9.23 ms
1ef8a04+dirty 450.73 ms 482.38 ms 31.65 ms
3bd3f0d+dirty 334.38 ms 402.19 ms 67.81 ms
46da307+dirty 356.62 ms 415.02 ms 58.40 ms

App size

Revision Plain With Sentry Diff
c9e95bd+dirty 7.15 MiB 8.41 MiB 1.26 MiB
2b89ce9+dirty 7.15 MiB 8.41 MiB 1.26 MiB
2f9fb30+dirty 43.94 MiB 48.87 MiB 4.93 MiB
f70acbf+dirty 7.15 MiB 8.41 MiB 1.26 MiB
64cd15c+dirty 7.15 MiB 8.42 MiB 1.27 MiB
785ffb1+dirty 7.15 MiB 8.42 MiB 1.27 MiB
f8d19f8+dirty 43.94 MiB 48.91 MiB 4.97 MiB
1ef8a04+dirty 43.94 MiB 48.87 MiB 4.93 MiB
3bd3f0d+dirty 7.15 MiB 8.43 MiB 1.28 MiB
46da307+dirty 7.15 MiB 8.41 MiB 1.26 MiB

Previous results on branch: antonis/dsym-fix

Startup times

Revision Plain With Sentry Diff
498344c+dirty 374.90 ms 422.04 ms 47.14 ms

App size

Revision Plain With Sentry Diff
498344c+dirty 43.94 MiB 49.27 MiB 5.33 MiB

Base automatically changed from v8 to main February 12, 2026 16:06
antonis and others added 4 commits February 12, 2026 17:24
Fixed the timeout warning message to report actual elapsed time instead of
calculated max_attempts * wait_interval. With progressive backoff (0.5s, 1s, 2s),
the old calculation was incorrect (e.g., reported 20s when actual was ~12.5s).

Changes:
- Track actual wait time with total_wait_time variable
- Accumulate elapsed time after each sleep interval
- Update timeout message to show actual time and attempt count
- Add reference to BUILD_CONFIGURATION.md for configuration options

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@antonis
Copy link
Contributor Author

antonis commented Feb 13, 2026

@sentry review

@antonis antonis marked this pull request as ready for review February 16, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS debug files (.dSYM) for primary application package not automatically uploading using Expo plugin

1 participant