Skip to content

Native Java stacktraces from PlatformExceptions have a trailing empty stack frame #1570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ueman opened this issue Jul 26, 2023 · 4 comments · Fixed by #1625
Closed

Native Java stacktraces from PlatformExceptions have a trailing empty stack frame #1570

ueman opened this issue Jul 26, 2023 · 4 comments · Fixed by #1625
Assignees

Comments

@ueman
Copy link
Collaborator

ueman commented Jul 26, 2023

Platform

Flutter Mobile

Obfuscation

Disabled

Debug Info

Disabled

Doctor

Version

7.4.2

Steps to Reproduce

  1. Get a native Java stacktrace via PlatformException
  2. Report it to Sentry

Expected Result

No trailing empty stack frame

Actual Result

Screenshot 2023-07-26 at 08 09 57

Are you willing to submit a PR?

None

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Jul 26, 2023
@ueman ueman changed the title Native Java stacktraces have a trailing empty stack frame Native Java stacktraces from PlatformExceptions have a trailing empty stack frame Jul 26, 2023
@marandaneto
Copy link
Contributor

Thanks @ueman
Do you have access to the raw stack trace or a link to sentry.io so I can take a look?

@ueman
Copy link
Collaborator Author

ueman commented Jul 26, 2023

The Java stacktrace part of the event is the following

{
    "type": "IllegalArgumentException",
    "value": "Unsupported value: '[Ljava.lang.StackTraceElement;@c50d178' of type 'class [Ljava.lang.StackTraceElement;'",
    "module": "java.lang",
    "stacktrace": {
        "frames": [
            {
                "platform": "java",
                "in_app": false,
                "data": {
                    "orig_in_app": -1
                }
            },
            {
                "function": "main",
                "module": "com.android.internal.os.ZygoteInit",
                "filename": "ZygoteInit.java",
                "abs_path": "ZygoteInit.java",
                "lineno": 1129,
                "platform": "java",
                "in_app": false,
                "data": {
                    "category": "system"
                }
            },
            {
                "function": "run",
                "module": "com.android.internal.os.RuntimeInit$MethodAndArgsCaller",
                "filename": "RuntimeInit.java",
                "abs_path": "RuntimeInit.java",
                "lineno": 614,
                "platform": "java",
                "in_app": false,
                "data": {
                    "category": "internals"
                }
            },
            {
                "function": "invoke",
                "module": "java.lang.reflect.Method",
                "platform": "java",
                "in_app": false,
                "data": {
                    "category": "indirection"
                }
            },
            {
                "function": "main",
                "module": "android.app.ActivityThread",
                "filename": "ActivityThread.java",
                "abs_path": "ActivityThread.java",
                "lineno": 9105,
                "platform": "java",
                "in_app": false,
                "data": {
                    "category": "threadbase"
                }
            },
            {
                "function": "loop",
                "module": "android.os.Looper",
                "filename": "Looper.java",
                "abs_path": "Looper.java",
                "lineno": 228,
                "platform": "java",
                "in_app": false,
                "data": {
                    "category": "threadbase"
                }
            },
            {
                "function": "dispatchMessage",
                "module": "android.os.Handler",
                "filename": "Handler.java",
                "abs_path": "Handler.java",
                "lineno": 102,
                "platform": "java",
                "in_app": false,
                "data": {
                    "category": "threadbase"
                }
            },
            {
                "function": "handleCallback",
                "module": "android.os.Handler",
                "filename": "Handler.java",
                "abs_path": "Handler.java",
                "lineno": 955,
                "platform": "java",
                "in_app": false,
                "data": {
                    "category": "threadbase"
                }
            },
            {
                "function": "run",
                "module": "y8.b",
                "filename": "Unknown Source",
                "abs_path": "Unknown Source",
                "lineno": 12,
                "platform": "java",
                "in_app": false
            },
            {
                "function": "i",
                "module": "y8.c",
                "filename": "Unknown Source",
                "abs_path": "Unknown Source",
                "lineno": 0,
                "platform": "java",
                "in_app": false
            },
            {
                "function": "m",
                "module": "y8.c",
                "filename": "DartMessenger.java",
                "abs_path": "DartMessenger.java",
                "lineno": 3,
                "platform": "java",
                "in_app": false
            },
            {
                "function": "l",
                "module": "y8.c",
                "filename": "DartMessenger.java",
                "abs_path": "DartMessenger.java",
                "lineno": 2,
                "platform": "java",
                "in_app": false
            },
            {
                "function": "a",
                "module": "l9.j$a",
                "filename": "MethodChannel.java",
                "abs_path": "MethodChannel.java",
                "lineno": 2,
                "platform": "java",
                "in_app": false
            },
            {
                "function": "onMethodCall",
                "module": "com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin",
                "filename": "FlutterLocalNotificationsPlugin.java",
                "abs_path": "FlutterLocalNotificationsPlugin.java",
                "lineno": 21,
                "platform": "java",
                "in_app": false
            },
            {
                "function": "getNotificationChannels",
                "module": "com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin",
                "filename": "FlutterLocalNotificationsPlugin.java",
                "abs_path": "FlutterLocalNotificationsPlugin.java",
                "lineno": 9,
                "platform": "java",
                "in_app": false
            },
            {
                "function": "error",
                "module": "l9.j$a$a",
                "filename": "MethodChannel.java",
                "abs_path": "MethodChannel.java",
                "lineno": 1,
                "platform": "java",
                "in_app": false
            },
            {
                "function": "d",
                "module": "l9.r",
                "filename": "StandardMethodCodec.java",
                "abs_path": "StandardMethodCodec.java",
                "lineno": 7,
                "platform": "java",
                "in_app": false
            },
            {
                "function": "p",
                "module": "l9.q",
                "filename": "StandardMessageCodec.java",
                "abs_path": "StandardMessageCodec.java",
                "lineno": 67,
                "platform": "java",
                "in_app": false
            }
        ]
    },
    "thread_id": 213252219
}

@marandaneto
Copy link
Contributor

marandaneto commented Jul 26, 2023

The reason is the 1st frame:

{
                "platform": "java",
                "in_app": false,
                "data": {
                    "orig_in_app": -1
                }
}

So the parsing algo has to consider that if the frame does not have any useful data, eg function, module, filename, etc, just discard it.

@marandaneto marandaneto moved this from Needs More Information to Needs Discussion in [DEPRECATED] Mobile SDKs Jul 26, 2023
@ueman
Copy link
Collaborator Author

ueman commented Jul 26, 2023

Yep, I agree

@marandaneto marandaneto moved this from Needs Discussion to Backlog in [DEPRECATED] Mobile SDKs Jul 27, 2023
@denrase denrase mentioned this issue Sep 4, 2023
6 tasks
@denrase denrase moved this from Backlog to In Progress in [DEPRECATED] Mobile SDKs Sep 4, 2023
@denrase denrase moved this from In Progress to Needs Review in [DEPRECATED] Mobile SDKs Sep 4, 2023
@github-project-automation github-project-automation bot moved this from Needs Review to Done in [DEPRECATED] Mobile SDKs Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants