Skip to content

fix(agent): bundle relocated Byte Buddy so -javaagent stops aborting consumer JVMs - #208

Merged
PIsberg merged 2 commits into
mainfrom
fix/agent-jar-bundles-bytebuddy
Aug 4, 2026
Merged

fix(agent): bundle relocated Byte Buddy so -javaagent stops aborting consumer JVMs#208
PIsberg merged 2 commits into
mainfrom
fix/agent-jar-bundles-bytebuddy

Conversation

@PIsberg

@PIsberg PIsberg commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Every 1.7.0-RC agent jar was fatal when attached the way AGENT.md documents: the jar shipped without Byte Buddy, the JVM resolves AsyncTestAgent's method signatures before premain runs, and the NoClassDefFoundError escalates to a fatal startup abort (reproduced on JDK 21 and 26 against the published RC8 artifact). It survived eight release candidates because no gate ever attached the packaged jar standalone.

The jar now bundles byte-buddy and byte-buddy-agent relocated under se.deversity.asynctest.agent.shaded (11.7 KB to 5.2 MB); the dependency-reduced pom stops declaring Byte Buddy, so selfAttach() consumers get the bundled copy too. The net.bytebuddy. ignore prefix is assembled at runtime so relocation cannot rewrite the literal and a consumer's own Byte Buddy (Mockito's, typically) stays unwoven.

Gate: AgentJarPremainIT (Failsafe, runs in mvn verify and CI's mvn clean install) attaches the packaged jar to a Byte-Buddy-free child JVM via -javaagent in one scenario and selfAttach() in the other, and requires both children to reach main.

Verified failing-first: red against the unshaded jar with the exact production abort, green after shading. Full reactor mvn clean install green (lib suite 14 min, agent 55 s incl. both ITs, SpotBugs and Checkstyle clean). Gradle suite green with *IT excluded there, because only the Maven build produces the shaded artifact. Also corrects AGENT.md and contention-engine.md, which claimed the library JAR carries the premain manifest.

This is the release blocker found while testing RC8 downstream; 1.7.0 should not ship without it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UsCqogShCj1AVTEcP4FzLg

PIsberg and others added 2 commits August 4, 2026 18:31
Both AGENT.md and contention-engine.md still claimed the library JAR was
agent-capable. The manifest moved to async-test-agent in the module
split (the agent pom has carried Premain-Class since then); a reader
following either doc would pass -javaagent: the library jar and get no
agent at all.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UsCqogShCj1AVTEcP4FzLg
…consumer JVMs

Every 1.7.0-RC agent jar was fatal when attached the way AGENT.md
documents: the jar shipped without Byte Buddy, the JVM resolves
AsyncTestAgent's method signatures before premain runs, and the
NoClassDefFoundError escalates to a fatal startup abort. No gate ever
attached the packaged jar standalone, which is how it survived eight
release candidates.

The jar now bundles byte-buddy and byte-buddy-agent relocated under
se.deversity.asynctest.agent.shaded (11.7 KB to 5.2 MB); the reduced
pom stops declaring Byte Buddy, so selfAttach() consumers get the
bundled copy too. The net.bytebuddy. ignore prefix is assembled at
runtime so relocation cannot rewrite the literal and consumers' own
Byte Buddy stays unwoven.

Gate: AgentJarPremainIT (Failsafe, runs in mvn verify and CI's mvn
clean install) attaches the packaged jar to a Byte-Buddy-free JVM via
-javaagent and selfAttach() and requires both children to reach main.
Verified failing-first: red against the unshaded jar with the exact
production abort, green after shading. Full reactor mvn clean install
green (lib suite 14 min, agent 55 s incl. both ITs, SpotBugs and
Checkstyle clean); Gradle suite green with *IT excluded there because
only the Maven build produces the shaded artifact.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UsCqogShCj1AVTEcP4FzLg
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@PIsberg
PIsberg merged commit 33efe0d into main Aug 4, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant