When extensions (like httpfs) are loaded via duckdb-jdbc driver when the JVM is running in debug mode, it somehow breaks instrumentation agent attachment.
This manifests as a crash when libraries like bytebuddy-agent attempt attaching to the running JVM. Consequently, other libraries and frameworks like mockito and spring that depend on bytebuddy-agent also crash.
Sample code to demonstrate the issue: https://github.com/juja0/duckdb-httpfs-java-debug-issue
Note: The code in the link above needs to be executed in debug mode to trigger the issue.
Observations
- Initially noticed in duckdb_jdbc 1.3.2.0 but also happens in 1.4.4.0
- Unsure if it happens on versions prior to duckdb_jdbc 1.3.2.0
- Happens when calling ByteBuddyAgent.install
- ByteBuddyAgent version doesn't seem to matter. Happens on a fairly old version and also in the latest version.
- Happens only if duckdb loads httpfs extension before installing ByteBuddyAgent. If the order is flipped, it works fine.
- Happens on httpfs and aws extensions but not on ducklake extension
- Happens only when run in debug mode.