Also catch ClassNotFoundException when trying to instantiate datadog.opentracing.jfr.openjdk.ScopeEventFactory.#1345
Also catch ClassNotFoundException when trying to instantiate datadog.opentracing.jfr.openjdk.ScopeEventFactory.#1345alacoste wants to merge 1 commit into
Conversation
…opentracing.jfr.openjdk.ScopeEventFactory. I am getting an uncaught exception that seems to have been forgotten in the anticipated catch block: ``` java.lang.ClassNotFoundException: datadog.opentracing.jfr.openjdk.ScopeEventFactory at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:340) at datadog.opentracing.DDTracer.createScopeEventFactory(DDTracer.java:560) at datadog.opentracing.DDTracer.access$000(DDTracer.java:55) at datadog.opentracing.DDTracer$DDTracerBuilder.config(DDTracer.java:121) at datadog.opentracing.DDTracer$DDTracerBuilder.withProperties(DDTracer.java:110) at ace.client.external.tracing.TracingClient$Companion.test(TracingClient.kt:71) at ace.ApplicationKt$main$4.invokeSuspend(Application.kt:210) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:271) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:79) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:54) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:36) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) at ace.ApplicationKt.main(Application.kt:209) at ace.ApplicationKt.main(Application.kt) ```
|
Hi @alacoste, thanks for PR. Could you please clarify what kind of setup you have? Ideally would you be able to provide a simple reproducer that triggers the problem? |
Hi @mar-kolya, I'll try to make a small & simple reproducer, but here's our setup in the big lines:
build.gradle.kts: Sample code to construct the DDTracer: val properties = Properties()
properties.setProperty("trace.enabled", "true")
properties.setProperty("service.name", "backend")
properties.setProperty("trace.agent.unix.domain.socket", "/.../my_socket")
val tracer: Tracer = DDTracer.builder()
.withProperties(properties)
.defaultSpanTags(mapOf("env" to "myEnv"))
.build() |
|
@alacoste, thanks for the explanation for your setup. |
I'm guessing it's a missing import for ClassNotFoundException, I went a bit quickly doing it from the github UI directly. Thanks for taking care of it |
|
@alacoste I've looked into this in a but more detail and it looks like Could you please clarify: you see your app crash because of this - not just log an exception? |
Tracing was working, but it would log an exception with stacktrace which seems like too much for the "problem" here (if this is an expected behavior in some cases). I'm not sure whether the exception is caught at some higher level by my application code, or if this log was originating from datadog's code (and I switched to using my custom implementation of ScopeManager() so I don't have the issue anymore to check easily) |
|
Hmm. interesting, thanks for an update! I think it would log this exception and stack trace if you have |
|
This has been addressed in #1417 |
I am getting an uncaught exception that seems to have been forgotten in the anticipated catch block: