Loading extensions conflicts with JVM in debug mode

Open
#593 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java

Research direction

Run the linked duckdb-httpfs-java-debug-issue sample in JVM debug mode, first loading httpfs or aws and then calling ByteBuddyAgent.install. Compare that with installing the agent before loading the extension and with ducklake, then trace the duckdb-jdbc extension-loading path. Done means ByteBuddyAgent.install no longer crashes after the affected extensions load in debug mode.

Written by the indexing model from the issue text.

Description

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.
Dominant language
C++
Stars
127
Forks
80
Avg merge
13h 41m
Merged PRs (30d)
44

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from duckdb/duckdb-java

All issues in duckdb/duckdb-java

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.