Describe the bug
See this repo branch to reproduce the issue (can ignore the Jetty stuff, the code to cause the problem is in ReproduceReflectionProxyIssue). The issue manifests if you:
- Have something like
Driver#connect that is instrumented.
- You proxy the resulting
Connection
I narrowed this down to the issue starting with the change in #4390.
As a workaround I can use otel.javaagent.exclude-classes and exclude the WrappingDriver from instrumentation.
Steps to reproduce
See linked repository from description.
What did you expect to see?
No exception during instrumentation
What did you see instead?
AbstractMethodError during instrumentation.
Java 11 error example:
[main] DEBUG io.opentelemetry.javaagent.bootstrap.ExceptionLogger - Failed to handle exception in instrumentation for example.ReproduceReflectionProxyIssue$WrappingDriver on jdk.internal.loader.ClassLoaders$AppClassLoader@2c13da15
java.lang.AbstractMethodError: Receiver class com.sun.proxy.$Proxy44 does not define or inherit an implementation of the resolved method abstract __set__opentelemetryVirtualField$java$sql$Connection$io$opentelemetry$javaagent$shaded$instrumentation$jdbc$internal$DbInfo(Ljava/lang/Object;)V of interface io.opentelemetry.javaagent.bootstrap.field.VirtualFieldAccessor$java$sql$Connection$io$opentelemetry$javaagent$shaded$instrumentation$jdbc$internal$DbInfo.
at io.opentelemetry.javaagent.bootstrap.field.VirtualFieldImpl$java$sql$Connection$io$opentelemetry$javaagent$shaded$instrumentation$jdbc$internal$DbInfo.realPut(VirtualFieldImplementationsGenerator.java)
at io.opentelemetry.javaagent.bootstrap.field.VirtualFieldImpl$java$sql$Connection$io$opentelemetry$javaagent$shaded$instrumentation$jdbc$internal$DbInfo.set(VirtualFieldImplementationsGenerator.java:282)
at example.ReproduceReflectionProxyIssue$WrappingDriver.connect(ReproduceReflectionProxyIssue.java:49)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)
at example.ReproduceReflectionProxyIssue.setup(ReproduceReflectionProxyIssue.java:23)
at example.ApplicationMain.main(ApplicationMain.java:47)
Java 8 error example (slightly different logging):
[main] DEBUG io.opentelemetry.javaagent.bootstrap.ExceptionLogger - Failed to handle exception in instrumentation for example.ReproduceReflectionProxyIssue$WrappingDriver on sun.misc.Launcher$AppClassLoader@18b4aac2
java.lang.AbstractMethodError
at io.opentelemetry.javaagent.bootstrap.field.VirtualFieldImpl$java$sql$Connection$io$opentelemetry$javaagent$shaded$instrumentation$jdbc$internal$DbInfo.realPut(VirtualFieldImplementationsGenerator.java)
at io.opentelemetry.javaagent.bootstrap.field.VirtualFieldImpl$java$sql$Connection$io$opentelemetry$javaagent$shaded$instrumentation$jdbc$internal$DbInfo.set(VirtualFieldImplementationsGenerator.java:282)
at example.ReproduceReflectionProxyIssue$WrappingDriver.connect(ReproduceReflectionProxyIssue.java:49)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at example.ReproduceReflectionProxyIssue.setup(ReproduceReflectionProxyIssue.java:23)
at example.ApplicationMain.main(ApplicationMain.java:47)
What version are you using?
1.9.1 = exception occurs
1.7.0 = exception occurs
1.6.2 = no exception
Environment
Docker Linux + OpenJDK 8 or 11
Describe the bug
See this repo branch to reproduce the issue (can ignore the Jetty stuff, the code to cause the problem is in ReproduceReflectionProxyIssue). The issue manifests if you:
Driver#connectthat is instrumented.ConnectionI narrowed this down to the issue starting with the change in #4390.
As a workaround I can use
otel.javaagent.exclude-classesand exclude theWrappingDriverfrom instrumentation.Steps to reproduce
See linked repository from description.
What did you expect to see?
No exception during instrumentation
What did you see instead?
AbstractMethodErrorduring instrumentation.Java 11 error example:
Java 8 error example (slightly different logging):
What version are you using?
1.9.1 = exception occurs
1.7.0 = exception occurs
1.6.2 = no exception
Environment
Docker Linux + OpenJDK 8 or 11