Fix main-thread watchdog hang in PushNotificationIOS.setApplicationIconBadgeNumber (#57707) - #57707
Closed
christophpurrer wants to merge 1 commit into
Closed
Fix main-thread watchdog hang in PushNotificationIOS.setApplicationIconBadgeNumber (#57707)#57707christophpurrer wants to merge 1 commit into
christophpurrer wants to merge 1 commit into
Conversation
|
@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D113810036. |
christophpurrer
added a commit
to christophpurrer/react-native-macos
that referenced
this pull request
Jul 27, 2026
…onBadgeNumber (react#57707) Summary: Adopts the non-blocking `-[UNUserNotificationCenter setBadgeCount:withCompletionHandler:]` API (iOS 16+) to fix a chronic main-thread hang in `PushNotificationIOS.setApplicationIconBadgeNumber`. The deprecated `applicationIconBadgeNumber` setter performs a synchronous XPC round-trip to `usernotificationsd` on the calling thread, which triggers `0x8badf00d` watchdog kills when the daemon is slow. The async API returns immediately and invokes a completion handler later, keeping the main thread responsive. Also adds an RNTester example screen with a "Rapid-fire 50x set" stress test to validate the fix. API Documentation say: ``` property(nonatomic) NSInteger applicationIconBadgeNumber API_DEPRECATED("Use -[UNUserNotificationCenter setBadgeCount:withCompletionHandler:] instead.", ios(2.0, 17.0)) API_UNAVAILABLE(watchos); ``` Changelog: [iOS][Fixed] Fix main-thread watchdog hang in PushNotificationIOS.setApplicationIconBadgeNumber Reviewed By: fkgozali Differential Revision: D113810036
christophpurrer
force-pushed
the
export-D113810036
branch
from
July 27, 2026 20:44
58fd138 to
953d9b5
Compare
christophpurrer
added a commit
to christophpurrer/react-native-macos
that referenced
this pull request
Jul 27, 2026
…onBadgeNumber (react#57707) Summary: Adopts the non-blocking `-[UNUserNotificationCenter setBadgeCount:withCompletionHandler:]` API (iOS 16+) to fix a chronic main-thread hang in `PushNotificationIOS.setApplicationIconBadgeNumber`. The deprecated `applicationIconBadgeNumber` setter performs a synchronous XPC round-trip to `usernotificationsd` on the calling thread, which triggers `0x8badf00d` watchdog kills when the daemon is slow. The async API returns immediately and invokes a completion handler later, keeping the main thread responsive. Also adds an RNTester example screen with a "Rapid-fire 50x set" stress test to validate the fix. API Documentation say: ``` property(nonatomic) NSInteger applicationIconBadgeNumber API_DEPRECATED("Use -[UNUserNotificationCenter setBadgeCount:withCompletionHandler:] instead.", ios(2.0, 17.0)) API_UNAVAILABLE(watchos); ``` Changelog: [iOS][Fixed] Fix main-thread watchdog hang in PushNotificationIOS.setApplicationIconBadgeNumber Reviewed By: fkgozali Differential Revision: D113810036
christophpurrer
force-pushed
the
export-D113810036
branch
from
July 27, 2026 20:48
953d9b5 to
bd8c222
Compare
…onBadgeNumber (react#57707) Summary: Adopts the non-blocking `-[UNUserNotificationCenter setBadgeCount:withCompletionHandler:]` API (iOS 16+) to fix a chronic main-thread hang in `PushNotificationIOS.setApplicationIconBadgeNumber`. The deprecated `applicationIconBadgeNumber` setter performs a synchronous XPC round-trip to `usernotificationsd` on the calling thread, which triggers `0x8badf00d` watchdog kills when the daemon is slow. The async API returns immediately and invokes a completion handler later, keeping the main thread responsive. Also adds an RNTester example screen with a "Rapid-fire 50x set" stress test to validate the fix. API Documentation say: ``` property(nonatomic) NSInteger applicationIconBadgeNumber API_DEPRECATED("Use -[UNUserNotificationCenter setBadgeCount:withCompletionHandler:] instead.", ios(2.0, 17.0)) API_UNAVAILABLE(watchos); ``` Changelog: [iOS][Fixed] Fix main-thread watchdog hang in PushNotificationIOS.setApplicationIconBadgeNumber Reviewed By: fkgozali Differential Revision: D113810036
christophpurrer
force-pushed
the
export-D113810036
branch
from
July 27, 2026 20:48
bd8c222 to
70560f2
Compare
|
This pull request has been merged in 6f6efed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Adopts the non-blocking
-[UNUserNotificationCenter setBadgeCount:withCompletionHandler:]API (iOS 16+) to fix a chronic main-thread hang inPushNotificationIOS.setApplicationIconBadgeNumber. The deprecatedapplicationIconBadgeNumbersetter performs a synchronous XPC round-trip tousernotificationsdon the calling thread, which triggers0x8badf00dwatchdog kills when the daemon is slow. The async API returns immediately and invokes a completion handler later, keeping the main thread responsive.Also adds an RNTester example screen with a "Rapid-fire 50x set" stress test to validate the fix.
API Documentation say:
Changelog: [iOS][Fixed] Fix main-thread watchdog hang in PushNotificationIOS.setApplicationIconBadgeNumber
Reviewed By: fkgozali
Differential Revision: D113810036