Skip to content
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

Fix builders ABI backward compatibility broken in v1.33.0 #7564

Merged
merged 3 commits into from Oct 29, 2020

Conversation

sergiitk
Copy link
Member

@sergiitk sergiitk commented Oct 28, 2020

What's this PR do?

Brings back io.grpc.internal.AbstractManagedChannelImplBuilder and io.grpc.internal.AbstractServerImplBuilder to the class hierarchy to fix broken ABI backward compatibility.

Any background context you want to provide?

AbstractManagedChannelImplBuilder

AbstractManagedChannelImplBuilder brought back as a copy of ForwardingChannelBuilder support pre-v1.33 binary interface, e.g. io.grpc.netty.NettyChannelBuilder.maxInboundMessageSize(I)Lio/grpc/internal/AbstractManagedChannelImplBuilder;

AbstractServerImplBuilder

  • Brings back io.grpc.internal.AbstractManagedChannelImplBuilder and io.grpc.internal.AbstractServerImplBuilder to the class hierarchy to fix broken ABI backward compatibility.
  • Since ForwardingServerBuilder was introduced in v1.33.0, I changed it to ForwardingServerBuilder<T extends ServerBuilder<T>>. and made it package-private.

What are the relevant tickets?

@sergiitk sergiitk requested a review from ejona86 October 28, 2020 22:20
@sergiitk sergiitk marked this pull request as ready for review October 28, 2020 22:21
@ejona86
Copy link
Member

ejona86 commented Oct 29, 2020

@sergiitk, did you push your changes?

@sergiitk
Copy link
Member Author

@ejona86 on it

@sergiitk sergiitk requested a review from ejona86 October 29, 2020 15:39
@sergiitk
Copy link
Member Author

sergiitk commented Oct 29, 2020

Confirming the latest change fixes server builders ABI.

❯ java -cp "./abi-1.32.2.jar:./deps-1.32.2/*" org.example.AbiServer
ServerImpl{logId=2, transportServers=[NettyServer{logId=1, address=0.0.0.0/0.0.0.0:10000}]}

❯ java -cp "./abi-1.32.2.jar:./deps-1.33.0/*" org.example.AbiServer
Exception in thread "main" java.lang.NoSuchMethodError: 
 io.grpc.netty.NettyServerBuilder.handshakeTimeout(JLjava/util/concurrent/TimeUnit;)Lio/grpc/internal/AbstractServerImplBuilder;
	at org.example.AbiServer.<init>(AbiServer.java:15)
	at org.example.AbiServer.main(AbiServer.java:23)

❯ java -cp "./abi-1.32.2.jar:./deps-1.34-7eac3b0/*" org.example.AbiServer
ServerImpl{logId=2, transportServers=[NettyServer{logId=1, address=0.0.0.0/0.0.0.0:10000}]}

src:

package org.example;

import java.util.concurrent.TimeUnit;
import io.grpc.Server;
import io.grpc.ServerBuilder;
import io.grpc.netty.NettyServerBuilder;

public class AbiServer {
  private final NettyServerBuilder nsb;

  public AbiServer() {
    nsb = NettyServerBuilder
        .forPort(10_000)
        .initialFlowControlWindow(100)                        // own in 1.32.2
        .handshakeTimeout(Long.MAX_VALUE, TimeUnit.SECONDS);  // moved from abstract to fwd in v1.33.0
  }

  public ServerBuilder getBuilder() {
    return nsb;
  }

  public static void main(String[] args) {
    AbiServer me = new AbiServer();
    Server s = me.getBuilder().build();
    System.out.println(s);
  }
}

@sergiitk sergiitk merged commit d314c68 into grpc:master Oct 29, 2020
@sergiitk sergiitk deleted the fix-builders-abi branch October 29, 2020 16:06
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2021
@grpc grpc unlocked this conversation Oct 3, 2023
@grpc grpc locked and limited conversation to collaborators Oct 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Binary backwards-incompatibily in 1.33.0
2 participants