Skip to content

fix(ios): Honor shutdownTimeout on iOS - #6749

Merged
antonis merged 2 commits into
mainfrom
fix/ios-shutdown-timeout
Sep 17, 2026
Merged

antonis merged 2 commits into
mainfrom
fix/ios-shutdown-timeout

Conversation

@antonis

@antonis antonis commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix

📜 Description

The documented shutdownTimeout option was silently ignored on iOS, so the native SDK always used its default 2s flush interval on app close.

Two mismatches with Cocoa caused it:

  • Key: RN forwards shutdownTimeout, but Cocoa's dictionary parser only reads shutdownTimeInterval.
  • Unit: RN's shutdownTimeout is milliseconds (matching Android's setShutdownTimeoutMillis), while Cocoa's shutdownTimeInterval is an NSTimeInterval in seconds.

RNSentryStart.m now reads shutdownTimeout (ms) and sets shutdownTimeInterval = value / 1000.0. Android was already correct.

The option is already documented for React Native (Transport Options → shutdownTimeout); this fix simply makes iOS honor it, so no docs change is needed.

💡 Motivation and Context

shutdownTimeout controls how long the SDK waits to flush events before the app terminates — directly affecting whether events survive termination. It was a documented, promised option that was broken on iOS. Fixes #6748.

💚 How did you test it?

Added RNSentryCocoaTester unit tests asserting the ms→s mapping (shutdownTimeout: 5000shutdownTimeInterval == 5.0) and the default (shutdownTimeInterval == 2.0).

📝 Checklist

  • I added tests to verify the changes.
  • No breaking changes.
  • I updated the docs if needed. (already documented — no change needed)

🔮 Next steps

None.

🤖 Generated with Claude Code

JS `shutdownTimeout` (milliseconds) was silently ignored on iOS. Cocoa's
dictionary parser only reads `shutdownTimeInterval` (an NSTimeInterval in
seconds), so the native default (2s) was always used. Android was already
correct via `setShutdownTimeoutMillis`.

Map `shutdownTimeout` (ms) to `shutdownTimeInterval` (s) in RNSentryStart,
dividing by 1000. Adds Cocoa unit tests for the mapping and the default.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

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): Honor shutdownTimeout on iOS by antonis in #6749

🤖 This preview updates automatically when you update the PR.

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Sep 17, 2026
Comment thread CHANGELOG.md Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8061d47. Configure here.

@sentry

sentry Bot commented Sep 17, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.27.0 (107) Release

⚙️ sentry-react-native Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3839.57 ms 1207.53 ms -2632.03 ms
Size 5.15 MiB 6.90 MiB 1.75 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
64630e5+dirty 3842.70 ms 1218.11 ms -2624.60 ms
b0d3373+dirty 3831.75 ms 1227.29 ms -2604.46 ms
b04af96+dirty 3818.92 ms 1219.76 ms -2599.16 ms
3d31fcf+dirty 3838.09 ms 1223.46 ms -2614.63 ms
a0a3177+dirty 3844.73 ms 1225.23 ms -2619.51 ms
af33f3b+dirty 3849.98 ms 1236.45 ms -2613.53 ms
09a902f+dirty 3835.67 ms 1217.11 ms -2618.57 ms
5a316ea+dirty 3820.11 ms 1211.28 ms -2608.83 ms
acd838e+dirty 3849.78 ms 1230.00 ms -2619.78 ms
c2e182c+dirty 3848.40 ms 1211.79 ms -2636.61 ms

App size

Revision Plain With Sentry Diff
64630e5+dirty 4.98 MiB 6.46 MiB 1.49 MiB
b0d3373+dirty 5.15 MiB 6.68 MiB 1.53 MiB
b04af96+dirty 4.98 MiB 6.54 MiB 1.56 MiB
3d31fcf+dirty 4.98 MiB 6.56 MiB 1.58 MiB
a0a3177+dirty 4.98 MiB 6.55 MiB 1.58 MiB
af33f3b+dirty 4.98 MiB 6.51 MiB 1.54 MiB
09a902f+dirty 4.98 MiB 6.46 MiB 1.49 MiB
5a316ea+dirty 4.98 MiB 6.51 MiB 1.53 MiB
acd838e+dirty 5.15 MiB 6.70 MiB 1.55 MiB
c2e182c+dirty 4.98 MiB 6.50 MiB 1.52 MiB

@github-actions

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3826.70 ms 1211.48 ms -2615.22 ms
Size 5.15 MiB 6.90 MiB 1.75 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5fe1c6c+dirty 1201.36 ms 1209.15 ms 7.78 ms
7c6200e+dirty 3828.16 ms 1217.20 ms -2610.95 ms
41d6254+dirty 3849.78 ms 1233.91 ms -2615.86 ms
5789645+dirty 3841.36 ms 1214.81 ms -2626.55 ms
a9df5ce+dirty 3856.02 ms 1225.22 ms -2630.80 ms
9c84b9a+dirty 3833.41 ms 1221.79 ms -2611.62 ms
1a2e7e0+dirty 3852.95 ms 1233.78 ms -2619.18 ms
a636fa4+dirty 3846.16 ms 1210.10 ms -2636.05 ms
9b5615c+dirty 3837.21 ms 1215.33 ms -2621.89 ms
3d31fcf+dirty 3857.46 ms 1237.17 ms -2620.29 ms

App size

Revision Plain With Sentry Diff
5fe1c6c+dirty 3.38 MiB 4.77 MiB 1.39 MiB
7c6200e+dirty 5.08 MiB 6.68 MiB 1.60 MiB
41d6254+dirty 5.15 MiB 6.70 MiB 1.54 MiB
5789645+dirty 4.98 MiB 6.50 MiB 1.52 MiB
a9df5ce+dirty 4.98 MiB 6.55 MiB 1.57 MiB
9c84b9a+dirty 4.98 MiB 6.55 MiB 1.57 MiB
1a2e7e0+dirty 4.98 MiB 6.46 MiB 1.49 MiB
a636fa4+dirty 4.98 MiB 6.55 MiB 1.57 MiB
9b5615c+dirty 4.98 MiB 6.51 MiB 1.53 MiB
3d31fcf+dirty 4.98 MiB 6.56 MiB 1.58 MiB

@antonis
antonis marked this pull request as ready for review September 17, 2026 13:55
@antonis
antonis merged commit 8ac03f8 into main Sep 17, 2026
87 checks passed
@antonis
antonis deleted the fix/ios-shutdown-timeout branch September 17, 2026 14:43
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.

shutdownTimeout is silently ignored on iOS (key/unit mismatch with cocoa shutdownTimeInterval)

2 participants