Skip to content

Keep the original Netty package intact when shading - #172

Merged
michaelklishin merged 1 commit into
ruby-amqp:mainfrom
jsvd:fix-netty-shading-prefix
Sep 24, 2026
Merged

michaelklishin merged 1 commit into
ruby-amqp:mainfrom
jsvd:fix-netty-shading-prefix

Conversation

@jsvd

@jsvd jsvd commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Netty's native library loader rejects the relocation introduced in #171 because it replaces the original io.netty package. Its prefix calculation requires the relocated class name to end with the complete original class name, otherwise it throws UnsatisfiedLinkError.

Change the relocation target to com.rabbitmq.marchhare.shaded.io.netty, rebuild the bundled JAR, and clarify the package requirement in the build comments and contributor instructions. Add a regression test that exercises Netty's prefix calculation without requiring a platform-specific native library.

Validation:

  • The regression test reproduces the failure with the previous JAR and passes with the rebuilt JAR on JRuby 9.4.14.0
  • Frame encoding and JDK TLS context creation pass with unshaded Netty 4.1 on the classpath
  • All 2,442 upstream classes are retained after accounting for the corrected relocation
  • Maven packaging, gem packaging, and git diff --check pass

Prepend com.rabbitmq.marchhare.shaded to io.netty instead of replacing io.netty with a namespace ending in netty. Netty's native library loader requires each relocated class name to end with its complete original class name when calculating the shading prefix.

Rebuild the bundled JAR and add a regression test that reproduces the native loader failure with the previous relocation.
@jsvd
jsvd marked this pull request as ready for review September 24, 2026 09:02
@michaelklishin
michaelklishin merged commit 631d804 into ruby-amqp:main Sep 24, 2026
7 checks passed
@michaelklishin

Copy link
Copy Markdown
Member

Thank you, @jsvd!

@jsvd
jsvd deleted the fix-netty-shading-prefix branch September 24, 2026 09:52
@mashhurs

Copy link
Copy Markdown
Contributor

👋 @michaelklishin do you have an estimate for next release? 🙏
Thank you.

@michaelklishin

Copy link
Copy Markdown
Member

4.10.0 is up on rubygems.org.

@michaelklishin michaelklishin added this to the 4.10.0 milestone Sep 29, 2026
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.

3 participants