The Java gRPC implementation. HTTP/2 based RPC

Related tags

Networking grpc-java
Overview

gRPC-Java - An RPC library and framework

gRPC-Java works with JDK 7. gRPC-Java clients are supported on Android API levels 16 and up (Jelly Bean and later). Deploying gRPC servers on an Android device is not supported.

TLS usage typically requires using Java 8, or Play Services Dynamic Security Provider on Android. Please see the Security Readme.

Homepage: grpc.io
Mailing List: [email protected]

Join the chat at https://gitter.im/grpc/grpc Build Status Line Coverage Status Branch-adjusted Line Coverage Status

Getting Started

For a guided tour, take a look at the quick start guide or the more explanatory gRPC basics.

The examples and the Android example are standalone projects that showcase the usage of gRPC.

Download

Download the JARs. Or for Maven with non-Android, add to your pom.xml:

<dependency>
  <groupId>io.grpc</groupId>
  <artifactId>grpc-netty-shaded</artifactId>
  <version>1.36.0</version>
</dependency>
<dependency>
  <groupId>io.grpc</groupId>
  <artifactId>grpc-protobuf</artifactId>
  <version>1.36.0</version>
</dependency>
<dependency>
  <groupId>io.grpc</groupId>
  <artifactId>grpc-stub</artifactId>
  <version>1.36.0</version>
</dependency>
<dependency> <!-- necessary for Java 9+ -->
  <groupId>org.apache.tomcat</groupId>
  <artifactId>annotations-api</artifactId>
  <version>6.0.53</version>
  <scope>provided</scope>
</dependency>

Or for Gradle with non-Android, add to your dependencies:

implementation 'io.grpc:grpc-netty-shaded:1.36.0'
implementation 'io.grpc:grpc-protobuf:1.36.0'
implementation 'io.grpc:grpc-stub:1.36.0'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+

For Android client, use grpc-okhttp instead of grpc-netty-shaded and grpc-protobuf-lite instead of grpc-protobuf:

implementation 'io.grpc:grpc-okhttp:1.36.0'
implementation 'io.grpc:grpc-protobuf-lite:1.36.0'
implementation 'io.grpc:grpc-stub:1.36.0'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+

Development snapshots are available in Sonatypes's snapshot repository.

Generated Code

For protobuf-based codegen, you can put your proto files in the src/main/proto and src/test/proto directories along with an appropriate plugin.

For protobuf-based codegen integrated with the Maven build system, you can use protobuf-maven-plugin (Eclipse and NetBeans users should also look at os-maven-plugin's IDE documentation):

<build>
  <extensions>
    <extension>
      <groupId>kr.motd.maven</groupId>
      <artifactId>os-maven-plugin</artifactId>
      <version>1.6.2</version>
    </extension>
  </extensions>
  <plugins>
    <plugin>
      <groupId>org.xolstice.maven.plugins</groupId>
      <artifactId>protobuf-maven-plugin</artifactId>
      <version>0.6.1</version>
      <configuration>
        <protocArtifact>com.google.protobuf:protoc:3.12.0:exe:${os.detected.classifier}</protocArtifact>
        <pluginId>grpc-java</pluginId>
        <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.36.0:exe:${os.detected.classifier}</pluginArtifact>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>compile</goal>
            <goal>compile-custom</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

For non-Android protobuf-based codegen integrated with the Gradle build system, you can use protobuf-gradle-plugin:

plugins {
    id 'com.google.protobuf' version '0.8.15'
}

protobuf {
  protoc {
    artifact = "com.google.protobuf:protoc:3.12.0"
  }
  plugins {
    grpc {
      artifact = 'io.grpc:protoc-gen-grpc-java:1.36.0'
    }
  }
  generateProtoTasks {
    all()*.plugins {
      grpc {}
    }
  }
}

The prebuilt protoc-gen-grpc-java binary uses glibc on Linux. If you are compiling on Alpine Linux, you may want to use the Alpine grpc-java package which uses musl instead.

For Android protobuf-based codegen integrated with the Gradle build system, also use protobuf-gradle-plugin but specify the 'lite' options:

plugins {
    id 'com.google.protobuf' version '0.8.15'
}

protobuf {
  protoc {
    artifact = "com.google.protobuf:protoc:3.12.0"
  }
  plugins {
    grpc {
      artifact = 'io.grpc:protoc-gen-grpc-java:1.36.0'
    }
  }
  generateProtoTasks {
    all().each { task ->
      task.builtins {
        java { option 'lite' }
      }
      task.plugins {
        grpc { option 'lite' }
      }
    }
  }
}

API Stability

APIs annotated with @Internal are for internal use by the gRPC library and should not be used by gRPC users. APIs annotated with @ExperimentalApi are subject to change in future releases, and library code that other projects may depend on should not use these APIs.

We recommend using the grpc-java-api-checker (an Error Prone plugin) to check for usages of @ExperimentalApi and @Internal in any library code that depends on gRPC. It may also be used to check for @Internal usage or unintended @ExperimentalApi consumption in non-library code.

How to Build

If you are making changes to gRPC-Java, see the compiling instructions.

High-level Components

At a high level there are three distinct layers to the library: Stub, Channel, and Transport.

Stub

The Stub layer is what is exposed to most developers and provides type-safe bindings to whatever datamodel/IDL/interface you are adapting. gRPC comes with a plugin to the protocol-buffers compiler that generates Stub interfaces out of .proto files, but bindings to other datamodel/IDL are easy and encouraged.

Channel

The Channel layer is an abstraction over Transport handling that is suitable for interception/decoration and exposes more behavior to the application than the Stub layer. It is intended to be easy for application frameworks to use this layer to address cross-cutting concerns such as logging, monitoring, auth, etc.

Transport

The Transport layer does the heavy lifting of putting and taking bytes off the wire. The interfaces to it are abstract just enough to allow plugging in of different implementations. Note the transport layer API is considered internal to gRPC and has weaker API guarantees than the core API under package io.grpc.

gRPC comes with three Transport implementations:

  1. The Netty-based transport is the main transport implementation based on Netty. It is for both the client and the server.
  2. The OkHttp-based transport is a lightweight transport based on OkHttp. It is mainly for use on Android and is for client only.
  3. The in-process transport is for when a server is in the same process as the client. It is useful for testing, while also being safe for production use.
Comments
  • Server cert hot reloading

    Server cert hot reloading

    Please answer these questions before submitting your issue.

    What version of gRPC are you using?

    v1.18.0

    What did you expect to see?

    Server can reload new cert without restarting

    opened by dsyzhu 42
  • Channel interface needs shutdown/close

    Channel interface needs shutdown/close

    With the elimination of Service the Channel interface is now insufficient for normal use.

    While ChannelImpl has a shutdown Channel does not and intercepting a ChannelImpl immediately converts it into Channel.

    Closeable/AutoCloseable would be fine too

    api-breaking 
    opened by louiscryan 38
  • Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available

    Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available

    Please answer these questions before submitting your issue.

    What version of gRPC are you using?

    1.13.1

    What did you expect to see?

    The jar should be running fine.

    I am using java 8 to build an executable jar. Below is the java version:

    $ /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -version
    openjdk version "1.8.0_171"
    OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-2~14.04-b11)
    OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
    

    I am using gradle 3.4.1 to generate the jar as follows: /opt/gradle-3.4.1/bin/gradle jar -Dorg.gradle.java.home=/usr/lib/jvm/java-1.8.0-openjdk-amd64/ Below are the dependencies defined in the module-level build.gradle file:

    dependencies {
      compile files("$TOOLCHAIN_VERSION_DIR/lib/commons-io-2.6.jar")
      compile files("$TOOLCHAIN_VERSION_DIR/lib/grpc-all.jar")
      compile files("$TOOLCHAIN_VERSION_DIR/lib/java-protobuf.jar")
      compile files("$TOOLCHAIN_VERSION_DIR/lib/jetty.jar")
      compile files("$TOOLCHAIN_VERSION_DIR/lib/log4j-core-2.8.jar")
      compile files("$TOOLCHAIN_VERSION_DIR/lib/log4j-slf4j-impl-2.8.jar")
      compile files("$TOOLCHAIN_VERSION_DIR/lib/netty-tcnative-boringssl-static-2.0.20.Final.jar")
      compile files("$TOOLCHAIN_VERSION_DIR/lib/netty-tcnative-2.0.20.Final.jar")
      compile files("$TOOLCHAIN_VERSION_DIR/lib/picocli-3.8.2.jar")
      compile group: 'com.google.guava', name: 'guava', version: '20.0'
      compile files("$TOOLCHAIN_VERSION_DIR/lib/javassist-3.19.0-GA.jar")
      compile project(':annotation')
    }
    

    After building, I am running the jar on an AIX7.2 machine as follows: /usr/java8_64/jre/bin/java -jar agent-1.0.jar

    The java version on the AIX machine is as follows:

    $ /usr/java8_64/jre/bin/java -version           
    java version "1.8.0_191"
    Java(TM) SE Runtime Environment (build 8.0.5.26 - pap6480sr5fp26-20181115_03(SR5 FP26))
    IBM J9 VM (build 2.9, JRE 1.8.0 AIX ppc64-64-Bit Compressed References 20181106_401576 (JIT enabled, AOT enabled)
    OpenJ9   - fde1d6f
    OMR      - d8c3617
    IBM      - 5c4a9f0)
    JCL - 20181022_01 based on Oracle jdk8u191-b26
    

    But I am getting the following error while running:

    Feb 17, 2019 3:11:33 AM io.grpc.netty.GrpcSslContexts defaultSslProvider
    INFO: netty-tcnative unavailable (this may be normal)
    java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_aix_ppc_64, netty_tcnative_ppc_64, netty_tcnative]
            at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:93)
            at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:430)
            at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:97)
            at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:242)
            at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
            at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:151)
            at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:456)
            at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:55)
            at com.ankit.agents.AgentMain.<init>(AgentMain.java:91)
            at com.ankit.agents.AgentMain.main(AgentMain.java:132)
            Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative_aix_ppc_64
                    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:205)
                    at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
                    ... 9 more
            Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative_aix_ppc_64.a
                    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:161)
                    ... 10 more
                    Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_aix_ppc_64 (Not found in java.library.path)
                            at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
                            at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
                            at java.lang.System.loadLibrary(System.java:565)
                            at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
                            at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
                            at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
                            ... 10 more
                            Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_aix_ppc_64 (Not found in java.library.path)
                                    at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
                                    at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
                                    at java.lang.System.loadLibrary(System.java:565)
                                    at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
                                    at java.lang.reflect.Method.invoke(Method.java:508)
                                    at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
                                    at java.security.AccessController.doPrivileged(AccessController.java:647)
                                    at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
                                    at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
                                    ... 11 more
            Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative_ppc_64
                    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:205)
                    at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
                    ... 9 more
            Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative_ppc_64.a
                    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:161)
                    ... 10 more
                    Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_ppc_64 (Not found in java.library.path)
                            at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
                            at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
                            at java.lang.System.loadLibrary(System.java:565)
                            at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
                            at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
                            at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
                            ... 10 more
                            Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative_ppc_64 (Not found in java.library.path)
                                    at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
                                    at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
                                    at java.lang.System.loadLibrary(System.java:565)
                                    at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
                                    at java.lang.reflect.Method.invoke(Method.java:508)
                                    at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
                                    at java.security.AccessController.doPrivileged(AccessController.java:647)
                                    at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
                                    at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
                                    ... 11 more
            Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative
                    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:205)
                    at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:85)
                    ... 9 more
            Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative.a
                    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:161)
                    ... 10 more
                    Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative (Not found in java.library.path)
                            at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
                            at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
                            at java.lang.System.loadLibrary(System.java:565)
                            at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
                            at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
                            at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
                            ... 10 more
                            Suppressed: java.lang.UnsatisfiedLinkError: netty_tcnative (Not found in java.library.path)
                                    at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1425)
                                    at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1395)
                                    at java.lang.System.loadLibrary(System.java:565)
                                    at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
                                    at java.lang.reflect.Method.invoke(Method.java:508)
                                    at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:263)
                                    at java.security.AccessController.doPrivileged(AccessController.java:647)
                                    at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:255)
                                    at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:233)
                                    ... 11 more
    
    Feb 17, 2019 3:11:33 AM io.grpc.netty.GrpcSslContexts defaultSslProvider
    INFO: Conscrypt not found (this may be normal)
    Feb 17, 2019 3:11:33 AM io.grpc.netty.GrpcSslContexts defaultSslProvider
    INFO: Jetty ALPN unavailable (this may be normal)
    java.lang.ClassNotFoundException: org.eclipse.jetty.alpn.ALPN
            at java.lang.Class.forNameImpl(Native Method)
            at java.lang.Class.forName(Class.java:403)
            at io.grpc.netty.JettyTlsUtil.isJettyAlpnConfigured(JettyTlsUtil.java:64)
            at io.grpc.netty.JettyTlsUtil.getJettyAlpnUnavailabilityCause(JettyTlsUtil.java:75)
            at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:255)
            at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
            at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:151)
            at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:456)
            at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:55)
            at com.ankit.agents.AgentMain.<init>(AgentMain.java:91)
            at com.ankit.agents.AgentMain.main(AgentMain.java:132)
    
    Exception in thread "main" java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
            at io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:256)
            at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
            at io.grpc.netty.GrpcSslContexts.forServer(GrpcSslContexts.java:151)
            at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:456)
            at io.grpc.netty.NettyServerBuilder.useTransportSecurity(NettyServerBuilder.java:55)
            at com.ankit.agents.AgentMain.<init>(AgentMain.java:91)
            at com.ankit.agents.AgentMain.main(AgentMain.java:132)
    
    

    However, it is running fine on an Ubuntu machine. I am running the jar as follows: /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -jar agent-1.0.jar

    The java version here is:

    $ /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -version
    openjdk version "1.8.0_171"
    OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-2~14.04-b11)
    OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
    

    What is the problem here and how to solve this?

    opened by ankitshubham97 35
  • Flaky CompressionTest

    Flaky CompressionTest

    Found in https://travis-ci.org/grpc/grpc-java/jobs/151357545

    io.grpc.testing.integration.CompressionTest > compression[23] FAILED
        io.grpc.StatusRuntimeException: INTERNAL: Exception deframing message
            at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:230)
            at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:211)
            at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:144)
            at io.grpc.testing.integration.TestServiceGrpc$TestServiceBlockingStub.unaryCall(TestServiceGrpc.java:369)
            at io.grpc.testing.integration.CompressionTest.compression(CompressionTest.java:217)
            Caused by:
            io.grpc.StatusRuntimeException: INTERNAL: Can't decode compressed frame as compression not configured.
    
    code health highly flaky 
    opened by zhangkun83 35
  • {Netty,OkHttp}TransportTest.serverNotListening is flaky

    {Netty,OkHttp}TransportTest.serverNotListening is flaky

    https://grpc-testing.appspot.com/job/gRPC-Java-PR-Windows/1439/console

    io.grpc.okhttp.OkHttpTransportTest > serverNotListening FAILED
        Wanted but not invoked:
        listener.transportTerminated();
        -> at io.grpc.internal.testing.AbstractTransportTest.serverNotListening(AbstractTransportTest.java:178)
        Actually, there were zero interactions with this mock.
    
    code health highly flaky 
    opened by ejona86 31
  • server performance issues

    server performance issues

    Hi grpc-java guys, I have wrote some programs to do the performance testing for grpc-java. The service is very simple, just echo the strings (about 400 bytes per request) received from clients. (Actually, I disabled servers' log.) Appears that it's is difficult for me to archive high requests-per-second and low response-time.

    requests-per-second: about 220k (expected: 1000MB/400B) reponse-time: p99 25ms, p999 33ms (expected: p99 below 4ms)

    My environment and configurations are listed as follows.

    Environment: 48 cores/128GB memory/10000Mbps net/CentOS Linux release 7.2.1511 gRPC Version: 1.8.0 JVM options: JDK 1.7.80 -Xms4g -Xmx8g bossGroup: 4 threads workerGroup: 160 threads executor: ThreadPoolExecutor(64, 64, 1000 * 60 * 10, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(65536))

    threaddump.txt

    According to the thread dump, many worker threads stick to SerializingExecutor.

    question 
    opened by xiaoshuang-lu 30
  • servlet: Implement gRPC server as a Servlet

    servlet: Implement gRPC server as a Servlet

    The goal is as described in #1621 to add the ability to run a gRPC server as a Servlet on any web container with the Servlet 4.0 support and HTTP/2 enabled.

    cc @vlsinitsyn @cs224 @jnehlmeier @hofmanndavid

    cc @meltsufin for high level design

    API

    This PR provides the following API:

    An adapter

    /**
     * An adapter that transforms {@link HttpServletRequest} into gRPC request and lets a gRPC server
     * process it, and transforms the gRPC response into {@link HttpServletResponse}. An adapter can be
     * instantiated by {@link ServletServerBuilder#buildServletAdapter()}.
     *
     * <p>In a servlet, calling {@link #doPost(HttpServletRequest, HttpServletResponse)} inside {@link
     * javax.servlet.http.HttpServlet#doPost(HttpServletRequest, HttpServletResponse)} makes the servlet
     * backed by the gRPC server associated with the adapter. The servlet must support Asynchronous
     * Processing and must be deployed to a container that supports servlet 4.0 and enables HTTP/2.
     */
    public final class ServletAdapter {
       /**
       * Call this method inside {@link javax.servlet.http.HttpServlet#doGet(HttpServletRequest,
       * HttpServletResponse)} to serve gRPC POST request.
       */
      public doPost(HttpServletRequest, HttpServletResponse);
    

    and a grpc server builder

    /** Builder to build a gRPC server that can run as a servlet. */
    public final class io.grpc.servlet.ServletServerBuilder extends ServerBuilder
    
      /**
       * <p>Users should not call this method directly. Instead users should call
       * {@link #buildServletAdapter()} which internally will call {@code build()} and {@code start()}
       * appropriately.
       * @throws IllegalStateException if this method is called by users directly
       */
      @Override
      public Server build();
    
      /** Creates a {@link ServletAdapter}.*/
      public ServletAdapter buildServletAdapter();
    
    

    and a servlet impl

    public class GrpcServlet extends HttpServlet {
      public GrpcServlet(List<BindableService> grpcServices);
    }
    

    A ServletAdapter instance will be backing one or more gRPC services with a ServletServerBuilder

    ServletAdapter servletAdapter = 
        new ServletServerBuilder().addService(new HelloServiceImpl()).buildServletAdapter();
    

    A servlet powering the gRPC services will be as simple as either

    @WebServlet(asyncSupported = true)
    public class HelloServlet extends HttpServlet {
    
      @Override
      protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
        servletAdapter.doPost(req, resp);  
      }
    }
    

    or

    @WebServlet(asyncSupported = true)
    public class HelloServlet extends GrpcServlet {
    }
    

    Alternative API

    Hello World example

    See examples/example-servlet/src/main/java/io/grpc/servlet/examples/helloworld/

    Implementation

    Aside from trivial API pluming, what the impl actually does is (in doPost() method)

    • start an AsyncContext
    • set WriteListener and ReadListener for the ServletOutputStream and ServletInputStream
    • create and pass a new instance of io.grpc.servlet.ServletServerStream to ServerTransportListener.streamCreated(serverStream, method, headers)
    • This ServletServerStream calls stream.transportState().inboundDataReceived() in the ReadListener.onDataAvailable() callback
    • The ServletServerStream holds a WritableBufferAllocator for the outbound data that will write to the ServletOutputStream, and uses an atomic ref of ServletServerStream.WriteState to coordinate with the WriteListener.onWritePossible() callback.
    • The ServletServerStream.TransportState.runOnTransportThread() method uses a SerializingExecutor(directExecutor())

    Test result

    We tested it with a servlet backed by the InteropTest gRPC service TestServiceImp, and an ordinary gRPC InteropTest client, for the test cases EMPTY_UNARY, LARGE_UNARY, CLIENT_STREAMING, SERVER_STREAMING, and PING_PONG. The following are the test results of some of the web container vendors

    Jetty 10.0-SNAPSHOT

    All tests passed! Jetty looks fully compliant with the Servlet 4.0 spec and HTTP/2 protocol. :100: @sbordet


    GlassFish 5.0 - Web Profile

    All tests passed with minor workaround. An issue of GlassFish is filed, cc @mattgill98 for help:


    Tomcat 9.0.10

    Non-blocking servlet I/O (ReadListener/WriteListener) practically can not work in full-duplex case. Only EMPTY_UNARY test passed. (Update: Filed multiple bugs to Tomcat: cc @markt-asf for help)

    (Update: Tomcat 9.0.x trunk

    All tests passed! :100:)


    Undertow 2.0.11.Final/WildFly-14.0.0.Beta1

    Not able to test. Simply can not make the servlet container send out trailers for plain servlet. cc @ctomc @stuartwdouglas for help (Update: Identified as undertow bug

    )

    (Update: Undertow 2.0.12.Final

    All tests passed! :100:)

    opened by dapengzhang0 28
  • Question on Android Requirements

    Question on Android Requirements

    I have a grpc server written in go which serves through a valid https certificate, and an Android client like the examples but without the usePlaintext(true) part.

    The RPC services work fine for Android devices with sdk-version >= 21, but they fail for older devices with this exception:

    io.grpc.StatusRuntimeException: UNAVAILABLE: No provided cause
        at io.grpc.Status.asRuntimeException(Status.java:503)
        at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:207)
        at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:140)
        at net.honarnama.nano.AuthServiceGrpc$AuthServiceBlockingStub.createAccount(AuthServiceGrpc.java:290)
        ... app stack
    Caused by: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb8adea90: Failure in SSL library, usually a protocol error
    error:140740B5:SSL routines:SSL23_CLIENT_HELLO:no ciphers available (external/openssl/ssl/s23_clnt.c:486 0xac7ba990:0x00000000)
        at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:448)
        at io.grpc.okhttp.OkHttpProtocolNegotiator.negotiate(OkHttpProtocolNegotiator.java:106)
        at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.negotiate(OkHttpProtocolNegotiator.java:172)
        at io.grpc.okhttp.OkHttpTlsUpgrader.upgrade(OkHttpTlsUpgrader.java:74)
        at io.grpc.okhttp.OkHttpClientTransport$1.run(OkHttpClientTransport.java:345)
        at io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:154)
        ... 3 more
    Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb8adea90: Failure in SSL library, usually a protocol error
    error:140740B5:SSL routines:SSL23_CLIENT_HELLO:no ciphers available (external/openssl/ssl/s23_clnt.c:486 0xac7ba990:0x00000000)
        at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
        at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405)
        ... 8 more
    

    Using this mechanism I was able to perform the rpc call on an older device, but the suitable Google Play Services version isn't installed on more than half of the devices in my target population. Is there another way to make grpc work on theses devices? Like switching to Netty-based transport? Is there any sample of an android app usig Netty-based transport?

    Thanks in advance

    opened by emojahedi 28
  • xds: support istio grpc-agent

    xds: support istio grpc-agent

    I tried to use xDS with istio grpc-agent. But it doesn't work well.

    Is your feature request related to a problem?

    xDS doesn't work with istio grpc-agent because not supported NameResolver of unix:/// https://github.com/grpc/grpc-java/issues/4750

    Then I write a simple NameResolverProvider that it just returns DomainSocketAddress, but it doesn't work.

    Feb 02, 2022 7:56:38 PM io.grpc.internal.ManagedChannelImpl$NameResolverListener handleErrorInSyncContext
    WARNING: [Channel<8>: (xds:///xxx.core.svc.cluster.local:9000)] Failed to resolve name. status=Status{code=UNAVAILABLE, description=NameResolver returned no usable address. addrs=[], attrs={}
    io.grpc.xds.XdsNameResolver@7c6c48cc was used, cause=null}
    

    Describe the solution you'd like

    Enable xDS to handle unix domain socket with istio grpc-agent like grpc-go.

    Additional context

    https://istio.io/latest/blog/2021/proxyless-grpc/

    enhancement 
    opened by naoh87 27
  • Android Gradle Build Errors

    Android Gradle Build Errors

    What version of gRPC-Java are you using?

    1.27.0

    What is your environment?

    macOSCatalina 10.15.3 java version "1.8.0_241" Android Studio 3.5.3 Gradle 6.0.1

    What did you expect to see?

    I have previously encountered some errors when building an android project as shown here but resolved them by using the sample files provided in the examples. That was with a clean Android Studio project and using my actual proto file. I expected to be able to use that same setup to integrate grpc into my actual project and generate the required code.

    What did you see instead?

    When I integrate grpc into my actual project using the same elements from my gradle which worked in the clean project, there are numerous errors which occur no matter what variations I try and use to resolve them.

    Is there a fundamental error in the gradle file as it is being used in my actual project?

    I will provide the gradle files being used in my actual project for reference and then outline some of the errors that occur and the variations I have tried to use to resolve them.

    Steps to reproduce the bug

    Here is the project level gradle file before grpc integration:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        ext.kotlin_version = '1.3.61'
        repositories {
            google()
            jcenter()
            maven { url 'https://jitpack.io' }
           
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.3'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:4.3.2'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven { url 'https://jitpack.io' }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    Here is the app level gradle file before integrating any grpc items:

    apply plugin: 'com.android.application'
    
    apply plugin: 'kotlin-android'
    
    apply plugin: 'kotlin-android-extensions'
    
    apply plugin: 'com.google.gms.google-services'
    
    
    android {
        compileSdkVersion 29
        defaultConfig {
            applicationId "com.sample.sample"
            minSdkVersion 24
            targetSdkVersion 29
            versionCode 1
            versionName "1.0.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    
        dataBinding {
            enabled = true
        }
    
        compileOptions {
            sourceCompatibility 1.8
            targetCompatibility 1.8
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.core:core-ktx:1.2.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        implementation 'com.google.android.material:material:1.2.0-alpha04'
        implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
        implementation 'androidx.legacy:legacy-support-v4:1.0.0'
        implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
        implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
    
        implementation 'com.google.firebase:firebase-auth:19.2.0'
        implementation 'com.firebaseui:firebase-ui-auth:6.0.2'
        implementation 'com.google.gms:google-services:4.3.3'
    
        implementation 'com.google.firebase:firebase-messaging:20.1.0'
        implementation 'com.google.firebase:firebase-storage:19.1.1'
        implementation 'com.google.firebase:firebase-appindexing:19.1.0'
    
        implementation 'com.google.firebase:firebase-dynamic-links:19.0.0'
        implementation 'com.google.firebase:firebase-inappmessaging:19.0.3'
    
        implementation 'com.google.firebase:firebase-ml-vision:24.0.1'
        implementation 'com.google.firebase:firebase-ml-vision-image-label-model:19.0.0'
        implementation 'com.google.firebase:firebase-ml-vision-face-model:19.0.0'
        implementation 'com.google.firebase:firebase-ml-vision-object-detection-model:19.0.3'
        implementation 'com.google.firebase:firebase-ml-vision-automl:18.0.3'
        implementation 'com.google.firebase:firebase-ml-natural-language:22.0.0'
        implementation 'com.google.firebase:firebase-ml-natural-language-language-id-model:20.0.7'
        implementation 'com.google.firebase:firebase-ml-natural-language-translate-model:20.0.7'
        implementation 'com.google.firebase:firebase-ml-natural-language-smart-reply-model:20.0.7'
        implementation 'com.google.firebase:firebase-ml-model-interpreter:22.0.1'
        implementation 'com.google.firebase:firebase-perf:19.0.5'
        implementation 'com.google.firebase:firebase-database:19.2.1'
        implementation 'com.google.firebase:firebase-config:19.1.1'
    
        testImplementation 'junit:junit:4.13'
        androidTestImplementation 'androidx.test:runner:1.2.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    
        //sdp
        implementation 'com.intuit.sdp:sdp-android:1.0.6'
    
        //Floating Action Button
        implementation "com.leinardi.android:speed-dial:3.0.0"
    
        implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
    
        implementation 'com.google.code.gson:gson:2.8.6'
        implementation 'androidx.emoji:emoji:1.0.0'
    
        // implementation 'io.github.rockerhieu:emojicon:1.4.1'
        // local storage
        implementation 'io.paperdb:paperdb:2.6'
    
        //Birth date selection view
        implementation 'com.github.BlackBoxVision:material-wheel-view:v0.0.1'
    
    }
    
    apply plugin: 'com.google.gms.google-services'
    
    if (hasProperty('buildScan')) {
        buildScan {
            termsOfServiceUrl = 'https://gradle.com/terms-of-service'
            termsOfServiceAgree = 'yes'
        }
    }
    

    Here are the same two files after integrating grpc as following the format that was running on the clean project with the production proto file:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        ext.kotlin_version = '1.3.61'
        repositories {
            google()
            jcenter()
            maven { url 'https://jitpack.io' }
            
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.3'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:4.3.2'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
            classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.11"
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven { url 'https://jitpack.io' }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    apply plugin: 'com.android.application'
    
    apply plugin: 'kotlin-android'
    
    apply plugin: 'kotlin-android-extensions'
    
    apply plugin: 'com.google.gms.google-services'
    
    apply plugin: 'com.google.protobuf'
    
    
    android {
        compileSdkVersion 29
        defaultConfig {
            applicationId "com.fhltr.fhltr"
            minSdkVersion 24
            targetSdkVersion 29
            versionCode 1
            versionName "1.0.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    
        dataBinding {
            enabled = true
        }
    
        compileOptions {
            sourceCompatibility 1.8
            targetCompatibility 1.8
        }
    }
    
    protobuf {
        protoc { artifact = 'com.google.protobuf:protoc:3.11.0' }
        plugins {
            grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.27.0' // CURRENT_GRPC_VERSION
            }
        }
        generateProtoTasks {
            all().each { task ->
                task.builtins {
                    java { option 'lite' }
                }
                task.plugins {
                    grpc { // Options added to --grpc_out
                        option 'lite' }
                }
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.core:core-ktx:1.2.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        implementation 'com.google.android.material:material:1.2.0-alpha04'
        implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
        implementation 'androidx.legacy:legacy-support-v4:1.0.0'
        implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
        implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
    
        implementation 'com.google.firebase:firebase-auth:19.2.0'
        implementation 'com.firebaseui:firebase-ui-auth:6.0.2'
        implementation 'com.google.gms:google-services:4.3.3'
    
        implementation 'com.google.firebase:firebase-messaging:20.1.0'
        implementation 'com.google.firebase:firebase-storage:19.1.1'
        implementation 'com.google.firebase:firebase-appindexing:19.1.0'
    
    
        //Put below library to solve crash issue
        // implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
        //implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.2'
    
        implementation 'com.google.firebase:firebase-dynamic-links:19.0.0'
        implementation 'com.google.firebase:firebase-inappmessaging:19.0.3'
    
        implementation 'com.google.firebase:firebase-ml-vision:24.0.1'
        implementation 'com.google.firebase:firebase-ml-vision-image-label-model:19.0.0'
        implementation 'com.google.firebase:firebase-ml-vision-face-model:19.0.0'
        implementation 'com.google.firebase:firebase-ml-vision-object-detection-model:19.0.3'
        implementation 'com.google.firebase:firebase-ml-vision-automl:18.0.3'
        implementation 'com.google.firebase:firebase-ml-natural-language:22.0.0'
        implementation 'com.google.firebase:firebase-ml-natural-language-language-id-model:20.0.7'
        implementation 'com.google.firebase:firebase-ml-natural-language-translate-model:20.0.7'
        implementation 'com.google.firebase:firebase-ml-natural-language-smart-reply-model:20.0.7'
        implementation 'com.google.firebase:firebase-ml-model-interpreter:22.0.1'
        implementation 'com.google.firebase:firebase-perf:19.0.5'
        implementation 'com.google.firebase:firebase-database:19.2.1'
        implementation 'com.google.firebase:firebase-config:19.1.1'
    
        testImplementation 'junit:junit:4.13'
        androidTestImplementation 'androidx.test:runner:1.2.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    
        //sdp
        implementation 'com.intuit.sdp:sdp-android:1.0.6'
    
        //Floating Action Button
        implementation "com.leinardi.android:speed-dial:3.0.0"
    
        implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
    
        implementation 'com.google.code.gson:gson:2.8.6'
        implementation 'androidx.emoji:emoji:1.0.0'
    
        // implementation 'io.github.rockerhieu:emojicon:1.4.1'
        // local storage
        implementation 'io.paperdb:paperdb:2.6'
    
        //Birth date selection view
        implementation 'com.github.BlackBoxVision:material-wheel-view:v0.0.1'
    
        implementation 'javax.annotation:javax.annotation-api:1.3.2'
    
        implementation 'io.grpc:grpc-protobuf-lite:1.27.0' // CURRENT_GRPC_VERSION
        implementation 'io.grpc:grpc-stub:1.27.0' // CURRENT_GRPC_VERSION
    
        implementation 'io.grpc:grpc-cronet:1.24.0'
        implementation 'com.google.android.gms:play-services-cronet:17.0.0'
    
    }
    
    if (hasProperty('buildScan')) {
        buildScan {
            termsOfServiceUrl = 'https://gradle.com/terms-of-service'
            termsOfServiceAgree = 'yes'
        }
    }
    
    question 
    opened by z9fyak74amnjbvcyn4t2g 27
  • Resource leak in v0.9.0 and v0.12.0

    Resource leak in v0.9.0 and v0.12.0

    After running GRPC for a while I get the following error (with io.netty.leakDetection.level=advanced):

    LEAK: ByteBuf.release() was not called before it's garbage-collected. See http://netty.io/wiki/reference-counted-objects.html for more information.
    Recent access records: 1
    #1:
        Hint: 'DefaultChannelPipeline$HeadContext#0' will handle the message from this point.
        io.netty.buffer.CompositeByteBuf.touch(CompositeByteBuf.java:1615)
        io.netty.buffer.CompositeByteBuf.touch(CompositeByteBuf.java:42)
        io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:264)
        io.netty.handler.codec.http2.DefaultHttp2FrameWriter.writeData(DefaultHttp2FrameWriter.java:142)
        io.netty.handler.codec.http2.Http2OutboundFrameLogger.writeData(Http2OutboundFrameLogger.java:42)
        io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder$FlowControlledData.write(DefaultHttp2ConnectionEncoder.java:356)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$DefaultState.write(DefaultHttp2RemoteFlowController.java:674)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$DefaultState.writeBytes(DefaultHttp2RemoteFlowController.java:645)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$DefaultState.writeAllocatedBytes(DefaultHttp2RemoteFlowController.java:544)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$1.visit(DefaultHttp2RemoteFlowController.java:44)
        io.netty.handler.codec.http2.DefaultHttp2Connection$ActiveStreams.forEachActiveStream(DefaultHttp2Connection.java:1100)
        io.netty.handler.codec.http2.DefaultHttp2Connection.forEachActiveStream(DefaultHttp2Connection.java:135)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.writePendingBytes(DefaultHttp2RemoteFlowController.java:310)
        io.netty.handler.codec.http2.Http2ConnectionHandler.flush(Http2ConnectionHandler.java:204)
        io.netty.channel.ChannelHandlerInvokerUtil.invokeFlushNow(ChannelHandlerInvokerUtil.java:165)
        io.netty.channel.DefaultChannelHandlerInvoker.invokeFlush(DefaultChannelHandlerInvoker.java:355)
        io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:272)
        io.netty.channel.DefaultChannelPipeline.flush(DefaultChannelPipeline.java:997)
        io.netty.channel.AbstractChannel.flush(AbstractChannel.java:226)
        io.grpc.netty.WriteQueue.flush(WriteQueue.java:131)
        io.grpc.netty.WriteQueue.access$000(WriteQueue.java:48)
        io.grpc.netty.WriteQueue$1.run(WriteQueue.java:58)
        io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:339)
        io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:356)
        io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:742)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        java.lang.Thread.run(Thread.java:745)
    Created at:
        io.netty.buffer.CompositeByteBuf.<init>(CompositeByteBuf.java:63)
        io.netty.buffer.AbstractByteBufAllocator.compositeDirectBuffer(AbstractByteBufAllocator.java:193)
        io.netty.buffer.AbstractByteBufAllocator.compositeBuffer(AbstractByteBufAllocator.java:171)
        io.netty.channel.CoalescingBufferQueue.compose(CoalescingBufferQueue.java:156)
        io.netty.channel.CoalescingBufferQueue.remove(CoalescingBufferQueue.java:132)
        io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder$FlowControlledData.write(DefaultHttp2ConnectionEncoder.java:351)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$DefaultState.write(DefaultHttp2RemoteFlowController.java:674)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$DefaultState.writeBytes(DefaultHttp2RemoteFlowController.java:645)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$DefaultState.writeAllocatedBytes(DefaultHttp2RemoteFlowController.java:544)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController$1.visit(DefaultHttp2RemoteFlowController.java:44)
        io.netty.handler.codec.http2.DefaultHttp2Connection$ActiveStreams.forEachActiveStream(DefaultHttp2Connection.java:1100)
        io.netty.handler.codec.http2.DefaultHttp2Connection.forEachActiveStream(DefaultHttp2Connection.java:135)
        io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.writePendingBytes(DefaultHttp2RemoteFlowController.java:310)
        io.netty.handler.codec.http2.Http2ConnectionHandler.flush(Http2ConnectionHandler.java:204)
        io.netty.channel.ChannelHandlerInvokerUtil.invokeFlushNow(ChannelHandlerInvokerUtil.java:165)
        io.netty.channel.DefaultChannelHandlerInvoker.invokeFlush(DefaultChannelHandlerInvoker.java:355)
        io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:272)
        io.netty.channel.DefaultChannelPipeline.flush(DefaultChannelPipeline.java:997)
        io.netty.channel.AbstractChannel.flush(AbstractChannel.java:226)
        io.grpc.netty.WriteQueue.flush(WriteQueue.java:131)
        io.grpc.netty.WriteQueue.access$000(WriteQueue.java:48)
        io.grpc.netty.WriteQueue$1.run(WriteQueue.java:58)
        io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:339)
        io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:356)
        io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:742)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        java.lang.Thread.run(Thread.java:745)
    

    This looks similar to #336 but not quite identical. This happens on a 64-bit Linux machine running Oracle Java 1.8.0. I'm happy to provide more information if required.

    opened by unlikely-leo 27
  • Override ContentType header not possible

    Override ContentType header not possible

    Hello grpc-java team!

    I have found that it's not possible to override content type header using both implementations (client/server) I need this to get work the Charles proxy which is saying in it's documentation that support of grpc exists but only when messages has Charles identifies that an HTTP request or response contains a Protocol Buffers message when the Content-Type header has a MIME type ofapplication/x-protobuf or application/x-google-protobuf.

    ATM server always returns the 'content-type': 'application/grpc'

    On server Im trying to override this header using interseptor

    @VisibleForTesting
      static final Metadata.Key<String> CUSTOM_HEADER_KEY =
          Metadata.Key.of("content-type", Metadata.ASCII_STRING_MARSHALLER);
    
      @Override
      public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
          ServerCall<ReqT, RespT> call,
          final Metadata requestHeaders,
          ServerCallHandler<ReqT, RespT> next) {
        logger.info("header received from client:" + requestHeaders);
        return next.startCall(new SimpleForwardingServerCall<ReqT, RespT>(call) {
          @Override
          public void sendHeaders(Metadata responseHeaders) {
            responseHeaders.put(CUSTOM_HEADER_KEY, "application/x-google-protobuf");
            super.sendHeaders(responseHeaders);
          }
        }, requestHeaders);
      }
    

    But client keeps receiving 'content-type': 'application/grpc' and not overriding it

    HEADERS: '[':status': '200', 'content-type': 'application/grpc', 'my_custom': 'custom_value', 'grpc-encoding': 'identity', 'grpc-accept-encoding': 'gzip']']
    

    Is it possible to override this header?

    question 
    opened by sergeybrazhnik-cb 3
  • xds: Disallow duplicate addresses in the RingHashLB.

    xds: Disallow duplicate addresses in the RingHashLB.

    Flag it as an error when the duplicate addresses are passed to acceptResolvedAddresses.

    Removed test that was previously checking for specific expected behavior with duplicate addresses.

    opened by larry-safran 0
  • gRPC works fine on my mac but throws exception when I deployed the war on azure linux app service, how can I resolve this?

    gRPC works fine on my mac but throws exception when I deployed the war on azure linux app service, how can I resolve this?

    It seems I am using grpc, I didn't know it before today, what I am using is Firebase Admin SDK for Java and us I get noticed because of this error Firebase use grpc.

    My app is a Java Server app deployed on a Tomcat 8.5 Server and that connects with Firebase thru Firebase Admin SDK. Everything works fine while I running on my localhost Tomcat instance on my mac but when I deployed to an Azure app service, which is a Linux Alpine 3.9 I receive the exception of the stacktrace below:

    2022-12-22 18:56:25,126 ERROR BaseQueueProcessCallback:41 - Error en ejecucion cola:java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
    com.google.cloud.firestore.FirestoreException: java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
            at com.google.cloud.firestore.FirestoreException.forIOException(FirestoreException.java:94)
            at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:91)
            at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:81)
            at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:560)
            at com.google.cloud.firestore.FirestoreOptions.getFirestoreRpc(FirestoreOptions.java:365)
            at com.google.cloud.firestore.FirestoreImpl.<init>(FirestoreImpl.java:72)
            at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:72)
            at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:65)
            at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:540)
            at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:51)
            at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:29)
            at com.google.firebase.cloud.FirestoreClient$FirestoreClientService.<init>(FirestoreClient.java:95)
            at com.google.firebase.cloud.FirestoreClient.getInstance(FirestoreClient.java:85)
            at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:78)
            at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:64)
            at com.areateclab.survey.server.firebase.FirebaseDAO.getDB(FirebaseDAO.java:36)
            at com.areateclab.survey.server.firebase.FirebaseDAO.createDocument(FirebaseDAO.java:42)
            at com.areateclab.survey.server.queue.survey.SurveyQueueProcess.execute(SurveyQueueProcess.java:26)
            at com.areateclab.survey.server.queue.survey.SurveyQueueProcess.execute(SurveyQueueProcess.java:15)
            at com.areateclab.survey.server.queue.QueueRecord.execute(QueueRecord.java:49)
            at com.areateclab.survey.server.queue.QueueProcessConsumer.run(QueueProcessConsumer.java:59)
            at java.lang.Thread.run(Thread.java:748)
    Caused by: java.io.IOException: java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
            at com.google.cloud.firestore.spi.v1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:141)
            at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:89)
            ... 20 more
    Caused by: java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
            at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:246)
            at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:146)
            at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:95)
            at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$DefaultProtocolNegotiator.newNegotiator(NettyChannelBuilder.java:623)
            at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:529)
            at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyChannelTransportFactoryBuilder.buildClientTransportFactory(NettyChannelBuilder.java:188)
            at io.grpc.internal.ManagedChannelImplBuilder.build(ManagedChannelImplBuilder.java:630)
            at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:264)
            at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:360)
            at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.access$1800(InstantiatingGrpcChannelProvider.java:81)
            at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:231)
            at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
            at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:241)
            at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:219)
            at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:199)
            at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:133)
            at com.google.cloud.firestore.spi.v1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:126)
            ... 21 more
    

    Versions involved

    • Java 8
    • Tomcat v8.5
    • Firebase Admin SDK v8.1.0
    • Linux Alpine 3.9

    Versions of grpc and netty founded

    • When search my dependencies for grpc this was the resulted versions DDFCCD55-8286-4DCE-B019-5AB97503B706
    • When search my dependencies for netty this was the resulted versions FB5959F9-138C-4413-BEF7-92C75B24AB96

    I was searching in google with not much success about the issue, most of the few links I found talk about missing libraries but I couldn't found missing libraries in my environment. Also I tried adding this library that at first was not present in my environment but the error remains:

    <dependency>
    	        <groupId>io.netty</groupId>
    	        <artifactId>netty-tcnative-boringssl-static</artifactId>
    	        <version>2.0.34.Final</version>
    </dependency>
    

    Any help you could give me I will appreciated, I have no clue about how can I resolve the issue.

    question 
    opened by dardison 2
  • //services:services_maven should declare a compile-time dependency on //services:reflection

    //services:services_maven should declare a compile-time dependency on //services:reflection

    What version of gRPC-Java are you using?

    1.51.1

    I am using rules_jvm_external to build applications with dependencies on Maven artifacts. grpc-java recommends configuring rules_jvm_external's maven_install override_targets so that the io.grpc:grpc-services Maven target is overridden to resolve to the @io_grpc_grpc_java//services:services_maven Bazel target. However currently @io_grpc_grpc_java//services:services_maven only declares a runtime dependency on //services:reflection.

    Consequently, any Maven artifact with a compile-time dependency on any classes defined in //services:reflection will fail to build. For example, Helidon has a compile time dependency on io.grpc:grpc-services: here it defines a class that extends io.grpc.reflection.v1alpha.ServerReflectionGrpc.ServerReflectionImplBase. Any application with a compile-time dependency on that class will fail to build with error message error: cannot access ServerReflectionGrpc.

    Compile-time dependencies on io.grpc:grpc-services are recommended elsewhere as well, including in grpc-java's own documentation.

    Declaring //services:reflection as a compile-time dependency of the services_maven target will allow all Maven artifacts with a compile-time dependency on io.grpc:grpc-services to build successfully in Bazel using maven_install.

    TODO:release blocker 
    opened by davidmandle 5
  • Client work in IDE, but fail in fat-jar

    Client work in IDE, but fail in fat-jar

    Windows 10 Pro, latest updates; Java 17.0.5, Oracle; Maven 3.8.6; IntelliJ IDEA 2022.3; gRPC 1.51.1; protobuf 3.21.12 Server work fine in IDE and fat-jar Client work only from IDE, from fat-jar i get this error

    C:\Users\Alex\Documents\IdeaProjects\echogrpc>java -cp target/echogrpc-1.0-SNAPSHOT-jar-with-dependencies.jar en.test.HelloClient Alex
    io.grpc.StatusRuntimeException: UNKNOWN
            at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271)
            at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252)
            at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165)
            at en.test.GreeterGrpc$GreeterBlockingStub.sayHello(GreeterGrpc.java:157)
            at en.test.HelloClient.run(HelloClient.java:27)
            at en.test.HelloClient.main(HelloClient.java:15)
    Caused by: java.nio.channels.UnsupportedAddressTypeException
            at java.base/sun.nio.ch.Net.checkAddress(Net.java:146)
            at java.base/sun.nio.ch.Net.checkAddress(Net.java:157)
            at java.base/sun.nio.ch.SocketChannelImpl.checkRemote(SocketChannelImpl.java:816)
            at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:839)
            at io.grpc.netty.shaded.io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:91)
            at io.grpc.netty.shaded.io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:88)
            at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
            at io.grpc.netty.shaded.io.netty.util.internal.SocketUtils.connect(SocketUtils.java:88)
            at io.grpc.netty.shaded.io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:322)
            at io.grpc.netty.shaded.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:248)
            at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
            at io.grpc.netty.shaded.io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.java:54)
            at io.grpc.netty.shaded.io.grpc.netty.WriteBufferingAndExceptionHandler.connect(WriteBufferingAndExceptionHandler.java:157)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.access$1000(AbstractChannelHandlerContext.java:61)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext$9.run(AbstractChannelHandlerContext.java:538)
            at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
            at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
            at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
            at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
            at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
            at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
            at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
            at java.base/java.lang.Thread.run(Thread.java:833)
    

    pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>en.test</groupId>
        <artifactId>echogrpc</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <properties>
            <maven.compiler.source>17</maven.compiler.source>
            <maven.compiler.target>17</maven.compiler.target>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <grpc.version>1.51.1</grpc.version>
            <protobuf.version>3.21.12</protobuf.version>
        </properties>
    <dependencies>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty-shaded</artifactId>
            <version>${grpc.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf</artifactId>
            <version>${grpc.version}</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-stub</artifactId>
            <version>${grpc.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-annotations-api</artifactId>
            <version>9.0.70</version>
        </dependency>
    
    </dependencies>
        <build>
            <extensions>
                <extension>
                    <groupId>kr.motd.maven</groupId>
                    <artifactId>os-maven-plugin</artifactId>
                    <version>1.7.1</version>
                </extension>
            </extensions>
            <plugins>
                <plugin>
                    <groupId>org.xolstice.maven.plugins</groupId>
                    <artifactId>protobuf-maven-plugin</artifactId>
                    <version>0.6.1</version>
                    <configuration>
                        <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
                        <pluginId>grpc-java</pluginId>
                        <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                                <goal>compile-custom</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.3.0</version>
                    <executions>
                        <execution>
                            <id>test</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>add-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>${basedir}/target/generated-sources/protobuf</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <groupId>org.apache.maven.plugins</groupId>
                    <version>3.3.0</version>
                    <executions>
                        <execution>
                            <id>make-executable-jar-with-dependencies</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                            <configuration>
                                <archive>
                                    <manifest>
                                        <mainClass>en.test.HelloServer</mainClass>
                                    </manifest>
                                </archive>
                                <descriptorRefs>
                                    <descriptorRef>jar-with-dependencies</descriptorRef>
                                </descriptorRefs>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
    

    Greet.proto

    syntax = "proto3";
    
    option java_package = "en.test";
    
    service Greeter {
      rpc SayHello (HelloRequest) returns (HelloReply);
    }
    
    message HelloRequest {
      string name = 1;
    }
    
    message HelloReply {
      string message = 1;
    }
    

    GreeterService.java

    package en.test;
    
    import io.grpc.stub.StreamObserver;
    import en.test.GreeterGrpc;
    import en.test.Greet;
    
    public class GreeterService extends GreeterGrpc.GreeterImplBase {
        @Override
        public void sayHello(Greet.HelloRequest request, StreamObserver<Greet.HelloReply> responseObserver) {
            String name = request.getName();
            String message = "Hello, " + name + "!";
            System.out.println("New client request with name: " + name);
            Greet.HelloReply reply = Greet.HelloReply.newBuilder().setMessage(message).build();
            responseObserver.onNext(reply);
            responseObserver.onCompleted();
        }
    }
    

    HelloServer.java

    package en.test;
    
    import io.grpc.Server;
    import io.grpc.ServerBuilder;
    import java.io.IOException;
    
    public class HelloServer {
        public static void main(String[] args) {
            try {
                new HelloServer().run();
            } catch (IOException | InterruptedException e) {
                e.printStackTrace();
            }
        }
    
        private void run() throws IOException, InterruptedException {
            int port = 50051;
            Server server = ServerBuilder.forPort(port)
                    .addService(new GreeterService())
                    .build()
                    .start();
            System.out.println("Server started, listening on " + port);
            Runtime.getRuntime().addShutdownHook(new Thread(() -> {
                System.err.println("Shutting down gRPC server since JVM is shutting down");
                if (server != null) {
                    server.shutdown();
                }
                System.err.println("Server shut down");
            }));
            server.awaitTermination();
        }
    
    }
    

    HelloClient.java

    package en.test;
    
    import io.grpc.ManagedChannel;
    import io.grpc.ManagedChannelBuilder;
    import io.grpc.StatusRuntimeException;
    import en.test.GreeterGrpc;
    import en.test.Greet;
    
    public class HelloClient {
        public static void main(String[] args) {
            String name = "World";
            if (args.length > 0) {
                name = args[0];
            }
            new HelloClient().run(name);
        }
    
        private void run(String name) {
            int port = 50051;
            ManagedChannel channel = ManagedChannelBuilder
                    .forAddress("127.0.0.1", port)
                    .usePlaintext()
                    .build();
            GreeterGrpc.GreeterBlockingStub stub = GreeterGrpc.newBlockingStub(channel);
            Greet.HelloRequest request = Greet.HelloRequest.newBuilder().setName(name).build();
            try {
            Greet.HelloReply reply = stub.sayHello(request);
            System.out.println("Server response: " + reply.getMessage());
            } catch (StatusRuntimeException e) {
                e.printStackTrace();
            }
        }
    }
    
    opened by alecss131 5
Releases(v1.51.1)
  • v1.51.1(Dec 14, 2022)

  • v1.51.0(Nov 19, 2022)

    Bug Fixes

    • grpclb: Fix a debug logging message which incorrectly logged loadbalancer addresses under backend addresses. (#9602)

    New Features

    • okhttp: okhttp server now supports maxConnectionAge and maxConnectionAgeGrace configuration for improved connection management. (#9649)

    Behavior Changes

    • netty: switch default cumulation strategy from MERGE to ADAPTIVE. When accumulating incoming network data, Adaptive cumulator dynamically switches between MERGE and COMPOSE strategies to minimize the amount of copying while also limiting per-buffer overhead. (#9558)

    Acknowledgements

    @TrevorEdwards

    Source code(tar.gz)
    Source code(zip)
  • v1.50.2(Oct 21, 2022)

    Bug fixes

    gcp-observability: Supports period(.) in the service name part of regular expression for a fully-qualified method to accept "package.service"

    Source code(tar.gz)
    Source code(zip)
  • v1.50.1(Oct 21, 2022)

  • v1.50.0(Oct 12, 2022)

    New Features

    • okhttp: Added connection management features to okhttp server, including maxConnectionIdle(), permitKeepAliveTime(), and permitKeepAliveWithoutCalls() (#9494, #9544)
    • binder: Add SecurityPolicies for checking device owner/profile owner (#9428)

    API Changes

    • api: Add LoadBalancer.acceptResolvedAddresses() (#9498). The method is like handleResolvedAddresses() but returns a boolean of whether the addresses and configuration were accepted. Not accepting the update triggers the NameResolver to retry after a delay. We are not yet encouraging migration to this method, as there is still a second future API change
    • core: add CallOptions to CallCredentials.RequestInfo (#9538)

    Bug Fixes

    • auth: Fix AppEngine failing while retrieving access token when instantiating a blocking stub using AppEngineCredentials (#9504)
    • core: Ensure that context cancellationCause is set (#9501)
    • core: Update outlier detection max ejection logic to allow exceeding the limit by one, to match Envoy. (#9489, #9492)
    • core: outlier detection to honor min host request volume (#9490)
    • okhttp: Add timeout for HTTP CONNECT proxy handshake (#9586)
    • xds: ringhash policy in TRANSIENT_FAILURE should not attempt connecting when already in connecting (#9535). With workloads where most requests have the same hash, ring hash should behave more like pick-first of slowly trying backends

    Dependencies

    • netty: upgrade netty from 4.1.77.Final to 4.1.79.Final and tcnative from 2.0.53 to 2.0.54 (#9451)

    Acknowledgements

    @cpovirk @prateek-0 @sai-sunder-s

    Source code(tar.gz)
    Source code(zip)
  • v1.47.1(Oct 7, 2022)

    Bug Fixes

    • core: Fix retry causing memory leak for canceled RPCs. (#9416)

    Behavior Changes

    • xds: Remove permanent error handling in LDS update in XdsServerWrapper. Also notify OnNotServing on StatusListener when the delegated server initial start fails. (#9276, #9279)

    Dependencies

    • Bump protobuf to 3.19.6
    Source code(tar.gz)
    Source code(zip)
  • v1.46.1(Oct 7, 2022)

    Behavior Changes

    • xds: Remove permanent error handling in LDS update in XdsServerWrapper. Also notify OnNotServing on StatusListener when the delegated server initial start fails. (#9278, #9280)

    Dependencies

    • Bump protobuf to 3.19.6
    Source code(tar.gz)
    Source code(zip)
  • v1.45.2(Oct 7, 2022)

    Bug Fixes

    • xds: fix bugs in ring-hash load balancer picking subchannel behavior per gRFC. The bug may cause connection not failing over from TRANSIENT_FAILURE status. (#9085)
    • xds: Protect xdstp processing with federation env var. If the xds server uses xdstp:// resource names it was possible for federation code paths to be entered even without enabling the experimental federation support. This is now fixed and it is safe for xds servers to use xdstp:// resource names. (#9190)

    Behavior Changes

    • xds: change ring_hash LB aggregation rule to better handle transient_failure channel status (#9084)

    Dependencies

    • Bump protobuf to 3.19.6
    • bom: Exclude grpc-observability. The module does not exist in 1.45.x. Should be a noop (#9122)
    Source code(tar.gz)
    Source code(zip)
  • v1.44.2(Oct 7, 2022)

    Bug Fixes

    • netty: Fixed incompatibility with Netty 4.1.75.Final that caused COMPRESSION_ERROR (#9004)
    • xds: Fix LBs blindly propagating control plane errors (#9012). This change forces the use of UNAVAILABLE for any xDS communication failures, which otherwise could greatly confuse an application. This is essentially a continuation of the fix in 1.45.0 for XdsNameResolver, but for other similar cases
    • xds: Fix XdsNameResolver blindly propagates control plane errors (#8953). This change forces the use of UNAVAILABLE for any xDS communication failures, which otherwise could greatly confuse an application
    • xds: fix bugs in ring-hash load balancer picking subchannel behavior per gRFC. The bug may cause connection not failing over from TRANSIENT_FAILURE status. (#9085)

    Behavior Changes

    • xds: change ring_hash LB aggregation rule to better handle transient_failure channel status (#9084)

    Dependencies

    • Bump protobuf to 3.19.6
    Source code(tar.gz)
    Source code(zip)
  • v1.43.3(Oct 7, 2022)

    Bugfixes

    • android: fix for app coming to foreground #8850
    • xds: fix the validation code to accept new-style CertificateProviderPluginInstance wherever used

    Dependencies

    • Bump protobuf to 3.19.6
    Source code(tar.gz)
    Source code(zip)
  • v1.42.3(Oct 6, 2022)

  • v1.41.3(Oct 7, 2022)

  • v1.36.3(Oct 7, 2022)

  • v1.48.2(Oct 4, 2022)

    Bug Fixes

    • xds: Fix a bug in ring-hash load balancing policy that, during TRANSIENT_FAILURE state, it might cause unnecessary internal connection requests on subchannels. (https://github.com/grpc/grpc-java/pull/9537)
    • auth: Fix AppEngine failing while retrieving access token when instantiating a blocking stub using AppEngineCredentials (https://github.com/grpc/grpc-java/pull/9524)
    • xds: channel_id hash policy now uses a random per-channel id instead of an incrementing one. The incrementing id was the same for every process of a binary, which was not the intention (https://github.com/grpc/grpc-java/pull/9453)
    • bazel: Use valid target name for services and xds when overriding Maven targets (https://github.com/grpc/grpc-java/pull/9422). This fixes an error of the form no such target '@io_grpc_grpc_java//services:services' for services and missing ORCA classes for xds. The wrong target names were introduced in 1.47.0

    Dependencies

    • Bump protobuf to 3.21.7
    Source code(tar.gz)
    Source code(zip)
  • v1.49.2(Oct 4, 2022)

  • v1.49.1(Sep 21, 2022)

    Bug Fixes

    • xds: Fix a bug in ring-hash load balancing policy that, during TRANSIENT_FAILURE state, it might cause unnecessary internal connection requests on subchannels. (#9537)
    • auth: Fix AppEngine failing while retrieving access token when instantiating a blocking stub using AppEngineCredentials (#9524)

    Behavior Changes

    • core: Update outlier detection max ejection logics, and min host request volume logics. (https://github.com/grpc/grpc-java/pull/9550, #9551, #9552)
    Source code(tar.gz)
    Source code(zip)
  • v1.49.0(Aug 24, 2022)

    New Features

    • okhttp: Add OkHttpServerBuilder. The server can be used directly, but is not yet available via ServerBuilder.forPort() and Grpc.newServerBuilderForPort(). It passes our tests, but has seen no real-world use. It is also lacking connection management features
    • okhttp: Add support for byte-based private keys via TlsChannelCredentials and TlsServerCredentials
    • core: New outlier detection load balancer
    • googleapis: google-c2p resolver is now stabilized

    Bug Fixes

    • core: Fix retry causing memory leak for canceled RPCs. (#9360)
    • core: Use SyncContext for InProcess transport callbacks to avoid deadlocks. This fixes the long-standing issue #3084 which prevented using directExecutor() in some tests using streaming RPCs
    • core: Disable retries with in-process transport by default (#9361). In-process does not compute message sizes so can retain excessive amounts of memory
    • bazel: Use valid target name for services and xds when overriding Maven targets (#9422). This fixes an error of the form no such target '@io_grpc_grpc_java//services:services' for services and missing ORCA classes for xds. The wrong target names were introduced in 1.47.0
    • xds: channel_id hash policy now uses a random per-channel id instead of an incrementing one. The incrementing id was the same for every process of a binary, which was not the intention (#9453)
    • core: Fix a bug that the server stream should not deliver halfClose() when the call is immediately canceled. The bug causes a bad message INTERNAL, desc: Half-closed without a request at server call. (#9362)
    • xds: Remove shaded orca proto dependency in ORCA api. The shading was broken and couldn't really be used. (#9366)

    Behavior Changes

    • gcp-observability: Interceptors are now injected in more situations, including for non-Netty transports and when using transport-specific APIs like NettyChannelBuilder. (#9309 #9312 #9424)
    • gcp-observability: custom tags now extended to metrics and traces (#9402 #9407)
    • gcp-observability: excludes RPCs into Google Cloud Ops backend for instrumentation (#9436)
    • xds: xdsNameResolver now matches channel overrideAuthority in virtualHost matching (#9405)

    Acknowledgement

    @benjaminp @j-min5u

    Source code(tar.gz)
    Source code(zip)
  • v1.48.1(Aug 2, 2022)

    New Features

    ORCA provides APIs to inject custom metrics at a gRPC server, and consume them at a gRPC client. It implements A51: Custom Backend Metrics Support. We changed the ORCA APIs; they had broken shading and couldn't really be used, so we fixed them in the patch release.

    Bug Fixes

    • core: Fix a bug that the server stream should not deliver halfClose() when the call is immediately canceled. The bug causes a bad message INTERNAL, desc: Half-closed without a request at server call. (#9362)
    • core: Fix retry causing memory leak for cancelled RPCs. (#9415)
    • core: Disable retry by default for in-process transport's channel.(#9368)
    Source code(tar.gz)
    Source code(zip)
  • v1.48.0(Jul 21, 2022)

    Bug Fixes

    • Removed the Class-Path manifest entry from jars generated with the gradle shadow plugin (#9270). This should prevent “[WARNING] [path] bad path element” compilation warnings
    • Fix Channelz HTTP/2 window reporting. Previously the sender and receiver windows were reversed
    • Service config parse failures should be UNAVAILABLE, not INVALID_ARGUMENT (#9346). This bug could cause RPCs to fail with INVALID_ARGUMENT if the service config was invalid when the channel started. RPCs were not failed if the channel had previously received no config or a valid config. Channels using xds were not exposed to this issue

    New Features

    • xds: implement ignore_resource_deletion server feature as defined in the gRFC A53: Option for Ignoring xDS Resource Deletion. (#9339)
    • bazel: Support maven_install's strict_visibility=True by including direct dependencies explicitly

    Improvements

    • Changed the debug strings for many Attributes.Keys to reference the API of the key. This should make it easier to find the API the key is exposed when using attributes.toString()
    • api: Document Attributes.Key uses reference equality. This is to make it clear the behavior is on purpose, and mirrors other Key types in the API
    • api: Explain security constraints of EquivalentAddressGroup.ATTR_AUTHORITY_OVERRIDE, to avoid misuse by NameResolvers (#9281)
    • testing: GrpcCleanupRule now extends ExternalResource. This makes it usable with JUnit 5
    • core: Clear ConfigSelector when the channel enters panic mode (#9272). This prevents hanging RPCs if panic mode is entered very early in the channel lifetime and makes panic mode more predictable when xds is in use. Panic mode is a Channel feature used when a bug causes an unrecoverable error
    • core: Avoid unnecessary flushes for unary responses. It optimizes the response flow (#9273)
    • core: Use the offload executor in CallCredentials rather than the executor from CallOptions (#9313)
    • compiler: support protoc compiling on loongarch_64 and ppc64le platform (#9178 #9284)
    • binder: Add security Policy for verifying signature using sha-256 hash (#9305)
    • xds: clusterresolver reuses child policy names for the same locality to avoid subchannel connection churns (#9287)
    • xds: Fail RPCs with error details when resources are deleted instead of “NameResolver returned no usable address errors” (#9337)
    • xds: Support least_request LB in LoadBalancingPolicy (#9262)
    • xds: weighted target to delay picker updates while updating children (#9306)
    • xds: delete the permanent error logic in processing LDS updates in XdsServerWrapper (#9268)
    • xds: when delegate server throws on start communicate the error to statusListener (#9277)

    Dependencies

    • Bump Guava to 31.1
    • Bump protobuf to 3.21.1 (#9311)
    • Bump Error Prone annotations to 2.14.0
    • Bump Animal Sniffer annotations to 1.21
    • Bump Netty to 4.1.77.Final and netty_tcnative to 2.0.53.Final
    • protobuf: Bump com.google.api.grpc:proto-google-common-protos to 2.9.0
    • alts: Bump Conscrypt to 2.5.2
    • xds: Bump RE2J to 1.6
    • xds: Remove unused org.bouncycastle:bcpkix-jdk15on dependency
    • xds: Update xDS protos (#9223)

    Acknowledgements

    @mirlord @zhangwenlong8911 @adilansari @amirhadadi @jader-eero @jvolkman @sumitd2

    Source code(tar.gz)
    Source code(zip)
  • v1.47.0(Jun 2, 2022)

    Bug Fixes

    • api: Ignore ClassCastExceptions for hard-coded providers on Android (#9174). This avoids ServiceConfigurationError in certain cases when an “SDK” includes a copy of gRPC that was renamed with Proguard-like tools that do precise class name rewriting (versus something like Maven Shade Plugin which uses coarse pattern matching)
    • binder: respect requested message limits when provide received messages to listener (#9163)
    • binder: Avoid an ISE from asAndroidAppUri() (#9169)
    • okhttp: Use the user-provided ScheduledExecutorService for keepalive if provided. Previously the user-provided executor was used for deadlines, but not keepalive. Keepalive always used the default executor (#9073)
    • bom: Reverted “bom: Removed protoc-gen-grpc-java from the BOM” in v1.46.0. There was a way to use it with Gradle (#9154)
    • build: fix grpc-java build against protobuf 3.21 (#9218)
    • grpclb: Adds missing META-INF resources to libgrpclb.jar produced by bazel //grpclb:grpclb target (#9156)
    • xds: Protect xdstp processing with federation env var. If the xds server uses xdstp:// resource names it was possible for federation code paths to be entered even without enabling the experimental federation support. This is now fixed and it is safe for xds servers to use xdstp:// resource names. (#9190)
    • xds: fix bugs in ring-hash load balancer picking subchannel behavior per gRFC. The bug may cause connection not failing over from TRANSIENT_FAILURE status. (#9085)
    • xds: NACK EDS resources with duplicate localities in the same priority (#9119)

    New Features

    • api: Add connection management APIs to ServerBuilder (#9176). This includes methods for keepalive, max connection age, and max connection idle. These APIs have been available on NettyServerBuilder since v1.4.0
    • api: allow NameResolver to influence which transport to use (#9076)
    • api: New API in ServerCall to expose SecurityLevel on server-side (#8943)
    • netty: Add NameResolver for unix: scheme, as defined in gRPC Name Resolution (#9113)
    • binder: add allOf security policy, which allows access iff ALL given security policies allow access. (#9125)
    • binder: add anyOf security policy, which allows access if ANY given security policy allows access. (#9147)
    • binder: add hasPermissions security policy, which checks that a caller has all of the given package permissions. (#9117)
    • build: Add Bazel build support for xds, googleapis, rls, and services. grpc-services previously had partial bazel support, but some parts were missing. These artifacts are now configured via IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS so maven_install will not use the artifacts from Maven Central (#9172)
    • xds: New ability to configure custom load balancer implementations via the xDS Cluster.load_balancing_policy field. This implements gRFC A52: gRPC xDS Custom Load Balancer Configuration. (#9141)
    • xds, orca: add support for custom backend metrics reporting: allow setting metrics at gRPC server and consuming metrics reports from a custom load balancing policy at the client. This implements gRFC A51: Custom Backend Metrics Support.
    • xds: include node ID in RPC failure status messages from the XdsClient (#9099)
    • xds: support for the is_optional logic in Cluster Specifier Plugins: if an unsupported Cluster Specifier Plugin is optional, don't NACK, and skip any routes that point to it. (#9168)

    Behavior Changes

    • xds: Allow unspecified listener traffic direction, to match other languages and to work with Istio (#9173)
    • xds: change priority load balancer failover time behavior and ring_hash LB aggregation rule to better handle transient_failure channel status (#9084, #9093)

    Dependencies

    • Bump GSON to 2.9.0. Earlier versions of GSON are affected by CVE-2022-25647. gRPC was not impacted by the vulnerability. (#9215)
    • gcp-observability: add grpc-census as a dependency and update opencensus version (#9140)

    Acknowledgements

    @caseyduquettesc @cfredri4 @jvolkman @mirlord @ovidiutirla

    Source code(tar.gz)
    Source code(zip)
  • v1.46.0(Apr 28, 2022)

    Bug Fixes

    • netty: Fixed incompatibility with Netty 4.1.75.Final that caused COMPRESSION_ERROR (#9004)
    • xds: Fix LBs blindly propagating control plane errors (#9012). This change forces the use of UNAVAILABLE for any xDS communication failures, which otherwise could greatly confuse an application. This is essentially a continuation of the fix in 1.45.0 for XdsNameResolver, but for other similar cases
    • xds: Fix ring_hash reconnecting behavior. Previously a TRANSIENT_FAILURE subchannel would remain failed forever
    • xds: Fix ring_hash defeating priority’s failover connection timeout. grpc/proposal#296
    • binder: Work around an Android Intent bug for consistent AndroidComponentAndress hashCode() and equals() (#9061)
    • binder: Fix deadlock when using process-local Binder (#8987). Process-local binder has a different threading model than normal FLAG_ONEWAY, so this case is now detected and the FLAG_ONEWAY threading model is emulated
    • okhttp: Removed dead code in io.grpc.okhttp.internal.Util. This should have no impact except for static code analysis. This code was never used and was from the process of forking okhttp. It calculated things like MD5 which can trigger security scanners (#9071)

    Behavior Changes

    • java_grpc_library.bzl: Pass use_default_shell_env = True for protoc (#8984). This allows using MinGW on Windows
    • xds: Unconditionally apply backoff on ADS and LDS stream recreation. Previously if a message had been received on the stream no backoff wait would be performed. This limits QPS to a buggy server to 1 QPS, instead of a closed loop
    • xds: Skip Routes within VirtualHosts whose RouteAction has no cluster_specifier. This probably means the control plane is using a cluster_specifier field unknown/unsupported by gRPC. The control plane can repeat the Route with a different cluster_specifier for compatibility with older clients
    • xds: Support xds.config.resource-in-sotw client capability. Resources wrapped in a io.envoyproxy.envoy.service.discovery.v3.Resource message are now supported (#8997)

    New Features

    • gcp-observability: A new experimental module for improving visibility into gRPC workloads. Initially supports logging RPCs to Google Cloud Logging
    • grpclb: Support setting initial fallback timeout by service config (#8980)

    Dependencies

    • PerfMark bumped to 0.25.0 (#8948)
    • okhttp: the okhttp dependency is now compile only (#8971). Okhttp’s internal HTTP/2 implementation was forked inside grpc-okhttp a long time ago, but there had been a few stray internal classes that had not been forked but should have been. That has now been fixed in preparation for OkHttp 3/4 support. Compile-only may cause a runtime failure for code using reflection on OkHttpChannelBuilder; add a dependency on okhttp 2.7.4 to resolve
    • bom: Removed protoc-gen-grpc-java from the BOM, as the classifier was confusing and it provided no value (#9020)

    Acknowledgements

    @jesseschalken @kluever @beatrausch

    Source code(tar.gz)
    Source code(zip)
  • v1.45.1(Mar 30, 2022)

    Bug Fixes

    • netty: Fixed incompatibility with Netty 4.1.75.Final that caused COMPRESSION_ERROR (#9004)
    • xds: Fix LBs blindly propagating control plane errors (#9012). This change forces the use of UNAVAILABLE for any xDS communication failures, which otherwise could greatly confuse an application. This is essentially a continuation of the fix in 1.45.0 for XdsNameResolver, but for other similar cases
    Source code(tar.gz)
    Source code(zip)
  • v1.45.0(Mar 8, 2022)

    gRPC Java 1.45.0 Release Notes

    Bug Fixes

    • rls: fix child lb leak when client channel is shutdown (#8750)
    • rls: fix RLS lb policy name (#8867)
    • testing: fix GrpcCleanupRule issue when retrying tests (#8918)
    • xds: Fix XdsNameResolver blindly propagates control plane errors (#8953). This change forces the use of UNAVAILABLE for any xDS communication failures, which otherwise could greatly confuse an application
    • xds: fix validation code to accept new-style CertificateProviderPluginInstance (#8892)
    • xds: fix a concurrency issue in CSDS ClientStatus responses (#8795)
    • xds: Squelch "Failed to resolve name" ADS reconnection error logs. Workaround for #8886 (#8942)
    • xds: Improve priority failover handling for IDLE subpolicies (#8926). This mainly improves behavior with ring_hash
    • bom: Include grpc-binder
    • binder: Fix a ServiceConnection leak (#8861)
    • binder: Increase fairness across streams when limited by flow control. This can dramatically reduce latency when channel is being used for high throughput (#8835)
    • android: fix for app coming to foreground (#8855)

    Behavior Changes

    • Local-only transparent retry is (practically) unlimited now. Previously it was at most once per RPC.
    • xds: implement least_request load balancing policy (#8739)

    Dependencies

    • Bump Error Prone Annotations to 2.10.0
    • Bump Guava to 31.0.1-android
    • Bump Google Auth Library to 1.4.0
    • Bump Auto Value to 1.9
    • netty: Include both x86 and Arm64 epoll as dependency for grpc-netty-shaded
    • testing: remove opencensus dependency from grpc-testing (#8833)
    Source code(tar.gz)
    Source code(zip)
  • v1.44.1(Feb 18, 2022)

    Bug Fixes

    • xds: fix the validation code to accept new-style CertificateProviderPluginInstance wherever used (#8901 fixes #8885)
    • binder: Fix a ServiceConnection leak (#8861 closes #8726)
    • android: fix for app coming to foreground (#8904 closes #8850)
    Source code(tar.gz)
    Source code(zip)
  • v1.44.0(Jan 27, 2022)

    gRPC Java 1.44.0 Release Notes

    Java 7 is no longer supported. This release uses Java 8 bytecode, except for grpc-context which remains on Java 7 bytecode. Users requiring Java 7 are encouraged to use the v1.41.x branch. See gRFC P5. Android support remains API level 19+. If this is expected to cause undue hardship or community issues, please contact us via a GitHub issue or [email protected].

    Java 8 users pay note: per gRFC P5, gRPC may drop Java 8 support as soon as March this year. If this is expected to cause undue hardship or community issues, please contact us via a GitHub issue or [email protected].

    API Changes

    • Removed deprecated StreamInfo.transportAttrs (#8768)

    Bug Fixes

    • core: fix a race condition when calling ManagedChannel#enterIdle() (#8761)
    • xds: rename ring_hash LB Policy to ring_hash_experimental to comply with gRPC A42: xDS Ring Hash LB Policy (#8776)

    Behavior Changes

    • Binder: Enclose all operations in BinderTransport even when an exception was thrown. (#8733)*
    • Binder: Fix a bug that might cause memory leaks in binder. (#8728)

    Dependencies

    • Upgraded Protobuf to 3.19.2 to avoid CVE-2021-22569. See the protobuf advisory
    • Bump GSON to 2.8.9 (#8759)
    • Bump Netty to 4.1.72.Final and tcnative to 2.0.46.Final (#8780)

    Acknowledgement

    • groakley@
    • apolcyn@
    • beatrausch@
    • danielnorberg@
    • jdcormie@
    Source code(tar.gz)
    Source code(zip)
  • v1.43.2(Jan 6, 2022)

  • v1.42.2(Jan 6, 2022)

    Bug Fixes

    • census: fixed a bug which in rare cases, a NullPointerException may be thrown by recordFinishedAttempt(). Users not enabling grpc-census are not impacted by this bug (#8706)
    • core: fix a race condition when calling ManagedChannel.enterIdle() (#8746)

    Dependencies

    • Upgraded Protobuf to 3.18.2 to avoid CVE-2021-22569. See the protobuf advisory
    • Upgraded Guava to 30.1.1-android
    Source code(tar.gz)
    Source code(zip)
  • v1.41.2(Jan 7, 2022)

    Bug Fixes

    • core: fix a race condition when calling ManagedChannel.enterIdle() (#8763)
    • xds: stop generating UUIDs for filter chains that lack them. The UUID was preventing the XdsServer from noticing when a control plane sent a needless duplicate update, causing XdsServer to drain all its existing connections to use the “new” configuration #8736

    Dependencies

    • Upgraded Protobuf to 3.18.2 to avoid CVE-2021-22569. See the protobuf advisory
    • Upgraded Guava to 30.1.1-android
    Source code(tar.gz)
    Source code(zip)
  • v1.43.1(Dec 21, 2021)

  • v1.43.0(Dec 15, 2021)

    API Changes

    • alts: Make GoogleDefaultChannelCredentials take a CallCredentials (#8548)
    • binder: Support BinderChannelBuilder.forTarget (#8633)
    • inprocess: Add support for anonymous in-process servers (#8589)

    Bug Fixes

    • census: fixed a bug which in rare cases, a NullPointerException may be thrown by recordFinishedAttempt(). Users not enabling grpc-census are not impacted by this bug (#8706)
    • xds: stop generating UUIDs for filter chains that lack them. The UUID was preventing the XdsServer from noticing when a control plane sent a needless duplicate update, causing XdsServer to drain all its existing connections to use the “new” configuration #8663
    • xds: fix a bug where XdsServer didn’t block start() when configuration is missing, and instead errored. #8660

    New Features

    • protoc-gen-grpc-java plugin support for Apple M1 architecture (#7690)
    • okhttp: introduced new TLS1.2 cipher suites and internal okhttp implementation for TLS1.3 prepared (#8650)
    • netty: Add ability to set system property -Dio.grpc.netty.disableConnectionHeaderCheck=false to disable HTTP Connection header check. This is a temporary workaround to allow fixing out-of-spec HTTP/2 clients (#8683)

    Dependencies

    • bump guava to 30.1.1-android (#8748)
    • bump protobuf to 3.19.1 (#8748)

    Acknowledgement

    @beatrausch @benjaminp Benjamin Peterson @cfredri4 @kdubb Kevin Wooten

    Source code(tar.gz)
    Source code(zip)
Owner
grpc
A high performance, open source, general-purpose RPC framework
grpc
SCG used as as proxy to connect gRPC-Web and back end gRPC services

gRPC-Web Spring Cloud Gateway Spring Cloud Gateway 3.1.1 supports for gRPC and HTTP/2. It is possible to use Spring Cloud Gateway to connect gRPC-Web

null 1 Apr 4, 2022
Apache Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation

Apache Thrift Introduction Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation. Thrift provides clean a

The Apache Software Foundation 9.5k Jan 4, 2023
Apache Dubbo is a high-performance, java based, open source RPC framework.

Apache Dubbo Project Apache Dubbo is a high-performance, Java-based open-source RPC framework. Please visit official site for quick start and document

The Apache Software Foundation 38.2k Dec 31, 2022
LINE 4.1k Dec 31, 2022
Reactive stubs for gRPC

What is reactive-grpc? Reactive gRPC is a suite of libraries for using gRPC with Reactive Streams programming libraries. Using a protocol buffers comp

Salesforce 758 Dec 22, 2022
Book Finder application is a client-server application (gRPC) for educational purposes.

Book-Finder Book Finder application is a client-server application (gRPC) for educational purposes. Instalation These projects (Client/Server) are Mav

Mihai-Lucian Rîtan 21 Oct 27, 2022
gRPC Facade for Transactional Keyvalue Stores

lionrock An implementation agnostic client/server communication protocol (using protobuf and grpc) inspired heavily by FoundationDB (https://github.co

Clement Pang 23 Dec 8, 2022
CustomRPC - a tool that allows you to change your discord rich presence (RPC) to a custom one

CustomRPC is a tool that allows you to change your discord rich presence (RPC) to a custom one. It also allows creating sentence sequences

null 2 May 3, 2022
A Java event based WebSocket and HTTP server

Webbit - A Java event based WebSocket and HTTP server Getting it Prebuilt JARs are available from the central Maven repository or the Sonatype Maven r

null 808 Dec 23, 2022
Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

AsyncHttpClient 6k Dec 31, 2022
HTTP Server Model made in java

SimplyJServer HTTP Server Model made in java Features Fast : SimplyJServer is 40%-60% faster than Apache, due to it's simplicity. Simple to implement

Praudyogikee for Advanced Technology 2 Sep 25, 2021
Square’s meticulous HTTP client for the JVM, Android, and GraalVM.

OkHttp See the project website for documentation and APIs. HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP

Square 43.4k Jan 9, 2023
Magician is an asynchronous non-blocking network protocol analysis package, supports TCP, UDP protocol, built-in Http, WebSocket decoder

An asynchronous non-blocking network protocol analysis package Project Description Magician is an asynchronous non-blocking network protocol analysis

贝克街的天才 103 Nov 30, 2022
Standalone Play WS, an async HTTP client with fluent API

Play WS Standalone Play WS is a powerful HTTP Client library, originally developed by the Play team for use with Play Framework. It uses AsyncHttpClie

Play Framework 213 Dec 15, 2022
Socket.IO Client Implementation in Java

Socket.IO-Client for Java socket.io-java-client is an easy to use implementation of socket.io for Java. It uses Weberknecht as transport backend, but

Enno Boland 946 Dec 21, 2022
A barebones WebSocket client and server implementation written in 100% Java.

Java WebSockets This repository contains a barebones WebSocket server and client implementation written in 100% Java. The underlying classes are imple

Nathan Rajlich 9.5k Dec 30, 2022
Nifty is an implementation of Thrift clients and servers on Netty

his project is archived and no longer maintained. At the time of archiving, open issues and pull requests were clo

Meta Archive 902 Sep 9, 2022
TCP/UDP client/server library for Java, based on Kryo

KryoNet can be downloaded on the releases page. Please use the KryoNet discussion group for support. Overview KryoNet is a Java library that provides

Esoteric Software 1.7k Jan 2, 2023