Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/grpc/grpc-java into zivy/…
Browse files Browse the repository at this point in the history
…master
  • Loading branch information
YifeiZhuang committed Nov 15, 2021
2 parents ed67aa2 + b746bab commit 05c32ee
Show file tree
Hide file tree
Showing 354 changed files with 15,696 additions and 7,413 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-java@v2
with:
java-version: ${{ matrix.jre }}
distribution: 'adopt'
distribution: 'temurin'

- name: Gradle cache
uses: actions/cache@v2
Expand Down Expand Up @@ -60,4 +60,4 @@ jobs:
if: matrix.jre == 8 # Upload once, instead of for each job in the matrix
run: ./gradlew :grpc-all:coveralls -x compileJava
- name: Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v2
7 changes: 4 additions & 3 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIB
for general contribution guidelines.

## Maintainers (in alphabetical order)

- [dapengzhang0](https://github.com/dapengzhang0), Google LLC
- [ejona86](https://github.com/ejona86), Google LLC
- [ericgribkoff](https://github.com/ericgribkoff), Google LLC
- [ran-su](https://github.com/ran-su), Google LLC
- [sanjaypujare](https://github.com/sanjaypujare), Google LLC
- [sergiitk](https://github.com/sergiitk), Google LLC
- [srini100](https://github.com/srini100), Google LLC
- [voidzcy](https://github.com/voidzcy), Google LLC
- [temawi](https://github.com/temawi), Google LLC
- [YifeiZhuang](https://github.com/YifeiZhuang), Google LLC
- [zhangkun83](https://github.com/zhangkun83), Google LLC

## Emeritus Maintainers (in alphabetical order)
- [carl-mastrangelo](https://github.com/carl-mastrangelo), Google LLC
- [creamsoup](https://github.com/creamsoup), Google LLC
- [ericgribkoff](https://github.com/ericgribkoff), Google LLC
- [jiangtaoli2016](https://github.com/jiangtaoli2016), Google LLC
- [jtattermusch](https://github.com/jtattermusch), Google LLC
- [louiscryan](https://github.com/louiscryan), Google LLC
- [nicolasnoble](https://github.com/nicolasnoble), Google LLC
- [nmittler](https://github.com/nmittler), Google LLC
- [voidzcy](https://github.com/voidzcy), Google LLC
- [zpencer](https://github.com/zpencer), Google LLC
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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
levels 19 and up (KitKat and later). Deploying gRPC servers on an Android
device is not supported.

TLS usage typically requires using Java 8, or Play Services Dynamic Security
Expand Down Expand Up @@ -31,8 +31,8 @@ For a guided tour, take a look at the [quick start
guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
basics](https://grpc.io/docs/languages/java/basics).

The [examples](https://github.com/grpc/grpc-java/tree/v1.39.0/examples) and the
[Android example](https://github.com/grpc/grpc-java/tree/v1.39.0/examples/android)
The [examples](https://github.com/grpc/grpc-java/tree/v1.42.1/examples) and the
[Android example](https://github.com/grpc/grpc-java/tree/v1.42.1/examples/android)
are standalone projects that showcase the usage of gRPC.

Download
Expand All @@ -43,17 +43,17 @@ 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.39.0</version>
<version>1.42.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.39.0</version>
<version>1.42.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.39.0</version>
<version>1.42.1</version>
</dependency>
<dependency> <!-- necessary for Java 9+ -->
<groupId>org.apache.tomcat</groupId>
Expand All @@ -65,23 +65,23 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:

Or for Gradle with non-Android, add to your dependencies:
```gradle
implementation 'io.grpc:grpc-netty-shaded:1.39.0'
implementation 'io.grpc:grpc-protobuf:1.39.0'
implementation 'io.grpc:grpc-stub:1.39.0'
implementation 'io.grpc:grpc-netty-shaded:1.42.1'
implementation 'io.grpc:grpc-protobuf:1.42.1'
implementation 'io.grpc:grpc-stub:1.42.1'
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`:
```gradle
implementation 'io.grpc:grpc-okhttp:1.39.0'
implementation 'io.grpc:grpc-protobuf-lite:1.39.0'
implementation 'io.grpc:grpc-stub:1.39.0'
implementation 'io.grpc:grpc-okhttp:1.42.1'
implementation 'io.grpc:grpc-protobuf-lite:1.42.1'
implementation 'io.grpc:grpc-stub:1.42.1'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
```

[the JARs]:
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.39.0
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.42.1

Development snapshots are available in [Sonatypes's snapshot
repository](https://oss.sonatype.org/content/repositories/snapshots/).
Expand Down Expand Up @@ -113,7 +113,7 @@ For protobuf-based codegen integrated with the Maven build system, you can use
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.17.2:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.39.0:exe:${os.detected.classifier}</pluginArtifact>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.42.1:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -143,7 +143,7 @@ protobuf {
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.39.0'
artifact = 'io.grpc:protoc-gen-grpc-java:1.42.1'
}
}
generateProtoTasks {
Expand Down Expand Up @@ -176,7 +176,7 @@ protobuf {
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.39.0'
artifact = 'io.grpc:protoc-gen-grpc-java:1.42.1'
}
}
generateProtoTasks {
Expand Down
32 changes: 9 additions & 23 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@ We deploy GRPC to Maven Central under the following systems:

Other systems may also work, but we haven't verified them.

Prerequisites
-------------

### Set Up OSSRH Account

If you haven't deployed artifacts to Maven Central before, you need to setup
your OSSRH (OSS Repository Hosting) account.
- Follow the instructions on [this
page](https://central.sonatype.org/pages/ossrh-guide.html) to set up an
account with OSSRH.
- You only need to create the account, not set up a new project
- Contact a gRPC maintainer to add your account after you have created it.

Common Variables
----------------
Many of the following commands expect release-specific variables to be set. Set
Expand Down Expand Up @@ -61,7 +48,11 @@ convention of `v<major>.<minor>.x`, while the tags include the patch version
`v<major>.<minor>.<patch>`. For example, the same branch `v1.7.x`
would be used to create all `v1.7` tags (e.g. `v1.7.0`, `v1.7.1`).

1. For `master`, change root build files to the next minor snapshot (e.g.
1. Review the issues in the current release [milestone](https://github.com/grpc/grpc-java/milestones)
for issues that won't make the cut. Check if any of them can be
closed. Be aware of the issues with the 'release blocker' label.
Consider reaching out to the assignee for the status update.
2. For `master`, change root build files to the next minor snapshot (e.g.
``1.8.0-SNAPSHOT``).

```bash
Expand All @@ -74,21 +65,15 @@ would be used to create all `v1.7` tags (e.g. `v1.7.0`, `v1.7.1`).
$ ./gradlew build
$ git commit -a -m "Start $MAJOR.$((MINOR+1)).0 development cycle"
```
2. Go through PR review and submit.
3. Create the release branch starting just before your commit and push it to GitHub:
3. Go through PR review and submit.
4. Create the release branch starting just before your commit and push it to GitHub:

```bash
$ git fetch upstream
$ git checkout -b v$MAJOR.$MINOR.x \
$(git log --pretty=format:%H --grep "^Start $MAJOR.$((MINOR+1)).0 development cycle$" upstream/master)^
$ git push upstream v$MAJOR.$MINOR.x
```
4. Ask a project admin to go to [Travis CI settings](https://travis-ci.org/grpc/grpc-java/settings)
and add a _Cron Job_:
* Branch: `v$MAJOR.$MINOR.x`
* Interval: `weekly`
* Options: `Do not run if there has been a build in the last 24h`
* Click _Add_ button
5. Continue with Google-internal steps at go/grpc/java/releasing.
6. Create a milestone for the next release.
7. Move items out of the release milestone that didn't make the cut. Issues that
Expand Down Expand Up @@ -117,7 +102,8 @@ Tagging the Release
$ git checkout v$MAJOR.$MINOR.x
$ git pull upstream v$MAJOR.$MINOR.x
$ git checkout -b release
# Bump documented versions. Don't forget protobuf version
# Bump documented gRPC versions.
# Also update protoc version to match protocVersion in build.gradle.
$ ${EDITOR:-nano -w} README.md
$ ${EDITOR:-nano -w} documentation/android-channel-builder.md
$ ${EDITOR:-nano -w} cronet/README.md
Expand Down
3 changes: 2 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ grpc-netty version | netty-handler version | netty-tcnative-boringssl-static ver
1.28.x | 4.1.45.Final | 2.0.28.Final
1.29.x-1.31.x | 4.1.48.Final | 2.0.30.Final
1.32.x-1.34.x | 4.1.51.Final | 2.0.31.Final
1.35.x- | 4.1.52.Final | 2.0.34.Final
1.35.x-1.41.x | 4.1.52.Final | 2.0.34.Final
1.42.x- | 4.1.63.Final | 2.0.38.Final

_(grpc-netty-shaded avoids issues with keeping these versions in sync.)_

Expand Down
21 changes: 14 additions & 7 deletions alts/src/main/java/io/grpc/alts/internal/AltsHandshakerClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.protobuf.ByteString;
import io.grpc.ChannelLogger;
import io.grpc.ChannelLogger.ChannelLogLevel;
import io.grpc.Status;
import io.grpc.alts.internal.HandshakerServiceGrpc.HandshakerServiceStub;
import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.Logger;

/** An API for conducting handshakes via ALTS handshaker service. */
class AltsHandshakerClient {
private static final Logger logger = Logger.getLogger(AltsHandshakerClient.class.getName());

private static final String APPLICATION_PROTOCOL = "grpc";
private static final String RECORD_PROTOCOL = "ALTSRP_GCM_AES128_REKEY";
private static final int KEY_LENGTH = AltsChannelCrypter.getKeyLength();
Expand All @@ -41,17 +39,22 @@ class AltsHandshakerClient {
private final AltsHandshakerOptions handshakerOptions;
private HandshakerResult result;
private HandshakerStatus status;
private final ChannelLogger logger;

/** Starts a new handshake interacting with the handshaker service. */
AltsHandshakerClient(HandshakerServiceStub stub, AltsHandshakerOptions options) {
AltsHandshakerClient(
HandshakerServiceStub stub, AltsHandshakerOptions options, ChannelLogger logger) {
handshakerStub = new AltsHandshakerStub(stub);
handshakerOptions = options;
this.logger = logger;
}

@VisibleForTesting
AltsHandshakerClient(AltsHandshakerStub handshakerStub, AltsHandshakerOptions options) {
AltsHandshakerClient(
AltsHandshakerStub handshakerStub, AltsHandshakerOptions options, ChannelLogger logger) {
this.handshakerStub = handshakerStub;
handshakerOptions = options;
this.logger = logger;
}

static String getApplicationProtocol() {
Expand Down Expand Up @@ -154,7 +157,7 @@ private void handleResponse(HandshakerResp resp) throws GeneralSecurityException
}
if (status.getCode() != Status.Code.OK.value()) {
String error = "Handshaker service error: " + status.getDetails();
logger.log(Level.INFO, error);
logger.log(ChannelLogLevel.DEBUG, error);
close();
throw new GeneralSecurityException(error);
}
Expand All @@ -173,7 +176,9 @@ public ByteBuffer startClientHandshake() throws GeneralSecurityException {
setStartClientFields(req);
HandshakerResp resp;
try {
logger.log(ChannelLogLevel.DEBUG, "Send ALTS handshake request to upstream");
resp = handshakerStub.send(req.build());
logger.log(ChannelLogLevel.DEBUG, "Receive ALTS handshake response from upstream");
} catch (IOException | InterruptedException e) {
throw new GeneralSecurityException(e);
}
Expand Down Expand Up @@ -223,7 +228,9 @@ public ByteBuffer next(ByteBuffer inBytes) throws GeneralSecurityException {
.build());
HandshakerResp resp;
try {
logger.log(ChannelLogLevel.DEBUG, "Send ALTS handshake request to upstream");
resp = handshakerStub.send(req.build());
logger.log(ChannelLogLevel.DEBUG, "Receive ALTS handshake response from upstream");
} catch (IOException | InterruptedException e) {
throw new GeneralSecurityException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ public AsciiString scheme() {

@Override
public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grpcHandler) {
TsiHandshaker handshaker = handshakerFactory.newHandshaker(grpcHandler.getAuthority());
ChannelLogger negotiationLogger = grpcHandler.getNegotiationLogger();
TsiHandshaker handshaker =
handshakerFactory.newHandshaker(grpcHandler.getAuthority(), negotiationLogger);
NettyTsiHandshaker nettyHandshaker = new NettyTsiHandshaker(handshaker);
ChannelHandler gnh = InternalProtocolNegotiators.grpcNegotiationHandler(grpcHandler);
ChannelHandler thh = new TsiHandshakeHandler(
Expand All @@ -142,11 +143,13 @@ public static ProtocolNegotiator serverAltsProtocolNegotiator(
final class ServerTsiHandshakerFactory implements TsiHandshakerFactory {

@Override
public TsiHandshaker newHandshaker(@Nullable String authority) {
public TsiHandshaker newHandshaker(
@Nullable String authority, ChannelLogger negotiationLogger) {
assert authority == null;
return AltsTsiHandshaker.newServer(
HandshakerServiceGrpc.newStub(lazyHandshakerChannel.get()),
new AltsHandshakerOptions(RpcProtocolVersionsUtil.getRpcProtocolVersions()));
new AltsHandshakerOptions(RpcProtocolVersionsUtil.getRpcProtocolVersions()),
negotiationLogger);
}
}

Expand Down Expand Up @@ -174,7 +177,8 @@ public AsciiString scheme() {
@Override
public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grpcHandler) {
ChannelLogger negotiationLogger = grpcHandler.getNegotiationLogger();
TsiHandshaker handshaker = handshakerFactory.newHandshaker(/* authority= */ null);
TsiHandshaker handshaker =
handshakerFactory.newHandshaker(/* authority= */ null, negotiationLogger);
NettyTsiHandshaker nettyHandshaker = new NettyTsiHandshaker(handshaker);
ChannelHandler gnh = InternalProtocolNegotiators.grpcNegotiationHandler(grpcHandler);
ChannelHandler thh = new TsiHandshakeHandler(
Expand Down Expand Up @@ -292,7 +296,8 @@ public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grpcHandler) {
if (grpcHandler.getEagAttributes().get(GrpclbConstants.ATTR_LB_ADDR_AUTHORITY) != null
|| grpcHandler.getEagAttributes().get(GrpclbConstants.ATTR_LB_PROVIDED_BACKEND) != null
|| isXdsDirectPath) {
TsiHandshaker handshaker = handshakerFactory.newHandshaker(grpcHandler.getAuthority());
TsiHandshaker handshaker =
handshakerFactory.newHandshaker(grpcHandler.getAuthority(), negotiationLogger);
NettyTsiHandshaker nettyHandshaker = new NettyTsiHandshaker(handshaker);
securityHandler = new TsiHandshakeHandler(
gnh, nettyHandshaker, new AltsHandshakeValidator(), handshakeSemaphore,
Expand Down Expand Up @@ -325,15 +330,18 @@ private static final class ClientTsiHandshakerFactory implements TsiHandshakerFa
}

@Override
public TsiHandshaker newHandshaker(@Nullable String authority) {
public TsiHandshaker newHandshaker(
@Nullable String authority, ChannelLogger negotiationLogger) {
AltsClientOptions handshakerOptions =
new AltsClientOptions.Builder()
.setRpcProtocolVersions(RpcProtocolVersionsUtil.getRpcProtocolVersions())
.setTargetServiceAccounts(targetServiceAccounts)
.setTargetName(authority)
.build();
return AltsTsiHandshaker.newClient(
HandshakerServiceGrpc.newStub(lazyHandshakerChannel.get()), handshakerOptions);
HandshakerServiceGrpc.newStub(lazyHandshakerChannel.get()),
handshakerOptions,
negotiationLogger);
}
}

Expand Down
Loading

0 comments on commit 05c32ee

Please sign in to comment.