getappmap / appmap-java

AppMap client agent for Java
Other
80 stars 14 forks source link

Agent doesn't correctly navigate class hierarchy when hooking #191

Closed apotterri closed 1 year ago

apotterri commented 1 year ago

When deciding whether to instrument a method, the agent examines a class's superclasses, but not the interfaces they implement. As a result, it will fail to hook the class's methods.

For example, the java.sql.Connection object returned by Oracle's JDBC driver is a T2CConnection, which has a class hierarchy that looks like this:

oracle.jdbc.driver.T2CConnection
- oracle.sql.BfileDBAccess
- oracle.sql.BlobDBAccess
- oracle.sql.ClobDBAccess

oracle.jdbc.driver.PhysicalConnection

oracle.jdbc.driver.GeneratedPhysicalConnection

oracle.jdbc.driver.OracleConnection
- oracle.jdbc.internal.ClientDataSupport
  - oracle.jdbc.internal.ACProxyable
- oracle.jdbc.internal.OracleConnection
  - oracle.jdbc.OracleConnection
    - java.sql.Connection
      - java.sql.Wrapper
      - java.lang.AutoCloseable
  - oracle.jdbc.internal.ACProxyable

oracle.jdbc.OracleConnectionWrapper
- oracle.jdbc.OracleConnection
  - java.sql.Connection
    - java.sql.Wrapper
    - java.lang.AutoCloseable

java.lang.Object

(where lines starting with - are interfaces, those without are classes). If a hook is specified for java.sql.Connection, none of the methods in T2CConnection will be instrumented.

apotterri commented 1 year ago

Pre-release version of the agent that fixes this problem:

appmap-1.19.0-SNAPSHOT.jar.gz

appland-release commented 1 year ago

:tada: This issue has been resolved in version 1.19.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: