Skip to content
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

Incorrect line number in Sentry event when running app on release mode. #4040

Open
rodolfoBee opened this issue Jan 13, 2025 · 5 comments
Open
Labels
Platform: Android Platform: Java Sync: Jira apply to auto-create a Jira shadow ticket Type: Bug Something isn't working

Comments

@rodolfoBee
Copy link
Member

Integration

sentry-android

Build System

Other

AGP Version

NA

Proguard

Enabled

Version

6.23.0

Steps to Reproduce

  1. Create a simple Android app
  2. Run the following code in debug mode to trigger a ArrayIndexOutOfBoundsException
    Image
  3. Note the line number in Sentry is correct (525)
  4. Run the same code again but now in release mode

Expected Result

The line number in the crash report from release mode is the same is in the debug mode. This is the screenshot from the debug mode:

Image

Actual Result

The line number in the crash report is incorrect (line 3)
Image

Proguard mapping is uploaded to the project and applied to the affected event:
Event:

"uuid": "123e8712-e89b-12d3-a456-426614174910",
"type": "proguard"
Image

The result using retrace also shows line 3 as the affected line:

java -jar retrace.jar mapping.txt stacktrace.txt
java.lang.ArrayIndexOutOfBoundsException: length=3; index=5
    at com.sp.[redacted].views.fragment.ConsentFragment$onclickListener$1.invoke(ConsentFragment.java:3)
    at com.sp.[redacted].views.fragment.ConsentFragment$onclickListener$1.invoke(ConsentFragment.java:1)
    at i.o$a.invoke(o.java:30)
    at com.sp.[redacted].utilities.SPUtilsKt$sam$androidx_lifecycle_Observer$0.onClick(SPUtilsKt.java:5)
    at android.view.View.performClick(View.java:7441)
    at android.view.View.performClickInternal(View.java:7418)
    at android.view.View.access$3700(View.java:835)
    at android.view.View$PerformClick.run(View.java:28676)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7842)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.[redacted].main([redacted].java:1003)

Links to events and project are available in the internal ticket.

@rodolfoBee rodolfoBee added Platform: Android Sync: Jira apply to auto-create a Jira shadow ticket Type: Bug Something isn't working labels Jan 13, 2025
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 13, 2025
@rodolfoBee
Copy link
Member Author

Internal ticket with information: https://getsentry.atlassian.net/browse/FEEDBACK-2393

@romtsn
Copy link
Member

romtsn commented Jan 13, 2025

@rodolfoBee if retrace yields the same result I doubt we can do much more about it from our side. This is how lambdas are optimized by r8, and if they themselves cannot recover the original stacktrace I'm not sure we can.

@romtsn romtsn moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Jan 13, 2025
@romtsn romtsn moved this to Waiting for: Community in GitHub Issues with 👀 3 Jan 13, 2025
@rodolfoBee
Copy link
Member Author

hi @romtsn thank you for the info.

I got confirmation it also happens on v7.20.0. The raw stack trace also points to the same location (it does not get resolved by the proguard mapping):

java.lang.ArrayIndexOutOfBoundsException: length=3; index=5
    at com.sp.[redacted].views.fragment.ConsentFragment$onclickListener$1.invoke(ConsentFragment.kt:3)
    at com.sp.[redacted].views.fragment.ConsentFragment$onclickListener$1.invoke(ConsentFragment.kt:1)

do you believe is caused by how the code is obfuscated?

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 13, 2025
@romtsn
Copy link
Member

romtsn commented Jan 13, 2025

@rodolfoBee you can disregard the SDK version, the problem is usually either in our proguard processing or mapping upload logic, but in this particular case this is caused by how the code is optimized, yes. If you look at the mapping file, it's not possible to trace back the com.sp.shuftipro_sdk.views.fragment.ConsentFragment$onclickListener$1.invoke stackframe to the original line - there's no such mapping exists.

@romtsn
Copy link
Member

romtsn commented Jan 13, 2025

@rodolfoBee perhaps the customer could report this to https://issuetracker.google.com/issues and provide a reproducible sample of their code, so google could shed some light on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Platform: Java Sync: Jira apply to auto-create a Jira shadow ticket Type: Bug Something isn't working
Projects
Status: No status
Status: Needs More Information
Development

No branches or pull requests

2 participants