-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Pub/Sub JAVA client in play framework 2.5 - netty conflicts #1331
Comments
Argh @thefunkjunky I need to be honest with you, I was expecting this issue... This is a problem with gRPC (a dependency of ours) and Play 2.5. gRPC depends on netty 4.1, while Play 2.5 depends on netty 4.0. Unfortunately, these 2 netty versions are not binary compatible. A possible solution (see stackoverflow) could be downgrading to Play 2.4.6 which uses netty 3.8.0 that had a completely different project structure and package names (hence no name clashes). Play 2.6 should ship with netty 4.1 and possibly solve this issue. @garrettjonesgoogle do you know whether gRPC people considered shading some of their dependencies? There seem to be a number of people encountering this compatibility issues. |
I don't know - @ejona86 , can you comment? |
So shading is a fine strategy, but since Netty is exposed through our API (e.g., you can provide your own EventLoopGroup to NettyChannelBuilder), gRPC project pre-shading can cause problems. |
We may have to shade all of gRPC in google-cloud-java. There are two problematic dependencies:
|
I have since made grpc/grpc-java#2485. It's not submitted yet, and if you use NettyChannelBuilder directly it doesn't work well, but we can maybe push harder on that. Guava is a different story. Would I be right to assume issues are caused by the ancient guava-jdk5 used by the v1 client libraries? |
The issue with Guava isn't the guava-jdk5 dependency, it is a larger issue with the Guava deprecation policy. Basically as soon as we pick a particular version of Guava and expose types from it, that means no one can mix our library with a version of Guava that is 2 years older or 2 years newer than the version we picked. There are a fair number of consumers that this doesn't work for, e.g. Hadoop which is stuck on Guava 11. |
You can't do that at all, if you are going to shade. So for example, it is hard to shade Guava for gRPC when the Future stub is in play, because it uses ListenableFuture but if we shade ListenableFuture then none of the normal utilities will work and users have to use our shaded version. |
Our plan was to create an interface analogous to |
I think the argument there is that Hadoop should be shading/using class loading magic (a la containers). Because without doing so nobody can mix Hadoop and Guava. But I do understand the general "exposing a dependency on Guava can cause problems" argument.
Okay. And then your users can create their own utility to convert that to a
I mean things like cgc.util.concurrent.Futures. There are a lot of generic utility methods that do things with ListenableFutures.
That's an implementation detail, right? The user of your library doesn't care about that at all, right? Note that any reason you are using |
Hadoop's problem isn't just that it depends on Guava, it's that it made Guava part of its surface, so if it upgrades to a newer version of Guava, it's a breaking change for its users. If it was only an implementation detail, they could have done something like shading Guava a long time ago.
I was considering creating a "bridge" project that depends on Guava and connects GAX features to Guava, so that each user doesn't have to do it themselves.
Right, but people don't have to use those utilities. This could be addressed with the "bridge" project I mentioned above.
That is correct.
The key thing that comes out of |
I ran into a similar issue where I use Specifically this exception
|
If I understand this correctly, the answer is yes. The exception is
Once that issue is addressed, things will work together again. ccing @garrettjonesgoogle to make sure I'm diagnosing this correctly. |
@pongad , that analysis looks correct to me. |
No, grpc/grpc-java#2485 would not fix your issue. That issue is not related to netty itself but the netty transport in gRPC. It looks like gRPC broke an ABI (it is still source compatible) by moving the location of build(). However, NettyChannelBuilder is explicitly stated to be unstable API, so GAX shouldn't be using it or would need to shade all of grpc. |
@ejona86 So does this fairly characterize the situation?: gRPC is GA, but the only practical general-purpose transport is Netty, and the only way to use that transport is to use an |
I don't agree with that. If you're talking about |
Oh! I don't know how we ended up using |
I wanted to figure out where we're at for the Netty conflicts. (Guava doesn't actually seem to be relevant to the original requester, so I won't discuss that any more here.) Gax: In googleapis/gax-java#215, we have switched from I did a grep for gRPC: @ejona86 , it looks like https://github.com/grpc/grpc-java/pull/2485/files isn't submitted yet. Is there a timeline for it? |
No, there's not a timeline; I've started an email chain to discuss prioritization. Today the solution would be for users to shade it themselves. Based on other discussions, it also sounds like the PR will be incomplete because it fails to address tcnative loading issues. But I guess that will be solved separately by netty/netty#6271 and may not impact as many users. |
So if we want to shade ourselves what is the best example that we can look at? What are the artifacts/classes that need to be shaded? (we use maven) |
According to @garrettjonesgoogle , the latest release should shade netty and this should no longer be a problem. Due to age of issue, I'll close this, but please either reopen or open a new issue if you continue to experience problems. |
…#1331) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-core](https://github.com/googleapis/java-core) | `2.8.10` -> `2.8.11` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.11/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.11/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.11/compatibility-slim/2.8.10)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.11/confidence-slim/2.8.10)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/java-core</summary> ### [`v2.8.11`](https://github.com/googleapis/java-core/blob/HEAD/CHANGELOG.md#​2811-httpsgithubcomgoogleapisjava-corecomparev2810v2811-2022-09-08) [Compare Source](https://github.com/googleapis/java-core/compare/v2.8.10...v2.8.11) ##### Dependencies - Update dependency com.google.auth:google-auth-library-bom to v1.11.0 ([#​911](https://github.com/googleapis/java-core/issues/911)) ([4656905](https://github.com/googleapis/java-core/commit/4656905956504e4bc4fe224d1f8cd70bbab614d8)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-asset). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xOTQuMiIsInVwZGF0ZWRJblZlciI6IjMyLjE5NC4yIn0=-->
🤖 I have created a release *beep* *boop* --- ## [3.6.0](googleapis/java-asset@v3.5.0...v3.6.0) (2022-09-15) ### Features * Add client library support for AssetService v1 BatchGetEffectiveIamPolicies API ([3919a1d](googleapis/java-asset@3919a1d)) * Add client library support for AssetService v1 BatchGetEffectiveIamPolicies API ([#1300](googleapis/java-asset#1300)) ([3919a1d](googleapis/java-asset@3919a1d)) * Release of query system ([3919a1d](googleapis/java-asset@3919a1d)) ### Dependencies * Update dependency com.google.api.grpc:proto-google-cloud-orgpolicy-v1 to v2.3.2 ([#1302](googleapis/java-asset#1302)) ([d01d900](googleapis/java-asset@d01d900)) * Update dependency com.google.api.grpc:proto-google-cloud-orgpolicy-v1 to v2.3.3 ([#1332](googleapis/java-asset#1332)) ([c1511c2](googleapis/java-asset@c1511c2)) * Update dependency com.google.api.grpc:proto-google-cloud-os-config-v1 to v2.5.2 ([#1309](googleapis/java-asset#1309)) ([cf96ee9](googleapis/java-asset@cf96ee9)) * Update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.11 ([#1297](googleapis/java-asset#1297)) ([d56eedd](googleapis/java-asset@d56eedd)) * Update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.12 ([#1316](googleapis/java-asset#1316)) ([a3713fd](googleapis/java-asset@a3713fd)) * Update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.13 ([#1321](googleapis/java-asset#1321)) ([883b7b8](googleapis/java-asset@883b7b8)) * Update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.14 ([#1334](googleapis/java-asset#1334)) ([56cb4b4](googleapis/java-asset@56cb4b4)) * Update dependency com.google.api.grpc:proto-google-identity-accesscontextmanager-v1 to v1.4.1 ([#1307](googleapis/java-asset#1307)) ([b90baf7](googleapis/java-asset@b90baf7)) * Update dependency com.google.cloud:google-cloud-bigquery to v2.14.4 ([#1301](googleapis/java-asset#1301)) ([64f7ea5](googleapis/java-asset@64f7ea5)) * Update dependency com.google.cloud:google-cloud-bigquery to v2.14.6 ([#1315](googleapis/java-asset#1315)) ([fa179e2](googleapis/java-asset@fa179e2)) * Update dependency com.google.cloud:google-cloud-bigquery to v2.14.7 ([#1320](googleapis/java-asset#1320)) ([06d1a16](googleapis/java-asset@06d1a16)) * Update dependency com.google.cloud:google-cloud-bigquery to v2.15.0 ([#1326](googleapis/java-asset#1326)) ([df36595](googleapis/java-asset@df36595)) * Update dependency com.google.cloud:google-cloud-bigquery to v2.16.0 ([#1336](googleapis/java-asset#1336)) ([870779d](googleapis/java-asset@870779d)) * Update dependency com.google.cloud:google-cloud-core to v2.8.10 ([#1323](googleapis/java-asset#1323)) ([09e03b8](googleapis/java-asset@09e03b8)) * Update dependency com.google.cloud:google-cloud-core to v2.8.11 ([#1331](googleapis/java-asset#1331)) ([a112cec](googleapis/java-asset@a112cec)) * Update dependency com.google.cloud:google-cloud-core to v2.8.9 ([#1314](googleapis/java-asset#1314)) ([8edc2b8](googleapis/java-asset@8edc2b8)) * Update dependency com.google.cloud:google-cloud-pubsub to v1.120.11 ([#1298](googleapis/java-asset#1298)) ([172b34b](googleapis/java-asset@172b34b)) * Update dependency com.google.cloud:google-cloud-pubsub to v1.120.12 ([#1317](googleapis/java-asset#1317)) ([1ea636f](googleapis/java-asset@1ea636f)) * Update dependency com.google.cloud:google-cloud-pubsub to v1.120.13 ([#1322](googleapis/java-asset#1322)) ([b7522b9](googleapis/java-asset@b7522b9)) * Update dependency com.google.cloud:google-cloud-pubsub to v1.120.14 ([#1335](googleapis/java-asset#1335)) ([e9142b4](googleapis/java-asset@e9142b4)) * Update dependency com.google.cloud:google-cloud-resourcemanager to v1.5.3 ([#1318](googleapis/java-asset#1318)) ([aa3a1bb](googleapis/java-asset@aa3a1bb)) * Update dependency com.google.cloud:google-cloud-resourcemanager to v1.5.4 ([#1328](googleapis/java-asset#1328)) ([fca0ce5](googleapis/java-asset@fca0ce5)) * Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#1330](googleapis/java-asset#1330)) ([ccb704c](googleapis/java-asset@ccb704c)) * Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.3 ([#1340](googleapis/java-asset#1340)) ([0d87a9d](googleapis/java-asset@0d87a9d)) * Update dependency com.google.cloud:google-cloud-storage to v2.11.3 ([#1299](googleapis/java-asset#1299)) ([d59e6c6](googleapis/java-asset@d59e6c6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Issue summary: Client's services are built on top of the play framework 2.5. Some of their services need to publish messages to pub/sub, but the Google Pub/Sub java api depends on netty 4.1.x, which conflicts with netty 4.0.x used by play framework 2.5.
Is there a solution to get around this?
The text was updated successfully, but these errors were encountered: