Skip to content

kamon-jdbc is not working with Lagom JDBC readside #809

Open
@ja2c86

Description

@ja2c86

Hello,

I'm working in a Lagom application using mixed persistence approach (Cassanda for write side and Postgres for read side) with the following versions:

Kamon (I'm using kamon-bundle): 2.1.3
JDK: OpenJDK 64-Bit Server VM Corretto-11.0.6.10.1
Lagom: 1.6.2

I was able to configure Kamon and I'm able to access the status page correctly.

However when I tested my service the readside was not working, no rows were created in Postgres database.

Reviewing the logs I found the following exceptions during read side startup:

2020-07-09T18:56:26.957Z [error] com.example.test.impl.readside.TestRepository [] - Tables initialization failed: java.lang.NullPointerException
java.lang.NullPointerException: null
	at kamon.instrumentation.jdbc.ProxyConnectionCloseMethodAdvice$.exit(HikariInstrumentation.scala:146)
	at com.zaxxer.hikari.pool.ProxyConnection.close(ProxyConnection.java:259)
	at slick.jdbc.JdbcBackend$BaseSession.close(JdbcBackend.scala:508)
	at slick.basic.BasicBackend$DatabaseDef.releaseSession(BasicBackend.scala:258)
	at slick.basic.BasicBackend$DatabaseDef.releaseSession$(BasicBackend.scala:256)
	at slick.jdbc.JdbcBackend$DatabaseDef.releaseSession(JdbcBackend.scala:37)
	at slick.basic.BasicBackend$DatabaseDef$$anon$3.run(BasicBackend.scala:280)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
2020-07-09T18:28:38.322Z [error] akka.actor.OneForOneStrategy [akkaAddress=akka://[email protected]:25520, sourceThread=application-akka.actor.default-dispatcher-11, akkaSource=akka://application/user/slickOffsetStorePrepare-singleton/singleton/slickOffsetStorePrepare, sourceActorSystem=application, akkaTimestamp=18:28:38.311UTC] - null
java.lang.NullPointerException: null
	at kamon.instrumentation.jdbc.ProxyConnectionCloseMethodAdvice$.exit(HikariInstrumentation.scala:146)
	at com.zaxxer.hikari.pool.ProxyConnection.close(ProxyConnection.java:259)
	at slick.jdbc.JdbcBackend$BaseSession.close(JdbcBackend.scala:508)
	at slick.basic.BasicBackend$DatabaseDef.releaseSession(BasicBackend.scala:258)
	at slick.basic.BasicBackend$DatabaseDef.releaseSession$(BasicBackend.scala:256)
	at slick.jdbc.JdbcBackend$DatabaseDef.releaseSession(JdbcBackend.scala:37)
	at slick.basic.BasicBackend$DatabaseDef$$anon$3.run(BasicBackend.scala:280)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

I also tried downgrading the HikariCP dependency to 2.6.2, the one used by Kamon (Lagom 1.6.2 uses 3.4.1):

val hikari = "com.zaxxer" % "HikariCP" % "2.6.2"

But I got the same exceptions.

The only workaround I have found is to disable the jdbc metrics:

kanela.modules.jdbc.enabled = false

I really appreciate if you could review this scenario.

Thank you

Kind regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions