getsentry / sentry-java

A Sentry SDK for Java, Android and other JVM languages.
https://docs.sentry.io/
MIT License
1.16k stars 435 forks source link

Sentry for Java silently fails when using ProGuard #3340

Open sproctor opened 7 months ago

sproctor commented 7 months ago

Integration

sentry

Java Version

17

Version

7.8.0

Steps to Reproduce

  1. build with proguard (ie Compose for Desktop gradle task proguardReleaseJars)
  2. Crash app
  3. Nothing is sent

Adding ProGuard rules from Android fixes this. It's never mentioned that they might be necessary. Better would be to crash on init when whatever is causing the failure is missing.

Expected Result

Crash report to be sent to sentry, obviously.

Actual Result

Crash is silently ignored.

romtsn commented 7 months ago

hi @sproctor, sorry you're having troubles, what rules did you add to make it work? We're not using proguard on JVM so were not simply aware of this issue.

sproctor commented 7 months ago

This is what I used:

-keep class io.sentry.** { *; }
-keepclassmembers enum io.sentry.** { *; }
romtsn commented 7 months ago

hm, these should not be needed for the sdk to work, could you perhaps share a reproducible project? Or enabled debug logs and share the output?

Sentry.init { it.isDebug = true }
sproctor commented 7 months ago

Stack trace:

INFO: Uncaught exception received.
DEBUG: Capturing event: 79ba499d0803417594513f3c39037588
DEBUG: Extracted 163 modules from resources.
INFO: Session is null on scope.withSession
ERROR: Error while capturing event with id: 79ba499d0803417594513f3c39037588
java.lang.AbstractMethodError: Receiver class io.a.k.k$$Lambda$230/0x00000008007769a0 does not define or inherit an implementation of the resolved method 'abstract void accept$56afaa06(b.b.b.i.bR)' of interface io.a.an.
    at io.a.am.a(SourceFile:933)
    at io.a.k.k.a(SourceFile:77)
    at io.a.ax.a(SourceFile:216)
    at io.a.r.a(SourceFile:120)
    at io.a.r.a(SourceFile:90)
    at io.a.aq.a(SourceFile:525)
    at io.a.s.a(SourceFile:30)
    at io.a.bJ.uncaughtException(SourceFile:109)
    at java.base/java.lang.ThreadGroup.uncaughtException(Unknown Source)
    at java.base/java.lang.ThreadGroup.uncaughtException(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.processException(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Relevant mappings

androidx.compose.foundation.text.TextDelegate -> b.b.b.i.br:
# {"fileName":"TextDelegate.kt","id":"sourceFile"}
io.sentry.util.TracingUtils -> io.a.k.k:
# {"fileName":"TracingUtils.java","id":"sourceFile"}
    77:77:androidx.compose.foundation.text.TextFieldKeyInputKt maybeUpdateBaggage$4d1dbfc4(io.sentry.IScope,io.sentry.SentryOptions) -> a
    79:88:void lambda$maybeUpdateBaggage$3$6f99b2d6(io.sentry.SentryOptions,io.sentry.IScope,androidx.compose.foundation.text.TextFieldKeyInputKt) -> a
io.sentry.Scope$IWithPropagationContext -> io.a.an:
# {"fileName":"Scope.java","id":"sourceFile"}
    void accept$56afaa06(androidx.compose.foundation.text.TextFieldKeyInputKt) -> accept$56afaa06
io.sentry.Scope -> io.a.am:
# {"fileName":"Scope.java","id":"sourceFile"}
    io.sentry.SentryLevel level -> a
io.sentry.util.TracingUtils -> io.a.k.k:
# {"fileName":"TracingUtils.java","id":"sourceFile"}
    77:77:androidx.compose.foundation.text.TextFieldKeyInputKt maybeUpdateBaggage$4d1dbfc4(io.sentry.IScope,io.sentry.SentryOptions) -> a
    79:88:void lambda$maybeUpdateBaggage$3$6f99b2d6(io.sentry.SentryOptions,io.sentry.IScope,androidx.compose.foundation.text.TextFieldKeyInputKt) -> a
io.sentry.SentryClient -> io.a.ax:
# {"fileName":"SentryClient.java","id":"sourceFile"}
    io.sentry.SentryOptions options -> a
io.sentry.Hub -> io.a.r:
# {"fileName":"Hub.java","id":"sourceFile"}
    io.sentry.protocol.SentryId lastEventId -> a
io.sentry.Sentry -> io.a.aq:
# {"fileName":"Sentry.java","id":"sourceFile"}
    java.lang.ThreadLocal currentHub -> a
io.sentry.HubAdapter -> io.a.s:
# {"fileName":"HubAdapter.java","id":"sourceFile"}
    io.sentry.HubAdapter INSTANCE -> a
io.sentry.UncaughtExceptionHandlerIntegration -> io.a.bJ:
# {"fileName":"UncaughtExceptionHandlerIntegration.java","id":"sourceFile"}
    92:141:void uncaughtException(java.lang.Thread,java.lang.Throwable) -> uncaughtException
    1147:1150:java.lang.Throwable getUnhandledThrowable(java.lang.Thread,java.lang.Throwable):147:150 -> uncaughtException
    1147:1150:void uncaughtException(java.lang.Thread,java.lang.Throwable):98 -> uncaughtException
    2049:2051:io.sentry.Hint io.sentry.util.HintUtils.createWithTypeCheckHint(java.lang.Object):49:51 -> uncaughtException
    2049:2051:void uncaughtException(java.lang.Thread,java.lang.Throwable):107 -> uncaughtException
    2055:2056:void io.sentry.util.HintUtils.setTypeCheckHint(io.sentry.Hint,java.lang.Object):55:56 -> uncaughtException
    2055:2056:io.sentry.Hint io.sentry.util.HintUtils.createWithTypeCheckHint(java.lang.Object):50 -> uncaughtException
    2055:2056:void uncaughtException(java.lang.Thread,java.lang.Throwable):107 -> uncaughtException
    3045:3045:io.sentry.hints.EventDropReason io.sentry.util.HintUtils.getEventDropReason(io.sentry.Hint):45:45 -> uncaughtException
    3045:3045:void uncaughtException(java.lang.Thread,java.lang.Throwable):111 -> uncaughtException
kahest commented 7 months ago

@sproctor thanks for the additional details, we need to investigate this more an will follow up