GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Shade Netty transport by ejona86 · Pull Request #2485 · grpc/grpc-java Conversation
|
|
So this means that gRPC netty will no longer have a chance to conflict with other Netty versions I'm using? If so, +1, we were thinking of doing this ourselves when we imported and used gRPC anyways. The http2 changes between 4.1.5.Final and 4.1.6.Final were frustrating and it happens often enough to cause issues in a big organization. How will this play with shared things like worker groups and whatnot? If I have normal Netty plus grpc Netty, can I use the same worker group between them, or will I likely be stuck with 2 worker groups due to the relocation of classes? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes, this would remove or reduce the risk of conflicting Netty versions (depending on whether we continue to shade all of Netty, or just a risky subportion). The two Nettys currently share no code, so you'd have to use different EventLoops. "Normally" we could just shade the HTTP/2 codec. However, the HTTP/2 codec uses code from internal Netty classes that have no API stability. The internal classes then need all of Netty to be shaded. It may be possible to shade just some of the internal classes and the HTTP/2 codec, but it seems a bit dangerous. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Okay, that was the outcome we had evaluated as well internally. We feel the risk of breakage due to dependency conflicts is greater than the cost of not being able to use a single shared event loop for all netty's. We are in support of a complete shading of all netty code, not just http2. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I tried using gRPC with Apache Spark, and it was working well while developing on local Windows machine (running with IntelliJ), but when I try running my fatJar on Apache Spark, I get Netty related issues. Is this something that shading would be able to resolve? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
That is too vague to tell you anything. If it was Netty version incompatibilities, then yes, shading would likely resolve the problem. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Netty conflicts have bitten us pretty hard internally during our gRPC pilot. A shaded dependency would be very welcome on our team. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Jenkins, retest this please. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I missed this, I tried reproducing the exact error, but dealing with other nonsense now 😞 Essentially, Spark was complaining about a clash with class names, I know I'm still being vague, but hopefully I'll be able to get someone in my team to reproduce the error in the coming days. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@nevi-me, if it is similar to googleapis/google-cloud-java#1522 then it would be resolved. The root error there is a NoSuchMethodError, which is caused by version incompatibility. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This is becoming a pretty significant source of pain for us. Is this something we think would be included in the 1.2 release(or even a 1.1.x release if possible)? I'd like to determine if this is for sure going to happen so it then becomes a discussion of when, or if we should be shading this ourselves internally if the decision is no. Thanks. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ejona86 1.0 -> 1.1 is a minor version change, but a deleted method is a breaking change, which is inconsistent it being a minor version change. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
+1 on including this in 1.1.x release. This is currently preventing us from upgrading from 1.0 to 1.1. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I assume you meant 4.0 → 4.1. The failure in logic is Netty is not using your semantics for versioning. Netty has lots of interfaces and it's my understanding they reserve the right to change them in minor versions. So upgrading minor versions isn't too hard, but is not 100% API compatible. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ejona86 are y'all still considering this? and if so, any idea when it'll land? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ejona86 Can you provide any updates on this? It would be helpful for a decision one way or the other. If gRPC will shade, that is our preference at Netflix, but if gRPC won't shade, we're likely to shade anyways when we import. Right now the limbo state is worst for us, because we don't want to shade and then have you do it anyways :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jhspaybar sorry for the amateur question, how would one shade the current version using Gradle? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@nevi-me This thread has an accompanying commit which shows how. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Silly me, this is a PR haha. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jhspaybar, as far as decisions go, having a version of grpc-netty that has Netty shaded is a "yes". We'll still have the unshaded one as well (and the two will use different package names). But I need to have time to finish the work. That will be "soon" (weeks). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ejona86 Any updates on this? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
In netty/netty-tcnative#272, netty-tcnative began supporting shading. This needs to be updated to include tcnative, at which point it should be a fully self-contained one-stop-shop. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I created netty/netty#6963 for discussing a out-of-the-box alternative to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Netty can now (in the next release) auto-detect the packagePrefix. That means this PR is very close. Unfortunately, the shadow plugin is a bit strange when publishing. I need to investigate more how to upload to Maven Central (sanely) and how to install locally (sanely), when using the shadow plugin. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'll need to rebase this now that we've updated Netty. The new Netty has minor tweaks to the file names that we need to shade. I hope the test catches that it is broken. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@carl-mastrangelo, @zhangkun83, please review. I imagine Carl is probably more comfortable with the Netty side and Kun is probably more comfortable with the Gradle side. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // We have to be careful with these replacements as they must not match any | ||
| // string in NativeLibraryLoader, else they cause corruption. Note that | ||
| // this includes concatenation of string literals and constants. | ||
| relocate 'META-INF/native/libnetty', 'META-INF/native/libio-grpc-netty-shaded-netty' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
These should be underscores. See https://github.com/netty/netty-tcnative/blob/master/openssl-dynamic/src/main/c/jnilib.c#L276
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In the version of master this is on, they must be dashes. This is what I as referring to with "I'll need to rebase this now that we've updated Netty. The new Netty has minor tweaks to the file names that we need to shade."
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've rebased on top of master. The tests correctly failed, and swapping to underscores lets them now pass.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| /** Test TLS since that verifies everything, including tcnative, is functional. */ | ||
| @Test | ||
| public void tls() throws Exception { | ||
| Server server = ServerBuilder.forPort(0) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If you are testing TLS, can you for the SslProvider to be SslProvider.OPENSSL?
Also, this test case should probably be split. It is testing two things: If the ServerLoader worked, and if tcnative was shaded properly.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done. Done.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } finally { | ||
| server.shutdownNow(); | ||
| } | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Await termination?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@carl-mastrangelo, PTAL |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| public void tls() throws Exception { | ||
| Server server = ServerBuilder.forPort(0) | ||
| public void serviceLoaderFindsNetty() throws Exception { | ||
| assertTrue(ServerBuilder.forPort(0) instanceof NettyServerBuilder); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
optional: if you use Truth.assertThat(ServerBuilder.forPort(0)).isInstanceOf(NettyServerBuilder.class), a test failure will tell you what the instance actually was.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've swapped the tests to use Truth exclusively.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
9a18305 to
4f0e2f6
Compare
|
retest this please |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The dll isn't being loaded on Windows, and it's a PITA to figure out why because java.util.logging is broken in unit tests. I'll need to set up a full dev environment on Windows to figure out what's wrong. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The entire transport is shaded because we wouldn't want to collide with the unshaded form of grpc-netty.
|
Soo... I set up an environment, and then I rebased, and saw everything working. I'm assuming an update to Netty fixed the problem. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It was almost less than a year 😄 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
lol that's an interesting way to characterize "more than a year" :-P |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hey @ejona86 we are trying to use GRPC 1.10 in our program and are having some netty conflictions. Wasn't this issue/change in 1.9 supposed to make it so GRPC used their own netty and didn't conflict with other libraries that used netty too? https://github.com/grpc/grpc-java/blob/master/SECURITY.md#troubleshooting We were going over this and wanted to know if it was completely up to date...because GRPC is using the wrong netty version when trying to write a response in our current application and this is causing issues. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@mastergberry, as mentioned in the in the v1.9.0 release notes and my proposed changes to SECURITY.md, you have to swap to grpc-netty-shaded to get the pre-shaded Netty. If you use grpc-netty then you will see the original behavior. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
My apologies. Thanks for the nudge in the right direction. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.