Skip to content

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

Draft
antonis wants to merge 6 commits intomainfrom
antonis/dsym-fix
Draft

fix(ios): Add wait logic for dSYM generation in Xcode build phase#5653
antonis wants to merge 6 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
  • 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 431.10 ms 465.72 ms 34.62 ms
Size 43.75 MiB 48.41 MiB 4.66 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
f70acbf+dirty 373.39 ms 382.81 ms 9.43 ms
d9f44bb+dirty 400.64 ms 431.65 ms 31.01 ms
f3b058c+dirty 501.18 ms 536.70 ms 35.52 ms
8e653ac+dirty 360.28 ms 372.04 ms 11.76 ms
eb07ba3 470.04 ms 473.35 ms 3.31 ms
74979ac+dirty 444.68 ms 479.36 ms 34.68 ms
3bd3f0d+dirty 447.21 ms 472.31 ms 25.10 ms
785ffb1 471.92 ms 460.96 ms -10.96 ms
6416d6c+dirty 407.30 ms 422.00 ms 14.70 ms
ba75c7c 367.72 ms 369.16 ms 1.44 ms

App size

Revision Plain With Sentry Diff
f70acbf+dirty 17.75 MiB 19.68 MiB 1.94 MiB
d9f44bb+dirty 43.75 MiB 48.40 MiB 4.64 MiB
f3b058c+dirty 43.75 MiB 48.07 MiB 4.32 MiB
8e653ac+dirty 17.75 MiB 19.75 MiB 2.00 MiB
eb07ba3 17.75 MiB 20.15 MiB 2.41 MiB
74979ac+dirty 43.75 MiB 48.41 MiB 4.66 MiB
3bd3f0d+dirty 17.75 MiB 19.70 MiB 1.95 MiB
785ffb1 17.75 MiB 20.15 MiB 2.41 MiB
6416d6c+dirty 43.75 MiB 48.05 MiB 4.30 MiB
ba75c7c 17.75 MiB 20.15 MiB 2.41 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1215.84 ms 1217.31 ms 1.47 ms
Size 3.38 MiB 4.78 MiB 1.39 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
9b50d32+dirty 1216.53 ms 1221.64 ms 5.10 ms
083f560+dirty 1227.33 ms 1242.02 ms 14.69 ms
7480abe+dirty 1220.53 ms 1244.18 ms 23.65 ms
d1bfbde+dirty 1216.83 ms 1212.83 ms -3.99 ms
a2bb688+dirty 1223.53 ms 1232.90 ms 9.37 ms
652f785+dirty 1219.66 ms 1223.62 ms 3.96 ms
6c36ba5+dirty 1214.56 ms 1216.52 ms 1.96 ms
9bf5446+dirty 1206.20 ms 1206.69 ms 0.48 ms
f081f58+dirty 1219.10 ms 1217.57 ms -1.53 ms
0dff710+dirty 1207.23 ms 1203.26 ms -3.97 ms

App size

Revision Plain With Sentry Diff
9b50d32+dirty 3.41 MiB 4.59 MiB 1.18 MiB
083f560+dirty 2.63 MiB 4.00 MiB 1.36 MiB
7480abe+dirty 2.63 MiB 3.96 MiB 1.33 MiB
d1bfbde+dirty 3.41 MiB 4.58 MiB 1.17 MiB
a2bb688+dirty 2.63 MiB 3.99 MiB 1.36 MiB
652f785+dirty 3.41 MiB 4.57 MiB 1.16 MiB
6c36ba5+dirty 3.38 MiB 4.60 MiB 1.22 MiB
9bf5446+dirty 3.41 MiB 4.59 MiB 1.18 MiB
f081f58+dirty 3.41 MiB 4.58 MiB 1.17 MiB
0dff710+dirty 3.44 MiB 4.59 MiB 1.15 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1229.67 ms 1225.22 ms -4.45 ms
Size 3.38 MiB 4.78 MiB 1.39 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
9b50d32+dirty 1210.36 ms 1218.41 ms 8.05 ms
083f560+dirty 1215.27 ms 1231.96 ms 16.69 ms
7480abe+dirty 1219.84 ms 1223.60 ms 3.76 ms
d1bfbde+dirty 1221.30 ms 1218.70 ms -2.60 ms
a2bb688+dirty 1244.82 ms 1238.60 ms -6.22 ms
652f785+dirty 1216.42 ms 1212.21 ms -4.21 ms
6c36ba5+dirty 1208.55 ms 1207.38 ms -1.17 ms
9bf5446+dirty 1218.60 ms 1210.45 ms -8.15 ms
f081f58+dirty 1208.37 ms 1215.56 ms 7.19 ms
0dff710+dirty 1194.90 ms 1196.15 ms 1.25 ms

App size

Revision Plain With Sentry Diff
9b50d32+dirty 3.41 MiB 4.59 MiB 1.18 MiB
083f560+dirty 3.19 MiB 4.56 MiB 1.38 MiB
7480abe+dirty 3.19 MiB 4.53 MiB 1.35 MiB
d1bfbde+dirty 3.41 MiB 4.58 MiB 1.17 MiB
a2bb688+dirty 3.19 MiB 4.56 MiB 1.37 MiB
652f785+dirty 3.41 MiB 4.57 MiB 1.16 MiB
6c36ba5+dirty 3.38 MiB 4.60 MiB 1.22 MiB
9bf5446+dirty 3.41 MiB 4.59 MiB 1.18 MiB
f081f58+dirty 3.41 MiB 4.58 MiB 1.17 MiB
0dff710+dirty 3.44 MiB 4.59 MiB 1.15 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 374.90 ms 422.04 ms 47.14 ms
Size 43.94 MiB 49.27 MiB 5.33 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a206511+dirty 331.54 ms 356.98 ms 25.44 ms
8ff81c0+dirty 392.47 ms 431.52 ms 39.05 ms
170d5ea+dirty 348.79 ms 406.94 ms 58.15 ms
bb4ea33+dirty 360.73 ms 375.02 ms 14.29 ms
80e4616+dirty 427.31 ms 461.15 ms 33.84 ms
9a81842+dirty 508.08 ms 566.65 ms 58.56 ms
64cd15c+dirty 488.79 ms 483.54 ms -5.24 ms
6bd9054+dirty 376.24 ms 407.76 ms 31.52 ms
73f2455+dirty 369.33 ms 398.90 ms 29.57 ms
23080e5+dirty 347.29 ms 381.87 ms 34.58 ms

App size

Revision Plain With Sentry Diff
a206511+dirty 43.94 MiB 48.90 MiB 4.96 MiB
8ff81c0+dirty 43.94 MiB 48.87 MiB 4.93 MiB
170d5ea+dirty 7.15 MiB 8.42 MiB 1.27 MiB
bb4ea33+dirty 43.94 MiB 48.91 MiB 4.97 MiB
80e4616+dirty 43.94 MiB 49.38 MiB 5.44 MiB
9a81842+dirty 43.94 MiB 48.91 MiB 4.97 MiB
64cd15c+dirty 7.15 MiB 8.42 MiB 1.27 MiB
6bd9054+dirty 43.94 MiB 48.90 MiB 4.96 MiB
73f2455+dirty 43.94 MiB 48.82 MiB 4.88 MiB
23080e5+dirty 7.15 MiB 8.41 MiB 1.26 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

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