opentracing-contrib / java-jdbc

OpenTracing Instrumentation for JDBC
Apache License 2.0
82 stars 56 forks source link

Not compatible with native image since version 0.2.5 #116

Open loicmathieu opened 3 years ago

loicmathieu commented 3 years ago

Since version 0.2.5, the library uses a dynamic proxy (via WrapperProxy) on top of the JDBC connection. Dynamic proxy didn't work OOTB on GraalVM native image, they need to be configured explicitly.

However, to configure native image dynamic proxy capability, we must configure the list of interface of the proxy, in the right order ! WrapperProxy generates a list of interfaces in no order, so we must register all possible combinations which can be huge, see the following experiment with an underlying Postgres driver: https://gist.github.com/luneo7/453ea0bd0d51a48c6c4377237e8ad831

Imagine native support where we want to support multiple database drivers, this becomes challenging.

Be also aware that with such configuration time to build the native image incrase a lot.

I don't know if it' easily feasable to switch back to not using any proxy, or if at least the WrapperProxy can be updated to generate a list of interfaces in a reproducible manner so we don't have to configure all possible combinations.

gsmet commented 2 years ago

Hey there,

We are kinda stuck in Quarkus to an old version (0.2.4) due to this proxy issue.

As Loïc mentioned it, for GraalVM and native executables, we need to register the proxies beforehand. Proxies have to be generated with the exact list of interfaces in the exact order in which they are used in the proxy declaration.

I think there are two issues we need to solve:

We are very willing to help on this issue and open to discussions so please reach out to us and let's try to get this fixed.

BTW, the problem is not specific to Quarkus but will impact all projects supporting GraalVM's native executables.

Thanks!