fix(agent): bundle relocated Byte Buddy so -javaagent stops aborting consumer JVMs - #208
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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