getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
767 stars 307 forks source link

is It expected to sent App Hangs event if System popup about FaceId permission shown ? #3472

Open expcapitaldev opened 5 months ago

expcapitaldev commented 5 months ago

Platform

iOS

Environment

Develop

Installed

Carthage

Version

8.13.1

Did it work on previous versions?

No response

Steps to Reproduce

Show System Popup with Access to Face Id after Secret.load

func loadSecret(_ command: CDVInvokedUrlCommand) {
    let data  = command.arguments[0] as AnyObject?;
    var prompt = "Authentication"
    if let description = data?.object(forKey: "description") as! String? {
        prompt = description;
    }
    var pluginResult: CDVPluginResult
    do {
        **let result = try Secret().load(prompt)**
        pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: result);
    } catch {
        var code = PluginError.BIOMETRIC_UNKNOWN_ERROR.rawValue
        var message = error.localizedDescription
        if let err = error as? KeychainError {
            code = err.pluginError.rawValue
            message = err.localizedDescription
        }
        let errorResult = ["code": code, "message": message] as [String : Any]
        // ...
    }
}

Expected Result

no ANR App Hangs event

Actual Result

App Hanging

Secret.load

Are you willing to submit a PR?

No response

brustolin commented 5 months ago

Hello @expcapitaldev thanks for reaching out. I agree that this is not the desired behaviour, we need to investigate whether its possible to detect this system events to avoid reporting app hangs.

kahest commented 5 months ago

The system notifications for iPhone Pro with dynamic island are not causing the app to hang according to our preliminary tests. We'll test other models without dynamic island next.

expcapitaldev commented 4 months ago

hi guys, any updates here ?

brustolin commented 4 months ago

Unfortunately we could not reproduce this yet @expcapitaldev If you have any suggestion to help us out we appreciate.

expcapitaldev commented 4 months ago

Show System Popup with Access to Face Id after Secret.load So, you need only open that System Popup about access to FaceId, I will try later send screenshots, but please show it and see

julianD77 commented 4 months ago

We noticed our App started receiving instances of these errors for our live users after we recently updated the @sentry/react-native plugin from 4.15.0 to 5.9.1. The same issues still occurs when using 5.15.2. Our react-native version if useful is 0.72.9

When looking into the cause we then found this issue, alongside some similar posts:

https://github.com/getsentry/sentry-cocoa/discussions/2715 https://github.com/react-native-clipboard/clipboard/issues/212 https://github.com/flutter/flutter/issues/133557#issuecomment-1870403283

We have been able to confirm that calls to Clipboard.getString and Clipboard.getStrings are resulting in "App hanging for at least ..." errors being reported to Sentry.

We have confirmed this using a specific test build which makes calls to the Clipboard method(s) Clipboard.getString(s). These methods can cause (see below) the iOS UIPasteboard permissions prompt to appear and will cause the SentryANRTracker to report an ANR and an "App hanging" error to be reported in Sentry.

NOTE that in order for the iOS System Privacy prompt to appear you may need to do the following:

philipphofmann commented 4 months ago

Thanks for the detailed info, @julianD77.

SrAdam commented 3 months ago

Dear Sentry Team, It is not specific to FaceId permission, but to any kind of permissions, for example copying from clipboard from a macOS device to an iOS device. This issue results in a pletora of app hanging issues in my app. Please fix the issue as it is already 2 months old and it keeps eating up my error quota again and again. Thank you!

philipphofmann commented 3 months ago

I tried to reproduce the issue but wasn't able to. I tried push notification permission, location permission, and a biometric prompt in our iOS-Swift sample app, see https://github.com/getsentry/sentry-cocoa/blob/27039af9ece2efea572500caac518ac177f85cba/Samples/iOS-Swift/iOS-Swift/ViewControllers/PermissionsViewController.swift#L83-L110

I also tried all of these with a TestFlight build, but none of these triggered an ANR.

@SrAdam, for which type of app do you experience the issue? A native iOS app? If yes, does it use SwiftUI or UIViewControllers? Do you build your app with React-Native or Flutter?

@expcapitaldev, when looking at your code snippet you posted above, I assume you use Cordova? Is that correct? If yes, doest this only happen with Cordova, or does it also happen when interacting with native iOS code?

SrAdam commented 3 months ago

Thank you Philipp for the quick answer, and let me say sorry for not being explicit enough.

I am running a flutter app. My app was last updated 20 days ago, accordingly my versions:

Pubspec.lock:

dependencies:
  sentry_flutter: ^7.14.0
sdks:
  dart: ">=3.2.0 <4.0.0"
  flutter: ">=3.16.0"

Podfile.lock:

  - Sentry/HybridSDK (8.17.2):
    - SentryPrivate (= 8.17.2)
  - sentry_flutter (0.0.1):
    - Flutter
    - FlutterMacOS
    - Sentry/HybridSDK (= 8.17.2)
  - SentryPrivate (8.17.2)

Let me know if this is not the right channel for this issue and if that is the case, i would appreciate if you could point me out where to get further help. Thanks again for your support!

expcapitaldev commented 3 months ago

Thank you Philipp for answer, now I very very busy and will try to answer later for all questions and provide more code and information about case

caspg commented 1 month ago

How do you deal with this in the meantime? Setting enableAppHangTracking to false?

expcapitaldev commented 1 month ago

I use enableAppHangTracking: false,

kjxbyz commented 5 hours ago

same issue

2024-05-19 07 08 41 2024-05-19 07 08 52