question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Poll] Shading Netty

See original GitHub issue

Related issues:

  • #705 Shade Netty to simplify dependency conflicts against other systems
  • #988 (wip) Shaded Netty
  • #1009 Expose netty channel option to end-user

We must decide to shade Netty or not in our shaded JARs.

Why? Because we cannot shade Netty as long as we expose Netty classes in our public API.

Why? Because otherwise our public API will be different between our shaded JARs and unshaded JARs.

Therefore, if we decide to shade Netty in our shaded JARs, we must hide all references to Netty classes from our public API. This will involve some breaking changes such as:

  • Provide some abstraction layer for core Netty classes such as EventLoop and ChannelOption
  • Fork other Netty classes we expose in our public API, such as:
    • AsciiString - affects HttpHeaders a lot
    • AttributeMap - affects RequestContext.attrs()
    • Headers - affects HttpHeaders a lot, because HttpHeaders extends Headers
    • ByteBuf - affects ByteBufHttpData
  • Make sure tcnative and epoll works even after shading.

Some may argue that such a large change can’t be justified, given that Netty 4.1 has been fairly stable recently and 4.0 reached at its end of life.

In my opinion, there are three options for this matter:

  1. Shade Netty completely.
    • This is the most safe option, but requires all the changes mentioned above.
  2. Do not shade netty-common, netty-buffer, netty-transport-* and netty-codec. Shade other Netty dependencies such as netty-codec-http, netty-codec-http2 and netty-resolver-*
    • This will still break if mixed with something that depends on Netty 4.0.
    • This will still break if Netty makes a breaking change in unshaded Netty dependencies in 4.1, although I believe it is not very likely.
    • Breaking changes in Armeria will be kept minimal, because we can still refer to AsciiString, AttributeMap, ByteBuf, EventLoop, ChannelOption and Header.
  3. Do not shade Netty at all.
    • This may also be fine. A user could just shade Netty when building his or her distribution.

Please feel free to ask questions or discuss about the pros and cons of each choice. Please add the following reactions to this issue to cast a vote:

  • 😄 for (1) Shade Netty completely.
  • 🎉 for (2) Shade Netty partially. We will discuss later again about which Netty artifact should be and should not be shaded.
  • ❤️ for (3) Do not shade Netty at all.

This poll will be open for about a week.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:16
  • Comments:8

github_iconTop GitHub Comments

1reaction
trustincommented, Apr 29, 2018

@rkapsi We can expose all Netty channel options via some abstraction layer even if we shaded Netty, so no worries 😃

0reactions
trustincommented, May 9, 2018

Closing the poll:

  • 😄 1
  • 🎉 5
  • ❤️ 10

Let us not shade Netty.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MpscUnboundedArrayQueue.poll Infinite Loop - Google Groups
This could be related to this issue: https://github.com/netty/netty/issues/10851. If so, upgrading to latest gRPC with netty >= 4.1.56.Final should help.
Read more >
io.grpc.netty.shaded.io.netty.util.concurrent java code examples ...
How to use io.grpc.netty.shaded.io.netty.util.concurrent ... DefaultThreadFactory("handshaker pool", true)); ManagedChannel channel = NettyChannelBuilder.
Read more >
Why has netty of unspecified version shaded into jar?
The netty version is declared in pom file. <netty.version>4.0.36.Final</netty.version>. The shade plugin of maven is also declared as ...
Read more >
DataStax Java Driver - Frequently Asked Questions
For Netty in particular, the driver offers an alternative artifact that shades its Netty dependency, allowing you to use newer or older versions...
Read more >
io.netty.util.internal.shaded.org.jctools.queues.atomic ...
本页提供 io.netty.util.internal.shaded.org.jctools.queues.atomic. ... In the 193 * event of concurrent polls/offers to this method the size is OVER ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found