-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
core: Remove builder class signature rewriter #10406
Conversation
b30c7ca
to
e6a1b0c
Compare
e1ab6d6
to
07688f5
Compare
This breaks the ABI of the classes listed below. Users that recompiled their code using grpc-java [`v1.36.0`] (https://github.com/grpc/grpc-java/releases/tag/v1.36.0) (released on Feb 23, 2021) and later, ARE NOT AFFECTED. Users that compiled their source using grpc-java earlier than [`v1.36.0`] (https://github.com/grpc/grpc-java/releases/tag/v1.36.0) need to recompile when upgrading to grpc-java `v1.59.0`. Otherwise the code will fail on runtime with `NoSuchMethodError`. For example, code: ```java NettyServerBuilder.forPort(80).directExecutor(); ``` Will fail with > `java.lang.NoSuchMethodError: 'io.grpc.internal.AbstractServerImplBuilder io.grpc.netty.NettyServerBuilder.directExecutor()'` **Affected classes** Class `AbstractServerImplBuilder` is deleted, and no longer in the class hierarchy of the server builders: - `io.grpc.netty.NettyServerBuilder` - `io.grpc.inprocess.InProcessServerBuilder`
This breaks the ABI of the classes listed below. Users that recompiled their code using grpc-java [`v1.36.0`] (https://github.com/grpc/grpc-java/releases/tag/v1.36.0) (released on Feb 23, 2021) and later, ARE NOT AFFECTED. Users that compiled their source using grpc-java earlier than [`v1.36.0`] (https://github.com/grpc/grpc-java/releases/tag/v1.36.0) need to recompile when upgrading to grpc-java `v1.59.0`. Otherwise the code will fail on runtime with `NoSuchMethodError`. For example, code: ```java NettyChannelBuilder.forTarget("localhost:100").maxRetryAttempts(2); ``` Will fail with > `java.lang.NoSuchMethodError: 'io.grpc.internal.AbstractManagedChannelImplBuilder io.grpc.netty.NettyChannelBuilder.maxRetryAttempts(int)'` **Affected classes** Class `AbstractManagedChannelImplBuilder` is deleted, and no longer in the class hierarchy of the channel builders: - `io.grpc.netty.NettyChannelBuilder` - `io.grpc.okhttp.OkhttpChannelBuilder` - `grpc.cronet.CronetChannelBuilder`
07688f5
to
3eaa4c0
Compare
For posterity, here's some tests assets you can use to verify: https://drive.google.com/file/d/1mCHbBbEfz5ku8jEDyUiv6ULfqJ3flhQj/view?usp=share_link package org.sergii.playground.netty.abi;
import io.grpc.netty.NettyChannelBuilder;
public class Main {
public static void main(String[] args) {
NettyChannelBuilder ncb = NettyChannelBuilder.forTarget("localhost:100");
try {
// Moved from AbstractManagedChannelImplBuilder to NettyChannelBuilder in 1.33.0
ncb.maxInboundMessageSize(100);
} catch (Throwable e) {
System.out.println(e);
}
try {
// maxRetryAttempts:
// <1.33.0: Inherited from AbstractManagedChannelImplBuilder
// =1.33.0: Inherited from ForwardingChannelBuilder
// >=1.33.1: Inherited from tmp AbstractManagedChannelImplBuilder
// >=1.59.0: Inherited ForwardingChannelBuilder2
ncb.maxRetryAttempts(200);
} catch (Throwable e) {
System.out.println(e);
}
// note: maxInboundMetadataSize is the only method AbstractManagedChannelImplBuilder inherits
// from ManagedChannelBuilder.
System.out.println(ncb);
}
} <
|
cc @njhill |
If it's breaking binary backwards compatibility it should be a new major version. |
Hmm ok, but I don't think I'm using any experimental APIs.
|
@joroKr21, that's probably resolved if you upgrade grpc-netty/grpc-netty-shaded/grpc-okhttp (whichever you are using) to v1.59.0+. |
Ok - this is all coming from transitive dependencies, but can I assume that:
So the only problem is when core is higher version than netty etc? |
grpc-okhttp uses internal APIs of grpc-core (which is only internal APIs these days). So technically the only thing guaranteed to work is using the same version. grpc-bom can make that easier. Previously we used version pinning (e.g., Things have happened to be compatible for a while if you do not downgrade dependencies. So grpc-core could be newer than grpc-okhttp and things have worked fine for a while it seems. That's because we are generally adding new things, and not removing stuff. This specific instance we removed something from grpc-core, so yeah, upgrading it is what caused the problem. |
AbstractManagedChannelImplBuilder
andAbstractServerImplBuilder
ForwardingChannelBuilder2
, see details in Tracking Issue for ForwardingChannelBuilder2 being Experimental #10585NettyChannelBuilder
before and after:NettyServerBuilder
before and after:ABI BREAKING!
This breaks the ABI of the classes listed below.
Users that recompiled their code using grpc-java
v1.36.0
(released on Feb 23, 2021) and later, ARE NOT AFFECTED.Users that compiled their source using grpc-java earlier than
v1.36.0
need to recompile when upgrading to grpc-javav1.59.0
. Otherwise the code will fail on runtime withNoSuchMethodError
. For example, code:Will fail with
Server builder example: code
Will fail with
Affected classes
Class
AbstractManagedChannelImplBuilder
is deleted, and no longer in the class hierarchy of the channel builders:io.grpc.netty.NettyChannelBuilder
io.grpc.okhttp.OkhttpChannelBuilder
grpc.cronet.CronetChannelBuilder
Class
AbstractServerImplBuilder
is deleted, and no longer in the class hierarchy of the server builders:io.grpc.netty.NettyServerBuilder
io.grpc.inprocess.InProcessServerBuilder
Related work
Hide
AbstractManagedChannelImplBuilder
— initial attemptABI Backward Compatibility Support