kamon-io / Kamon

Distributed Tracing, Metrics and Context Propagation for applications running on the JVM
https://kamon.io
Other
1.41k stars 328 forks source link

NullPointerException in jdbc.ProxyConnectionCloseMethodAdvice$.exit #1150

Open kudrevatykh opened 2 years ago

kudrevatykh commented 2 years ago

Sometimes on application startup I get NPE

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.concurrent.atomic.AtomicReference.get()" because the return value of "kamon.instrumentation.jdbc.HasConnectionPoolTelemetry.connectionPoolTelemetry()" is null
    at kamon.instrumentation.jdbc.ProxyConnectionCloseMethodAdvice$.exit(HikariInstrumentation.scala:147) ~[kamon-bundle_2.13-2.4.5.jar:2.4.5]
    at com.zaxxer.hikari.pool.ProxyConnection.close(ProxyConnection.java:280) ~[HikariCP-3.4.5.jar:?]
    at slick.jdbc.JdbcBackend$BaseSession.close(JdbcBackend.scala:508) ~[slick_2.13-3.3.3.jar:?]

I think there is some race in Kamon instrumentation code that causes such error

razvanz commented 3 months ago

Looks like the instrumentation is targeting HikariCP v4. The instrumented methods have changed in v5, which is most likely the cause.

kudrevatykh commented 3 months ago

Looks like the instrumentation is targeting HikariCP v4. The instrumented methods have changed in v5, which is most likely the cause.

we use HikariCP 4.0.3