You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
The driver instrumentation here could probably check if the resulting Connection is a proxy and not try to store any data around this but I'm not sure if:
That would break other things
Solves the immediate need but maybe similar issue is else where
ryanrupp
changed the title
JDBC instrumentation results in an AbstractMethodError if the Connection is proxied
JDBC Driver instrumentation results in an AbstractMethodError if the Connection is proxied
Jan 7, 2022
@laurit Ah I didn't actually test current main/snapshots, just the released versions. This does appear to be fixed in opentelemetry-javaagent-1.10.0-20211129.215152-6.jar which means this was fixed by #4722
So I'll probably just exclude the problematic wrapper class to be able to upgrade to 1.9.x then will take 1.10 later when it's released.
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#connect
that is instrumented.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 theWrappingDriver
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:
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
The text was updated successfully, but these errors were encountered: