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.
Issues
  • Fix memeory leak in MessageFramer

    Fix memeory leak in MessageFramer

    Fixes

    https://github.com/grpc/grpc-java/issues/336

    opened by louiscryan 40
  • 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
  • Shade Netty transport

    Shade Netty transport

    The entire transport is shaded because we wouldn't want to collide with the unshaded form of grpc-netty.

    Type: Feature 
    opened by ejona86 36
  • 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
  • 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
  • {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
  • 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
  • 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
  • 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
  • How can the gRPC client create socket connect When create stub or channel

    How can the gRPC client create socket connect When create stub or channel

    I want create socket connectoin when create stub or channel
    version: 1.43.2 demo:

           NettyChannelBuilder builder = (NettyChannelBuilder)((NettyChannelBuilder)NettyChannelBuilder.forAddress("xxxx",1234).usePlaintext().
                            keepAliveWithoutCalls(true).directExecutor();
            ManagedChannel ch = builder.build();
            //==> I want to create scoket connect here or channel build 
            ServiceGrpc.ServiceBlockingStub stub = ServiceGrpc.newBlockingStub(ch).withWaitForReady();        
            //===> I test gRPC will create connect in call some method
            stub.grpcPing(request.newBuilder().build());
    
    question 
    opened by zt9788 0
  • Update ensureAlpnAndH2Enabled to reflect NPN protocol

    Update ensureAlpnAndH2Enabled to reflect NPN protocol

    Currently #ensureAlpnAndH2Enabled is functionally correct, but the method name and error messages make it look like only ALPN is allowed by this method and it doesn't allow NPN protocol, which is not the case. This method likely wasn't updated when NPN was added in addition to NPN and now the naming and the error messages are misleading for the reader.

    This PR updates the method name and error messages to reflect that there are currently two Protocol Negotiators

    opened by Spikhalskiy 0
  • Some question about UNKNOWN StatusRuntimeException

    Some question about UNKNOWN StatusRuntimeException

    stack info.

    io.grpc.StatusRuntimeException: UNKNOWN
            at io.grpc.Status.asRuntimeException(Status.java:533)
            at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:442)
            at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
            at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
            at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
            at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:700)
            at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
            at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
            at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
            at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:399)
            at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:510)
            at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:66)
            at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:630)
            at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:518)
            at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:692)
            at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:681)
            at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
            at io.grpc.internal.SerializeReentrantCallsDirectExecutor.execute(SerializeReentrantCallsDirectExecutor.java:49)
            at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.closedInternal(ClientCallImpl.java:696)
            at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.closed(ClientCallImpl.java:646)
            at io.grpc.internal.ForwardingClientStreamListener.closed(ForwardingClientStreamListener.java:39)
            at io.grpc.internal.InternalSubchannel$CallTracingTransport$1$1.closed(InternalSubchannel.java:658)
            at io.grpc.internal.AbstractClientStream$TransportState.closeListener(AbstractClientStream.java:471)
            at io.grpc.internal.AbstractClientStream$TransportState.access$400(AbstractClientStream.java:233)
            at io.grpc.internal.AbstractClientStream$TransportState$1.run(AbstractClientStream.java:454)
            at io.grpc.internal.AbstractClientStream$TransportState.deframerClosed(AbstractClientStream.java:290)
            at io.grpc.internal.Http2ClientStreamTransportState.deframerClosed(Http2ClientStreamTransportState.java:31)
            at io.grpc.internal.MessageDeframer.close(MessageDeframer.java:229)
            at io.grpc.internal.MessageDeframer.closeWhenComplete(MessageDeframer.java:191)
            at io.grpc.internal.AbstractStream$TransportState.closeDeframer(AbstractStream.java:183)
            at io.grpc.internal.AbstractClientStream$TransportState.transportReportStatus(AbstractClientStream.java:457)
            at io.grpc.internal.AbstractClientStream$TransportState.transportReportStatus(AbstractClientStream.java:413)
            at io.grpc.internal.AbstractClientStream$TransportState.inboundTrailersReceived(AbstractClientStream.java:396)
            at io.grpc.internal.Http2ClientStreamTransportState.transportTrailersReceived(Http2ClientStreamTransportState.java:177)
            at io.grpc.netty.shaded.io.grpc.netty.NettyClientStream$TransportState.transportHeadersReceived(NettyClientStream.java:373)
            at io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler.onHeadersRead(NettyClientHandler.java:361)
            at io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler.access$1200(NettyClientHandler.java:89)
            at io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler$FrameListener.onHeadersRead(NettyClientHandler.java:855)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:373)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onHeadersRead(Http2InboundFrameLogger.java:65)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader$1.processFragment(DefaultHttp2FrameReader.java:457)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader.readHeadersFrame(DefaultHttp2FrameReader.java:464)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:254)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:160)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:174)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:378)
            at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:438)
            at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:505)
            at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:444)
            at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:283)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
            at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1421)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
            at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
            at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
            at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:794)
            at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:424)
            at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:326)
            at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
            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.lang.Thread.run(Thread.java:748)
    

    Hi, I used grpc to communicate between server and server. But I found that exception 'UNKNOWN' occur when server qps is largest.

    So I traced that why this error happen.
    I found that the status from trailers is Status.UNKNOWN. The io.grpc.Metadata namesAndValues showed that

    @ArrayList[
        @byte[][
            @Byte[58],
            @Byte[115],
            @Byte[116],
            @Byte[97],
            @Byte[116],
            @Byte[117],
            @Byte[115],    
            ],
        @byte[][
            @Byte[50],
            @Byte[48],
            @Byte[48],
        ],
        @byte[][
            @Byte[99],
            @Byte[111],
            @Byte[110],
            @Byte[116],
            @Byte[101],
            @Byte[110],
            @Byte[116],
            @Byte[45],
            @Byte[116],
            @Byte[121],
            @Byte[112],
            @Byte[101],
        ],
        @byte[][
            @Byte[97],        
            @Byte[112],
            @Byte[112],
            @Byte[108],
            @Byte[105],
            @Byte[99],        
            @Byte[97],
            @Byte[116],
            @Byte[105],
            @Byte[111],
            @Byte[110],
            @Byte[47],
            @Byte[103],
            @Byte[114],
            @Byte[112],
            @Byte[99],
        ],
        @byte[][
            @Byte[103],
            @Byte[114],
            @Byte[112],
            @Byte[99],
            @Byte[45],
            @Byte[115],
            @Byte[116],
            @Byte[97],
            @Byte[116],
            @Byte[117],
            @Byte[115],
        ],
        @byte[][
            @Byte[50],
        ],
    ]
    

    The Status.CODE_KEY ascii is [103,114,112,99,45,115,116,97,116,117,115], the value is [50]. not [48](Status.SUCCESS).

    I want to know the cause of the problem And how to solve it. @ejona86 eric, could you give some advice?

    question 
    opened by horizonzy 4
  • Fix RLS config child lb config validation

    Fix RLS config child lb config validation

    As per the spec go/grpc-rls-lb-policy-design

    At config-validation time, we must construct and validate the config for the child policy, but we don't yet know the target name to use for it. The config for the child policy will be constructed by starting with the static config from the childPolicy field, adding the field name specified in childPolicyConfigTargetFieldName, and setting the value of that field to some dummy string.

    enhancement 
    opened by dapengzhang0 0
  • Drop Java 7 support

    Drop Java 7 support

    Oracle's Premier Support for Java 7 ended in July 2019. Per gRFC P5, dropping support for the only release. Android is able to desugar many Java 8 language features.

    Context left on Java 7 just to be super-conservative.

    Draft PR because the gRFC has not yet merged (giving a bit more time for people to comment).

    opened by ejona86 0
  • rpc method name to  java.lang.Method name mapping

    rpc method name to java.lang.Method name mapping

    Is your feature request related to a problem?

    Currently it's impossible to dynamically map generated grpc java.lang.Method name to original rpc method name defined in proto file : rpc my_method() is generated as myMethod()

    Describe the solution you'd like

    Either provide API to map from/to rpc method name to/from java.lang.Method name or annotate the generated method with something like

    class StubImplBase{
    @OriginalRpcMethodName("my_method")
    public void myMethod(Request,Response){
    }
    }
    
    enhancement 
    opened by jvmlet 4
  • FIx the android-interop-testing/src/main/res/layout/activity_tester.xml file to get rid of linter messages

    FIx the android-interop-testing/src/main/res/layout/activity_tester.xml file to get rid of linter messages

    PR #8821 addresses the android linter issue (seen internally in Google3 builds) by adding the tools:ignore="OnClick" property to the elements. However this might not be correct and the issue could be the line 5

        tools:context=".MainActivity"
    

    This may need to be changed in order to run properly in Google3 as suggested by @ejona86

    opened by sanjaypujare 0
  • Android lint error when upgrade to Android plugin 4.x

    Android lint error when upgrade to Android plugin 4.x

    Trying to upgrade Android plugin to 4.x as described in https://github.com/grpc/grpc-java/issues/8421#issue-973899271 with some minor workarounds, the build failed with a lint error:

    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':grpc-android-interop-testing:lint'.
    > Lint found errors in the project; aborting build.
      
      Fix the issues identified by lint, or add the following to your build script to proceed with errors:
      ...
      android {
          lintOptions {
              abortOnError false
          }
      }
      ...
      Errors found:
      
      /Users/zdapeng/git/grpc-java/android-interop-testing/src/main/AndroidManifest.xml:23: Error: Class referenced in the manifest, io.grpc.binder.HostServices$HostService1, was not found in the project or the libraries [MissingClass]
              <service android:name="io.grpc.binder.HostServices$HostService1"/>
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /Users/zdapeng/git/grpc-java/android-interop-testing/src/main/AndroidManifest.xml:24: Error: Class referenced in the manifest, io.grpc.binder.HostServices$HostService2, was not found in the project or the libraries [MissingClass]
              <service android:name="io.grpc.binder.HostServices$HostService2"/>
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    opened by dapengzhang0 3
Releases(v1.41.2)
  • 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.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.43.2(Jan 6, 2022)

  • 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)
  • v1.42.1(Nov 15, 2021)

    Bug fixes:

    • xds: fix a bug that invalid resources from the control plane was internally classified as missing configuration, but instead it should be classified as a transient error. This will change load balancing states on failure handling behavior: for example, missing LDS at xDS server would make it enter “not serving” mode but a transient error does not affect serving status. #8690
    • xds: fix a bug where XdsServer didn’t block start() when configuration is missing, and instead errored. #8690
    • 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 #8688

    New feature:

    • 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
    • compiler: Protoc plugin for macOS x86 is duplicated to be used on the aarch architecture, to ease use on arm64 macs. The plugin is not actually ARM64, just named as such. Future work will need to compile it appropriately #8680
    Source code(tar.gz)
    Source code(zip)
  • v1.40.2(Nov 8, 2021)

    grpclb: Fix “IllegalStateException: already in fallback” channel panic, by not starting fallback timer if already in fallback (#8646). This builds on the fix in 1.38.1. The bug was introduced in 1.38.0.

    Source code(tar.gz)
    Source code(zip)
  • v1.42.0(Nov 5, 2021)

    In this release we drop support for Android API level 18 or lower (Jelly Bean or earlier), following Google Play Service’s discontinued updates for Jelly Bean (API levels 16, 17 & 18).

    API Changes

    • xds: Added XdsServerBuilder.overrideBootstrapForTest() to provide bootstrap override for testing purposes. This way, the test does not need to use the shared environment variable for bootstrap injection. (#8575)
    • api: Stabilize the Status.asException(Metadata) method. (#8520)
    • core/auth: Remove CallCredentials2 (#8572). CallCredentials2 was introduced in 1.16.0 to ease migration of CallCredentials to an abstract class. CallCredentials has been preferred over CallCredentials2 since 1.19.0

    Bug Fixes

    • netty: Requests with Connection header are malformed. This is required per HTTP/2. The server now rejects such requests. To improve debuggability for clients, Metadata.Key will log if creating a key for “Connection”
    • grpclb: Fix “IllegalStateException: already in fallback” channel panic, by not starting fallback timer if already in fallback (#8646). This builds on the fix in 1.38.1. The bug was introduced in 1.38.0.
    • core, netty, okhttp: Fix AbstractManagedChannelImplBuilder#maxInboundMessageSize(int) ABI (#8607). Solves the issue with NettyChannelBuilder.maxInboundMessageSize(int) and OkHttpChannelBuilder.maxInboundMessageSize(int) not working in rare cases when pre-1.33 builds combined with post-1.33. See issue #8313 for the details.

    New Features

    • binder: A new transport with channel and server builders which support cross-process and cross-application communication on Android. BinderChannel is production ready and in use by several Google applications, though the APIs are still experimental and subject to change. It does not currently support rpc-level flow control for streaming RPCs. See gRFC L73 for background.
    • xds: implemented rbac filter per A41 xDS RBAC. This is the first HTTP filter supported on server-side.
    • stub: add ServerCallStreamObserver.setOnCloseHandler(Runnable). Notified when gRPC has completed processing the RPC. (#8452)

    Behavior Changes

    • core: gRPC-Java library discards any Content-Length header set by the application because in most cases this header is blindly forwarded from some other source and is incorrect for gRPC payload.
    • netty: Use Host header on server-side if :authority is not present
    • rls: the cache_size in route lookup config is limited to 5M
    • core: changed the level mapping ChannelLogger uses for java.util.logging.Level (#8531). It is now possible to enable Java logging for Channelz’s INFO without also enabling DEBUG (previously they were both FINEST).

    Dependencies

    • Compatibility with the upcoming Bazel 5 added. This required dropping support for Bazel 1-3. Bazel 4 or later is required (#7598)
    • netty: bump netty to 4.1.63.Final and tcnative to 2.0.38.Final. (#8167)

    Improvements

    • core: io.grpc.util.AdvancedTlsX509KeyManager and AdvancedTlsX509TrustManager support loading configuration from static files. (#8525)
    • core: io.grpc.util.CertificateUtils.getPrivateKey() now supports RSA and EC key algorithms
    Source code(tar.gz)
    Source code(zip)
  • v1.41.1(Nov 5, 2021)

    Bug Fixes

    • grpclb: Fix “IllegalStateException: already in fallback” channel panic, by not starting fallback timer if already in fallback (#8646). This builds on the fix in 1.38.1. The bug was introduced in 1.38.0.
    Source code(tar.gz)
    Source code(zip)
  • v1.41.0(Sep 22, 2021)

    API Changes

    • stub: Mark Stub-based MetadataUtils methods deprecated (#8395). The interceptor-based versions have been stable for a long time and are preferred

    Bug Fixes

    • census: Fixed a data race in CensusStatsModule which in rare cases may cause NullPointerException (#8459)
    • xds: Fixed a bug in SharedCallCounterMap which in rare cases may cause NullPointerException (#8397)
    • core: ServerCall.isCancelled() and ServerCallStreamObserver.isCancelled() implementations no longer incorrectly return true at the end of every RPC (#8408)
    • core: ManagedChannel no longer immediately exits idle mode after an enterIdle() call when it has any calls in progress
    • netty-shaded: Modify the shading operation to transform native-image resources so they correctly reference shaded class names (#7540)
    • netty-shaded: Rename native-image resources to avoid collisions with Netty’s copy, which were modified starting in 1.39.0
    • rls: avoid NullPointerException in RLS in certain circumstances when calling channel.getState(true) or if a parent load balancer requests a connection (#8379)

    New Features

    • xds: xDS-based TLS security (gRFC 29) is now stable
    • util: Added new classes AdvancedTlsX509TrustManager and AdvancedTlsX509KeyManager, which support reloading keys and trust roots as they change. They also can make custom verification easier by handling the hostname verification. (#8175)
    • xds: Added XdsNameResolverProvider.createForTest() to allow using a different bootstrap configuration in tests (#8358)

    Behavior Changes

    • rls: migrated the deprecated server and path fields in RouteLookupRequest to using the new extra_keys field in RLS config

    Improvements

    • api: Document that NameResolvers shouldn’t block within their methods (#8398). The offload executor should be used for blocking operations
    • stub: Document StreamObserver is an async API, and how it internally may buffer (#8449)

    Dependencies

    • Upgraded error_prone_annotations to 2.9.0
    • cronet: Cronet upgraded to version 92.4515.131
    Source code(tar.gz)
    Source code(zip)
  • v1.40.1(Aug 31, 2021)

  • v1.40.0(Aug 17, 2021)

    API Changes

    • api: Removed deprecated method ClientStreamTracer.Factory.newClientStreamTracer(CallOptions callOptions, Metadata headers).
    • api: Deprecated ClientStreamTracer.StreamInfo.getTransportAttrs() and ClientStreamTracer.StreamInfo.Builder.setTransportAttrs().
    • api: Added new method ClientStreamTracer.streamCreated(Attributes transportAttrs, Metadata headers).
    • core: Stabilized ManagedChannelBuilder.enableRetry() and ManagedChannelBuilder.disableRetry().

    Bug Fixes

    • core: Fix a flow control issue if retry is enabled (#8401).
    • core: Fix a race between client call cancel() and start() if retry is enabled (#8386).
    • xds: Fix the race condition in SslContextProviderSupplier's updateSslContext and close (#8294).
    • xds: If “server_listener_resource_name_template” is not set or xds_v3 is not in use, log an error and fail XdsServer start() instead of NPE.
    • netty: The Netty server produces plain-text error messages for non-gRPC clients. The error pages’ Content-Type incorrectly had encoding=utf-8. It now has charset=utf-8.

    New Features

    • compiler: Added GrpcGenerated annotation with CLASS retention to the top-level generated class. This can be used by annotation processors to detect or ignore the generated code.
    • api: Added ServerCallExecutorSupplier experimental API. This allows for a per-service/method executor to handle the server call based on each RPC call information at runtime. (#8266).
    • xds: Added xDS retry support (gRFC-A44).

    Behavior Changes

    • core: The gRPC built-in retry feature is enabled by default. (Users can call ManagedChannelBuilder.disableRetry() to turn off retry if they do not want this feature, for example if they have already implemented an application level retry.) ManagedChannelBuilder.enableRetry() will no longer have the side that disables Census stats and tracing as in previous versions.

    Dependencies

    • xds: Envoy proto updated to commit 62ca8bd (#8346).

    Improvements

    • api: Clarify the ServerCallHandler API contract in Javadoc (#8339).
    • netty: Allow transparent retries for servers that lack graceful two-stage GOAWAY connection shutdown, such as nginx and gRPC C core. This refined a workaround introduced in 1.34.0 for a Netty header processing GOAWAY bug fixed in 4.1.54.Final, but that we are giving time for the fix to work its way through the ecosystem (#8359).
    • testing: Make more obvious in Javadoc that GrpcServerRule has been replaced.
    • api: Use <scheme,provider> map in nameResoverRegistry. This makes scheme matching more clear and explicit in name resolver API.(#8323).
    Source code(tar.gz)
    Source code(zip)
  • v1.39.0(Jun 30, 2021)

    API Changes

    • Static methods in Builders that always throw are now annotated @DoNotCall. This annotation can be noticed by ErrorProne and inform you of a mistake at compile time instead of runtime. This applies to static methods like InProcessServerBuilder.forPort(int) which are inherited from base classes like ServerBuilder/ManagedChannelBuilder yet are a bug if used.
    • api, core: Support zero copy into protobuf. New APIs have been added to support the custom implementation of a zero-copy Protobuf deserialization marshaller. The HasByteBuffer API exposes ByteBuffers underlying the InputStream being passed to the Marshaller and the Detachable API allows custom Marshaller to take over the ownership of buffers for performing delayed deserialization.
    • NettyChannelBuilder supports SocketAddress with ChannelCredentials.

    Bug Fixes

    • netty: Remove Maven pom.properties from netty-shaded jar. The properties don’t add much value and mainly confuse tools in a shaded jar.
    • netty-shaded: Modify the shading operation to transform native-image resources so they correctly reference shaded class names (#7540)
    • xds: Shut down the scheduledExecutorService in the CertificateProvider when it is shutdown.
    • xds: Close the SslContexrProviderSupplier when a CDS LoadBalancer is shut down to prevent leakage.
    • xds, grpclb: Use a standalone Context for control plane RPCs. The existing behavior of implicitly using the Context in ThreadLocal can cause control plane RPCs to be cancelled prematurely, in cases the data plane RPC is made within a gRPC service to another service. To avoid being impacted by data plane RPC lifecycle, the fix creates standalone Context for control plane RPCs.
    • xds: cluster_resolver LB policy should wait until all clusters are resolved before propagating endpoints to child LB policy. Previously, the cluster_resolver LB policy propagated partially resolved results (endpoints for a subset of clusters) to its child LB policy, which can cause RPCs to be sent to less favored clusters before endpoints of more favored clusters are discovered.
    • xds: use load assignment endpoint address in Cluster as the DNS hostname for LOGICAL_DNS. The LOGICAL_DNS concept was misunderstood previously. Instead of using the channel authority, the hostname should be given by Cluster resource in CDS responses.
    • grpclb: skip fallback if the LB is already in fallback mode. An invariant check for gRPCLB LB policy’s internal state introduced by #8035 is broken in case the LB policy is in fallback mode while receiving an address update without remote balancer addresses. The fix mitigated the temporal invariant violation.

    New Features

    • compiler: Add support for ppc64le on RHEL8.

    Dependencies

    • Protobuf upgraded to 3.17.2
    • We now use custom Gradle logic to determine if Maven’s requireUpperBoundDeps would fail for our published artifacts instead of Gradle’s failOnVersionConflict. This means we now make use of fewer dependency exclusions (#8238). failOnVersionConflict has similar behavior to dependencyConvergence but we previously lacked a more precise tool to detect cases where Maven would downgrade dependencies. We strongly encourage all Maven users to use Maven Enforcer’s requireUpperBoundDeps and continue to discourage using dependencyConvergence

    Acknowledgements

    @lepistone Leonardo Pistone @shirodkara Amit Shirodkar @cfredri4

    Source code(tar.gz)
    Source code(zip)
  • v1.38.1(Jun 18, 2021)

    Bug Fixes

    • grpclb: skip fallback if the LB is already in fallback mode. An invariant check for gRPCLB LB policy’s internal state introduced by #8035 is broken in case the LB policy is in fallback mode while receiving an address update without remote balancer addresses. It caused a channel panic (INTERNAL: Panic! This is a bug!) due to the exception IllegalStateException: already in fallback. The fix mitigated the temporal invariant violation.
    • xds: shut down the scheduledExecutorService in the CertificateProvider when it is shutdown
    Source code(tar.gz)
    Source code(zip)
  • v1.36.2(May 26, 2021)

    Bug Fixes

    • grpclb: fixed a day-one issue that the control plane RPC are using the same Context as the inbound application RPC, which can cause control plane RPC aborted when the inbound application RPC completes.
    • netty: Fixed a bug that client RPCs may fail with a wrong exception with message "Maximum active streams violated for this endpoint" when receiving GOAWAY while MAX_CONCURRENT_STREAMS is reached. After the fix the client RPC should fail with UNAVAILABLE status in such a scenario. (#8020)
    • xds: Fixed a bug that xDS users may experience null pointer exception in rare cases (#8087)
    • xds: the xDS resolver did not clear its state when control plane resources were revoked before offloading the xDS LB plugin. It would treat the next update as duplicate if the control plane recovers and never comes back to use those resources. Now this is fixed.
    Source code(tar.gz)
    Source code(zip)
  • v1.38.0(May 19, 2021)

    gRPC Java 1.38.0 Release Notes

    API Changes

    • services: move classes with protobuf dependency into io.grpc.protobuf.services. Users currently using BinaryLogging, HealthChecking, Channelz should migrate to use the corresponding classes in io.grpc.protobuf.services. (#8056)
    • ChannelCredentials and ServerCredentials and are now stable. Notably, this also includes TlsChannelCredentials and TlsServerCredentials that allow mTLS configuration without a direct dependency on Netty. The description of the new API can be found in gRFC L74. These APIs are intended to “replace” the implicit security defaults of channels/servers as well as the usePlaintext() and useTransportSecurity() methods on the channel and server builders. The previous APIs are stable so will not be removed. Over time, documentation and examples will be migrated to the new API

    Bug Fixes

    • xds: Fixed a bug that xDS users may experience null pointer exception in rare cases (#8087)
    • netty: Fixed a bug that client RPCs may fail with a wrong exception with message "Maximum active streams violated for this endpoint" when receiving GOAWAY while MAX_CONCURRENT_STREAMS is reached. After the fix the client RPC should fail with UNAVAILABLE status in such a scenario. (#8020)
    • xds: Fixed a bug that xDS LB policies may process and propagate load balancing state update from its child LB policy after itself being shut down. This can be cascaded and result in hard-to-reason behaviors if any one layer of the LB policies does not clean up its internal state after shutdown.

    Behavior Changes

    • core, grpclb, xds: let leaf LB policies explicitly refresh name resolution when subchannel connection is broken. Custom LoadBalancer implementations should refresh name resolution (with Helper.refreshNameResolution()) when seeing its created subchannel becomes IDLE or TRANSIENT_FAILURE. Currently the Channel will do it for you and log a warning. But this operation will be removed in the future releases. (#8048)
    • netty: Added support for OpenJSSE

    Dependencies

    • Upgrade Guava to 30.1 (#8100). As part of #4671 grpc-java will drop support for Java 7, with no impact to Android API levels supported. Guava is going through the same process and in this Guava release it warns when used on Java 7. If you are using Java 7 and are impacted, please comment on #4671. The Java 7 check may be noticed by Android builds and fail without language-level desugaring. We expect most users have already enabled language-level desugaring, but if not it would be necessary to add to your build.gradle:
    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    
    • auth: Allow pre- and post-0.25.0 behavior from google-auth-library-java, for Bazel users. google-auth-library-java 0.25.0 changed its behavior for JWT that caused a gRPC test to fail. The failure was benign but prevented Bazel users from using newer versions of the library
    Source code(tar.gz)
    Source code(zip)
  • v1.37.1(May 14, 2021)

    Bug Fixes

    • netty: fixed a bug that client RPCs may fail with a wrong exception with message "Maximum active streams violated for this endpoint" when receiving GOAWAY while MAX_CONCURRENT_STREAMS is reached. After the fix the client RPC should fail with UNAVAILABLE status in such a scenario.
    • grpclb, xds: fixed a day-one issue that the control plane RPC are using the same Context as the inbound application RPC, which can cause control plane RPC aborted when the inbound application RPC completes.
    • xds: fixed a bug that xDS LB policies may process and propagate load balancing state update from its child LB policy after itself being shut down. This can be cascaded and result in hard-to-reason behaviors if any one layer of the LB policies does not clean up its internal state after shutdown.
    Source code(tar.gz)
    Source code(zip)
  • v1.37.0(Apr 8, 2021)

    Behavior Changes

    • alts: make both GoogleDefaultChannelCredentials and ComputeEngineChannelCredentials choose ALTS for backends given by xDS TD. Changes for ComputeEngineChannelCredentials were missing, but they really should be the same.
    • api: added a convenient ServerBuilder.addServices() API that allows adding a list of services instead of iterating through list and calling addService().
    • api: deleted some NameResolver APIs that have been marked as deprecated since 1.21 release.
    • api: implemented admin interface API, which automatically loads available admin services in a given binary. Currently, it only includes Channelz and CSDS with dependencies required at runtime.
    • context: move pendingDeadline.cancel out of synchronized block.
    • netty: allow connection handshakes (e.g., TCP, TLS) to be interrupted by channel.shutdown(). Previously shutdownNow() was required for prompt shutdown if a connection was handshaking.
    • xds: change in parsing ADS responses for LDS, RDS, CDS, and EDS resources. Before this release, gRPC parsing logic for ADS response containing multiple resources was to stop resource processing on the first encountered error, followed by NACK with the details of this single error. With this change, the parsing logic processes all resources and collects all processing errors. If any error occurred, a NACK is issued with concatenated error messages of all errors encountered. The rationale and the detailed design can be found in gRFC A40 — ADS Parsing Logic Update: Continue After First Error.
    • xds: change system property name for reading bootstrap config from io.grpc.xds.bootstrapValue to io.grpc.xds.bootstrapConfig.
    • xds: circuit breaking, timeout and fault injection are enabled by default. Previously they were protected by environment variables.
    • xds: use the new server_listener_resource_name_template property from the bootstrap file for server side xDS processing as per the gRFC A36-xds-for-servers.md.

    New Features

    • api: TlsChannelCredentials and TlsServerCredentials now support client certificates and custom KeyManagers/TrustManagers. grpc-netty fully supports these options. grpc-okhttp does not support keyfile-based configuration; you’d need to use a KeyManager. Most users of Netty’s SslContext and GrpcSslContexts should be able to migrate and are encouraged to do so, because this API does not have a Netty dependency and so is planned to become stable.
    • netty: added support for OpenJSSE.
    • okhttp: support compiling with okio 2.x API for Bazel users. grpc-okhttp was already compatible with okio 2 at runtime.
    • xds: XdsServingStatusListener has been implemented as per the gRFC A36-xds-for-servers.md.
    • xds: add proto leakage check at gradle build. Create a new Gradle task depends on shadowJar. It examines the outputs of shadowJar package prefix to make sure it is inside within the package.
    • xds: added CsdsService. It is safe for production but are Experimental APIs to resolve issues discovered as they see usage. The rationale and description of the new API can be found in gRFC A40: xDS Configuration Dump via Client Status Discovery Service in gRPC.
    • xds: implement gRPC server side validations and filterChain match of xDS configuration as per the gRFC A36-xds-for-servers.md.
    • xds: WeightedTargetLoadBalancer collect all failure child pickers to log more error details.

    Bug Fixes

    • grpclb: gRPCLB would buffer RPCs indefinitely if failing to fallback because the resolver provides no fallback addresses. Now it turns into TRANSIENT_FAILURE for such cases.
    • xds: fix CdsLoadBalancer2 childLb shutdown behavior. Previously these childLbs are not properly shutdown, which might cause channel panic as client channel is referenced by those childLbs.
    • Fixed an UnsupportedOperationException incompatibility with Netty 4.1.60.Final (#7953). This allows users of grpc-netty that may be using Netty elsewhere in their application to upgrade their Netty version to avoid exposure to recent Netty CVEs. gRPC itself is not impacted by those CVEs.
    • grpclb: fixed a race between address update and LB stream recreation, which would cause channel panic if the resolver refreshes the result while gRPCLB is in LB stream backoff.
    • grpclb: gRPCLB ignored CONNECTING subchannels when aggregating the overall LB state, which would cause RPCs to fail prematurely if there are subchannels in its initial connection.
    • grpclb: now we allow multiple authorities in lb backends instead of flattening to the first authority.
    • interop-testing: fix alts handshaking race: add proper synchronization on the AltsTestServer object lock, this way, alts client and alts server won’t race on the AltsTestServer during Alts handshake negotiation.
    • xds: fixed a bug that would drop some node information (e.g., user-agent) when reporting to LRS (#7964).
    • xds: the xDS resolver did not clear its state when control plane resources were revoked before offloading the xDS LB plugin. It would treat the next update as duplicate if the control plane recovers and never comes back to use those resources. Now this is fixed.

    Documentation

    • example-tls: ported to TlsChannelCredentials/TlsServerCredentials and no longer depends on Netty at compile time.
    • examples: add ALTS example README.md.

    Dependencies

    • gradle: bumped protobuf-gradle-plugin version to 0.8.15
    • xds: envoy proto updated to commit ac9a26373. Added xDS v3 csds.proto with dependencies.

    Acknowledgements

    @spkrka Kristofer Karlsson @njhill Nick Hill @ulfjack Ulf Adams

    Source code(tar.gz)
    Source code(zip)
  • v1.36.1(Mar 25, 2021)

    • Fix an UnsupportedOperationException incompatibility with Netty 4.1.60.Final (#7953). This allows users of grpc-netty that may be using Netty elsewhere in their application to upgrade their Netty version to avoid exposure to recent Netty CVEs. gRPC is not impacted by those CVEs so a Netty upgrade for gRPC itself is not necessary
    • xds: Fixed a bug that would drop some node information (e.g., user-agent) when reporting to LRS (#7964)
    • xds: Renamed io.grpc.xds.bootstrapValue system property to io.grpc.xds.bootstrapConfig. This more closely matches the environment variable (GRPC_XDS_BOOTSTRAP_CONFIG) and avoids future confusion (#7968)
    • xds: Fixed a possible IllegalStateException causing Channel panic during LB shutdown (#7942). The bug was introduced in v1.36.0. The issue likely most impacts xDS users that may leave a channel unused (no RPCs) for 30 minutes since idle timeout triggers LB shutdown
    Source code(tar.gz)
    Source code(zip)
  • v1.35.1(Mar 25, 2021)

    • Fix an UnsupportedOperationException incompatibility with Netty 4.1.60.Final (#7953). This allows users of grpc-netty that may be using Netty elsewhere in their application to upgrade their Netty version to avoid exposure to recent Netty CVEs. gRPC is not impacted by those CVEs so a Netty upgrade for gRPC itself is not necessary
    • xds: Fixed a bug that would drop some node information (e.g., user-agent) when reporting to LRS (#7964)
    Source code(tar.gz)
    Source code(zip)
  • v1.32.3(Mar 15, 2021)

    Bug Fixes

    • xds: Fixed JSON number types in internally generated service config for header matching (more specifically, range matching for numerical headers) (#7880).
    Source code(tar.gz)
    Source code(zip)
  • v1.31.2(Mar 15, 2021)

    Bug Fixes

    • xds: Fixed JSON number types in internally generated service config for header matching (more specifically, range matching for numerical headers) (#7884).
    Source code(tar.gz)
    Source code(zip)
  • v1.36.0(Feb 23, 2021)

    API Changes

    • Added .class file hack to ease removal of internal ABIs (https://github.com/grpc/grpc-java/pull/7834). This does not impact source code (API); it only impacts code compiled with a different version of gRPC than it runs with (ABI). Users of the transport-specific and experimental channel/server builders (NettyChannelBuilder, NettyServerBuilder, OkHttpChannelBuilder, InProcessChannelBuilder, CronetChannelBuilder) are commonly referencing internal ABIs due to overly-specific generics in gRPC. There is now a .class file hack in place which preserves ABI compatibility for old builds while causing javac to use the intended public API for new builds. In a future release we will remove the internal ABI for these experimental APIs (https://github.com/grpc/grpc-java/issues/7211) which may cause runtime failures. Recompiling with this release or later will prevent your code from using those ABIs and so you will not be impacted by the ABI removal. This is related to the temporary ABI breakage in v1.33.0.
    • Deleted deprecated LoadBalancer.Helper APIs as they had been deprecated since v1.22 release (#7793).
    • Deprecated LoadBalancer.Helper.createResolvingOobChannelBuilder(String target) in favor of the new experimental API createResolvingOobChannelBuilder(String target, ChannelCredentials creds). The two APIs differ not only in signature but also in the default authority of the returned builder. See their javadoc for more detail.

    Behavior Changes

    • ManagedChannelBuilder.overrideAuthority() is now used even if the NameResolver uses EquivalentAddressGroup.ATTR_AUTHORITY_OVERRIDE. Previously the NameResolver’s override would be used
    • grpclb: keep RR Subchannel state in TRANSIENT_FAILURE until becoming READY (#7816). This enhancement was previously made to the round_robin policy, but now also applies to grpclb
    • netty: On server-side, stop logging expected STREAM_CLOSED exceptions. This reduces log pollution

    New Features

    • services: Add support for grpc.channelz.v1.Channelz.GetServer, as defined in channelz.proto
    • xds: support reading bootstrap config directly from env var (GRPC_XDS_BOOTSTRAP_CONFIG) or system property (io.grpc.xds.bootstrapValue) values
    • alts: Introduce AltsContext to allow outside packages access to ALTS peer information

    Bug Fixes

    • core: Fixed a bug where RPCs queued waiting for a connection can use user-provided executors after the ManagedChannel is terminated (#6283)
    • core: Fixed a bug where RPCs queued waiting on CallCredentials can use user-provided executors after the ManagedChannel is terminated (#7813)

    Documentation

    • api: add nullable annotation to Status.trailersFromThrowable (#7856). The annotation doesn’t change behavior, it just makes the behavior more clear

    Dependencies

    • alts: Remove dependency on Apache Commons Lang

    Acknowledgements

    @elharo Elliotte Rusty Harold @lriuui0x0 Rui Liu @martin-schaub Martin Schaub @njhill Nick Hill @ReginFell Serhii Zabelnykov

    Source code(tar.gz)
    Source code(zip)
  • v1.35.0(Jan 13, 2021)

    Bug Fixes

    • core: Fix CompositeChannelCredentials to no longer use CallCredentials for OOB channels. OOB channels are available for load balancing policies to use to communicate with an LB server. It is mainly used by gRPC-LB. This resolves the incompatibility of the 1.34.0 release with googleapis.com.
    • alts: Limit number of concurrent handshakes to 32. ALTS uses blocking RPCs for handshakes. If the handshake server has a limit to number of concurrent handshakes this can produce a deadlock. Limiting to 32 should workaround the problem for the majority of the cases. A later fix will allow handshake RPCs to be asynchronous
    • xds: Fix missed class relocations for generated code. grpc-xds previously exposed generated code for multiple 3rd-party protobuf generated code classes outside of the io.grpc package. They are now shaded to avoid colliding with other users of the classes
    • xds: Fix a user visible stack trace showing java.util.NoSuchElementException when the environment variable GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT was set and the application contains an xDS configured gRPC server. The exception was benign and was seen when the connection was dropped before an SslContextProvider was available.
    • xds: Decouple xds channel creation and bootstrapping. This fixes the bug caused by the lifecycle mismatch between XdsClient and its channel to the xDS server. Creating a new XdsClient (previous one shutdown due to no Channel using it) would create and use a new xDS channel.
    • xds: Fix races between creating subchannls and Channel shutdown caused by delaying address/config propagation between LB policies. An exception will be thrown if Channel's shutdown() has been called and receiving an EDS update while the Channel has not completely shutdown.

    Dependencies

    • Guava updated to 30.0-android
    • Animal Sniffer annotations updated to 1.19
    • Error Prone annotations updated to 2.4.0
    • Perfmark updated to 0.23.0
    • compiler: Linux artifacts now built using CentOS 7. Previously CentOS 6 was used, but that distribution is discontinued and no longer available in our build infrastructure
    • netty: Upgrade to Netty 4.1.52 and tcnative 2.0.34. Note that this Netty release enables TLSv1.3 support. mTLS failures with TLSv1.3 will have different error messages than in TLSv1.2
    • auth,alts: google-auth-library-java updated to 0.22.2
    • census: OpenCensus updated to 0.28.0
    • protobuf: googleapi’s common protos updated to 2.0.1
    • okhttp: Okio updated to 1.17.5
    • xds: re2j updated to 1.5
    • xds: bouncycastle updated to 1.67
    • gradle: bumped protobuf-gradle-plugin version to 0.8.14
    • android, cronet: upgraded the latest support Android version to 29

    Acknowledgments

    @amnox @horizonzy @wanyingd1996

    Source code(tar.gz)
    Source code(zip)
  • v1.34.1(Dec 15, 2020)

    Bug Fixes

    • core: Fix CompositeChannelCredentials to no longer use CallCredentials for OOB channels. OOB channels are available for load balancing policies to use to communicate with an LB server. It is mainly used by gRPC-LB. This resolves the incompatibility of the 1.34.0 release with googleapis.com.
    • alts: Limit number of concurrent handshakes to 32. ALTS uses blocking RPCs for handshakes. If the handshake server has a limit to number of concurrent handshakes this can produce a deadlock. Limiting to 32 should workaround the problem for the majority of the cases. A later fix will allow handshake RPCs to be asynchronous
    • xds: Relocate (shade) all generated code; a few classes had previously been missed
    • xds: Fixed an issue when GRPC_XDS_EXPERIMENTAL_NEW_SERVER_API=true where gRPC would request non-existent resources
    Source code(tar.gz)
    Source code(zip)
  • v1.34.0(Dec 1, 2020)

    This release has a severe bug when using CompositeChannelCredentials that predominantly impacts googleapis.com (#7643). You may be impacted in the future even if not impacted today. If you contact googleapis.com, please use 1.34.1 instead.

    API Changes

    • api: added io.grpc.ForwardingServerBuilder (#7633)

    New Features

    • Added ChannelCredentials and ServerCredentials. They are safe for production but are Experimental APIs to resolve issues discovered as they see usage. The rationale and description of the new API can be found in gRFC L74. In short, these APIs are intended to “replace” the implicit security defaults of channels/servers as well as the usePlaintext() and useTransportSecurity() methods on the channel and server builders. The previous APIs are stable so will not be removed, but are expected to be deprecated in the future. Since these new APIs will be widely used, we encourage users to try the APIs out and report any problems experienced so they can be corrected before the APIs become stable (#7294, #7601)
    • As part of ChannelCredentials and ServerCredentials there are now XdsChannelCredentials and XdsServerCredentials added that can be used to enable use of XDS provided credentials on the channel and server. A File-watcher certificate provider has been implemented to support these Xds Credentials. The example in example-xds has been enhanced to be a full xDS example with XdsChannelCredentials and XdsServerCredentials to illustrate their usage. (#7497, #7636)
    • xds: added support for setting bootstrap file with java system property (#7620)

    Bug Fixes

    • netty: abrupt GOAWAY should not cause INTERNAL status. It is now UNAVAILABLE. This was a regression introduced in v1.33.0. The error was in the form StatusRuntimeException: INTERNAL: http2 exception with a cause similar to Http2Exception$StreamException: Cannot create stream 222691 greater than Last-Stream-ID 222689 from GOAWAY. This was mainly observed when a C core-based gRPC server shut down. (#7501)
    • core, netty, okhttp, cronet: fixed builders ABI backward compatibility broken in v1.33.0 (#7552). For details, see v1.33.1 release note.
    • core: round robin should ignore name resolution error for channel state change when there are READY subchannels (#7595). Previously the round_robin load balancing policy puts the Channel into TRANSIENT_FAILURE if encountering name resolution failures even if it has received usable addresses.
    • core: fixed floating-point number formatting Locale in error messages (#7473)
    • android: make Channel always enterIdle() upon network recover (#7611). This is for AndroidChannelBuilder. It avoids failing new RPCs prematurely when the device detects the network has recovered while resuming connections.
    • xds: only reschedule time for unresolved resources upon ADS stream restarts (#7582). The management server can choose not to send resources it has previously sent when the RPC stream is recreated. So the client will keep using resources it has saved previously.
    • alts: create handshaker RPC lazily (#7630). Previously the handshake RPCs start before the TCP connection is established, which might be leaked forever if the connection is never established.

    Documentation

    • api: added implementation note regarding server interceptors and thread locals (#7482)
    • api: clarify expectations regarding ServerCall#close (#7580)

    Behavior Changes

    • netty: differentiate GOAWAY closure status descriptions (#7502). Previously many different GOAWAY-related errors all produced the same status description. Now they each should use their own specific description which should allow distinguishing between issues like weak server GOAWAY behavior, MAX_CONCURRENT_STREAMS interfering with eager transport selection, and local races. We now also use UNAVAILABLE in more cases, although the cases that benefit should be rare
    • xds: added support case insensitive path matching (#7506). The xDS traffic splitting now supports the case-insensitive option for path matching.
    • alts: add a timeout to AltsHandshakerStub. A default of 20 seconds is used (#7589)

    Dependencies

    • all: bumped google auth libraries to version 0.22.0 (#6652)

    Acknowledgements

    @attila123 @erikjoh @jbdeboer @ST-DDT @sullis @susinmotion

    Source code(tar.gz)
    Source code(zip)
  • v1.33.1(Nov 2, 2020)

    Bug Fixes

    • Fix builders ABI backward compatibility broken in v1.33.0, see #7552
      • netty: The class io.grpc.netty.NettyServerBuilder reverted to extend internal class io.grpc.internal.AbstractServerImplBuilder
      • netty: The class io.grpc.netty.NettyChannelBuilder reverted to extend internal class io.grpc.internal.AbstractManagedChannelImplBuilder
      • okhttp: The class io.grpc.okhttp.OkhttpChannelBuilder reverted to extend internal class io.grpc.internal.AbstractManagedChannelImplBuilder
      • core: The class io.grpc.inprocess.InProcessChannelBuilder reverted to extend internal class io.grpc.internal.AbstractManagedChannelImplBuilder
      • cronet: The class io.grpc.cronet.CronetChannelBuilder reverted to extend internal class io.grpc.internal.AbstractManagedChannelImplBuilder
    • api: ForwardingServerBuilder reverted until the permanent fix of the issue with ABI compatibility of delegating classes
    • okhttp: exclude Internal* from javadoc
    • netty: Abrupt GOAWAY should not cause INTERNAL status. It is now UNAVAILABLE. This was a regression introduced in v1.33.0. The error was in the form StatusRuntimeException: INTERNAL: http2 exception with a cause similar to Http2Exception$StreamException: Cannot create stream 222691 greater than Last-Stream-ID 222689 from GOAWAY. This was mainly observed when a C core-based gRPC server shut down.
    • core: fix floating-point number formatting Locale
    Source code(tar.gz)
    Source code(zip)
  • v1.33.0(Oct 20, 2020)

    This release broke ABI in a non-planned way for NettyServerBuilder, NettyChannelBuilder, and similar. See https://github.com/grpc/grpc-java/issues/7552. If you are impacted, please use an earlier version until v1.33.1 is available. A future ABI breakage may be necessary, but will be communicated explicitly at that time.

    API Changes

    • netty: The class io.grpc.netty.NettyServerBuilder is no longer a subclass of the internal class io.grpc.internal.AbstractServerImplBuilder
    • netty: The class io.grpc.netty.NettyChannelBuilder is no longer a subclass of the internal class io.grpc.internal.AbstractManagedChannelImplBuilder
    • okhttp: The class io.grpc.okhttp.OkhttpChannelBuilder is no longer a subclass of the internal class io.grpc.internal.AbstractManagedChannelImplBuilder
    • core: The class io.grpc.inprocess.InProcessChannelBuilder is no longer a subclass of the internal class io.grpc.internal.AbstractManagedChannelImplBuilder
    • cronet: The class io.grpc.cronet.CronetChannelBuilder is no longer a subclass of the internal class io.grpc.internal.AbstractManagedChannelImplBuilder
    • api: Add ForwardingServerBuilder: a ServerBuilder that delegates to another builder by default
    • core: Add accessor for bare method name in MethodDescriptor (#7339)
    • stub: On server-side when an RPC is cancelled, only throw StatusRuntimeException: CANCELLED from onNext() for streaming responses. Previously the exception was also thrown from onNext() for unary responses and from onComplete(), which didn’t help the server avoid unnecessary processing
    • okhttp: OkHttpChannelBuilder made final and can no longer be anonymous
    • api, core: delete io.grpc.LoadBalancer.loadBalancingConfig attribute (#7440). The attribute was deprecated in v1.27.0, now it is completely deleted.

    New Features

    • netty: Add support for IBMJSSE2 (#7422)

    Documentation

    • API documentation (Javadoc) for Server and Channel builders now correctly displays inherited methods and the class hierarchy

    Bug Fixes

    • core: Reverted "delay sending cancel request on client-side when deadline expires" which introduced a memory leak (#7105). It could also cause messages to arrive after the call was reported closed (e.g., onMessage() after onClose())
    • grpclb: Fixed a bug that RPC might be hanging when using grpclb balancer as a child balancer in a hierarchical load balancer tree (#7434)
    • netty: TCP close during TLS handshake should be UNAVAILABLE, not UNKNOWN
    • netty: BDP ping accounting should occur after flow control. This resolves an incompatibility issue introduced in v1.30.0 and could be worked around via GRPC_EXPERIMENTAL_AUTOFLOWCONTROL=false introduced later. The symptom was a GOAWAY with “too_many_pings” without an aggressive keepalive configured. The environment variable is still available, but will be removed in the future

    Behavior Changes

    • xds: Xds server channel credential option will be required in the xDS bootstrap file. Use {"type":"insecure"}” for plaintext (#7396)

    Dependencies

    • benchmarks: Removed -javaagent jvm option in CreateStartScripts, to allow running the benchmarks without building from source
    • Upgrade Conscrypt to 2.5.1
    • bazel: Remove Maven repositories from repositories.bzl, in favor of maven_install. v1.27.0 introduced support for maven_install and encouraged users to migrate. See examples/WORKSPACE for an example. maven_install dramatically reduces the boilerplate for maven dependencies and properly handles transitive dependencies and version selection. gRPC is not yet using the @maven workspace, so it is still possible to use other dependency tools.
    • Update protobuf gradle plugin version to 0.8.13 (#7355)

    Acknowledgements

    @codeblooded Benjamin Reed @kiwi1969 Russell Shaw @pkern Philipp Kern

    Source code(tar.gz)
    Source code(zip)
  • v1.32.2(Oct 12, 2020)

    Bug Fixes

    • netty: TCP close during TLS handshake should be UNAVAILABLE, not UNKNOWN
    • netty: BDP ping accounting should occur after flow control. This resolves an incompatibility issue introduced in v1.30.0 and could be worked around via GRPC_EXPERIMENTAL_AUTOFLOWCONTROL=false introduced later. The symptom was a GOAWAY with “too_many_pings” without an aggressive keepalive configured. The environment variable is still available, but will be removed in the future
    • alts: Reverted workaround for Conscrypt cipher performance. Conscrypt 2.5.0 has significantly improved performance and the workaround now decreases performance. Note that grpc-alts itself still depends on Conscrypt 2.2.1 to remain stable for this bug fix release, but users are encouraged to use newer a version of Conscrypt. The gains from Conscrypt 2.5.0 are significantly greater than what the workaround provided
    Source code(tar.gz)
    Source code(zip)
  • v1.32.1(Sep 10, 2020)

    API Changes

    • api: Removed deprecated method ChannelBuilder.blockingExecutor() (#7242). There should not be any users as it was deprecated the first release it was available and was renamed offloadExecutor().
    • grpclb: Make ATTR_LB_ADDRS public (#7230). This is necessary to configure grpclb from a custom NameResolver

    New Features

    • xds: perform header matching on concatenated multi-valued headers (#7215)
    • xds: add header matching special cases for hiding/exposing some gRPC headers (#7224). The only gRPC header available for header matching is “content-type”.
    • xds: support load reporting all clusters option and fix actual report interval measurement (#7209). If the LRS response enables send_all_clusters, the client side will report loads for all clusters it is currently using.

    Bug Fixes

    • core, alts, cronet: Fix ByteBuffer covariant method usages (#7349). When built with Java 9+, internal usages of ByteBuffer APIs may cause runtime breakage for dependent applications running with Java 8. This is fixed now.
    • core: Fixed a bug that RPC may hang when hedging is enabled with a throttling configuration (#7337)
    • netty: The environment variable GRPC_EXPERIMENTAL_AUTOFLOWCONTROL=false will now disable the BDP monitoring introduced in v1.30.0. This is intended to help diagnose a “too_many_pings” compatibility issue and will be removed once it is resolved. If you need to use the variable, please file an issue
    • benchmarks: Use correct classpath for scripts (the ones in the bin/ folder of the tar/zip), fixing NoClassDefFoundErrors. The classpath was probably broken starting in v1.30.
    • xds: routing policy should immediately update a picker that selects base on updated config (#7233)

    Dependencies

    • netty: Upgrade to Netty 4.1.51 and tcnative 2.0.31
    • android, cronet: Drop support for android SDK versions older than 16 (#7253). The minimum supported Android SDK version is 16.

    Acknowledgements

    @susinmotion @trustin @wanyingd1996

    Source code(tar.gz)
    Source code(zip)
Owner
grpc
A high performance, open source, general-purpose RPC framework
grpc
LINE 3.4k Jan 17, 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 709 Jan 16, 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 19 Dec 11, 2021
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 20 Jan 1, 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 948 Jan 5, 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 5.9k Jan 22, 2022
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 41.5k Jan 21, 2022
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

贝克街的天才 92 Jan 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 21, 2022
An annotation-based Java library for creating Thrift serializable types and services.

Drift Drift is an easy-to-use, annotation-based Java library for creating Thrift clients and serializable types. The client library is similar to JAX-

null 198 Dec 16, 2021
jRT measures the response time of a java application to socket-based requests

jRT Version: 0.0.1 jRT is a instrumentation tool that logs and records networking I/O operations "response times" (applicaion response time if be corr

null 44 Feb 5, 2020
Experimental Netty-based Java 16 application/web framework

Experimental Netty-based application/web framework. An example application can be seen here. Should I use this? Probably not! It's still incredibly ea

amy null 7 Dec 24, 2021
This is an open source android based Music Player application developed in Android Studio

Pulse Music An offline music player android app, with modern UI and powerful features If you liked this repo, fork it and leave a STAR. Your support m

Sharath 5 Dec 8, 2021
A Java library that implements a ByteChannel interface over SSLEngine, enabling easy-to-use (socket-like) TLS for Java applications.

TLS Channel TLS Channel is a library that implements a ByteChannel interface over a TLS (Transport Layer Security) connection. It delegates all crypto

Mariano Barrios 123 Jan 2, 2022
Socket.IO server implemented on Java. Realtime java framework

Netty-socketio Overview This project is an open-source Java implementation of Socket.IO server. Based on Netty server framework. Checkout Demo project

Nikita Koksharov 5.6k Jan 20, 2022
ssh, scp and sftp for java

sshj - SSHv2 library for Java To get started, have a look at one of the examples. Hopefully you will find the API pleasant to work with :) Getting SSH

Jeroen van Erp 2k Jan 13, 2022
Java library for representing, parsing and encoding URNs as in RFC2141 and RFC8141

urnlib Java library for representing, parsing and encoding URNs as specified in RFC 2141 and RFC 8141. The initial URN RFC 2141 of May 1997 was supers

SLUB 21 Nov 30, 2021
Java API over Accelio

JXIO JXIO is Java API over AccelIO (C library). AccelIO (http://www.accelio.org/) is a high-performance asynchronous reliable messaging and RPC librar

Accelio 72 Sep 8, 2021