Skip to content

[Bug]: Crash iOS [NotificationPermissionStrategy permissionStatus] #1420

Closed

Description

@106271

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Windows

Steps to reproduce

Unable to reproduce, the key symbolized content of the crash log is as follows.

AppVariant: 1:iPhone17,2:18
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Date/Time: 2024-12-10 13:28:19.5592 +0800
Launch Time: 2024-12-10 09:02:50.4790 +0800
OS Version: iPhone OS 18.1 (22B82)
Release Type: User
Baseband Version: 1.11.01
Report Version: 104

Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: FRONTBOARD 2343432205
<RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-update watchdog transgression: app:431 exhausted real (wall clock) time allowance of 10.00 seconds
ProcessVisibility: Foreground
ProcessState: Running
WatchdogEvent: scene-update
WatchdogVisibility: Background
WatchdogCPUStatistics: (
"Elapsed total CPU time (seconds): 15.330 (user 8.230, system 7.100), 26% CPU",
"Elapsed application CPU time (seconds): 1.693, 3% CPU"
) reportType:CrashLog maxTerminationResistance:Interactive>

+[NotificationPermissionStrategy permissionStatus] (in Runner) (NotificationPermissionStrategy.m:81)
+[PermissionManager checkPermissionStatus:result:] (in Runner) (PermissionManager.m:23)
-[PermissionHandlerPlugin handleMethodCall:result:] (in Runner) (PermissionHandlerPlugin.m:0)

Expected results

none

Actual results

none

Code sample

Code sample

Screenshots or video

Screenshots or video demonstration

[Upload media here]
none

Version

11.3.1

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.27.0, on macOS 15.1 24B83 darwin-arm64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google
    Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.89.1)
[✓] Connected device (2 available)

Activity

  1. b4kup commented on Sep 29, 2026

    @b4kup

    We're hitting this in production too. Mostly it shows up as Sentry "App Hanging ≥ 2000 ms" on cold start, and occasionally as a watchdog kill like the one reported here.

    Versions: permission_handler 12.0.1 / permission_handler_apple 9.4.7, Flutter 3.44.0, iOS 26.x and 27.x, all device classes. NotificationPermissionStrategy.permissionStatus is unchanged on main (9.6.2), so the latest release has the same behaviour.

    Main thread (symbolicated):

    semaphore_wait_trap
    _dispatch_sema4_wait
    _dispatch_semaphore_wait_slow
    +[NotificationPermissionStrategy permissionStatus] (NotificationPermissionStrategy.m:66)
    +[PermissionManager checkPermissionStatus:result:] (PermissionManager.m:23)
    -[PermissionHandlerPlugin handleMethodCall:result:] (PermissionHandlerPlugin.m:30)
    __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke (FlutterChannels.mm:315)
    flutter::PlatformMessageHandlerIos::HandlePlatformMessage (platform_message_handler_ios.mm:70)
    

    What we observe:

    • It happens in the first seconds after launch, mostly on cold starts from a notification tap. That is exactly when several SDKs (push, analytics, ads) query UNUserNotificationCenter at the same time.
    • In the events we inspected, another thread was sitting in _dispatch_sync_f_slow → _dispatch_thread_main_event_wait_slow at the same moment, i.e. a dispatch_sync onto main from a third-party SDK. If that work is on the path that delivers the getNotificationSettings callback, the semaphore wait on main becomes a lock-order inversion. This is the same pattern as Launch deadlock: getDeviceCountry() does DispatchQueue.main.sync from the getNotificationSettings callback (iOS SDK 5.102) dengage-tech/dengage-ios-sdk#24.
    • Whatever the trigger, dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER) on the platform thread means any delay in the settings callback freezes the UI. CriticalAlertsPermissionStrategy.permissionStatus uses the identical pattern.

    Proposed fix, mirroring what #1100 did for checkServiceStatus:

    1. Add an optional async checkPermissionStatus:completionHandler: to PermissionStrategy, so all other strategies keep their sync path.
    2. In +[PermissionManager checkPermissionStatus:result:], use it when the strategy responds to the selector, and call result from the completion handler after hopping to main via dispatch_async.
    3. Implement it in NotificationPermissionStrategy and CriticalAlertsPermissionStrategy directly on top of getNotificationSettingsWithCompletionHandler, without a semaphore, and use the same async check in their requestPermission instead of the sync status call.

    Happy to open a PR for this if the approach sounds good.

  2. added a commit that references this issue on Oct 27, 2026
    0ea2555
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions