Skip to content

Commit 449a8bc

Browse files
authored
Merge branch 'master' into plumb-otel-subchannel-metrics-disconnect-error
2 parents 2ba576a + a57c373 commit 449a8bc

File tree

233 files changed

+7926
-1798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+7926
-1798
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ MODULE.bazel.lock
3131
.gitignore
3232
bin
3333

34+
# VsCode
35+
.vscode
36+
3437
# OS X
3538
.DS_Store
3639

MODULE.bazel

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module(
22
name = "grpc-java",
33
compatibility_level = 0,
44
repo_name = "io_grpc_grpc_java",
5-
version = "1.77.0-SNAPSHOT", # CURRENT_GRPC_VERSION
5+
version = "1.78.0-SNAPSHOT", # CURRENT_GRPC_VERSION
66
)
77

88
# GRPC_DEPS_START
@@ -14,7 +14,7 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
1414
"com.google.auto.value:auto-value-annotations:1.11.0",
1515
"com.google.auto.value:auto-value:1.11.0",
1616
"com.google.code.findbugs:jsr305:3.0.2",
17-
"com.google.code.gson:gson:2.11.0",
17+
"com.google.code.gson:gson:2.12.1",
1818
"com.google.errorprone:error_prone_annotations:2.36.0",
1919
"com.google.guava:failureaccess:1.0.1",
2020
"com.google.guava:guava:33.4.8-android",
@@ -23,20 +23,20 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
2323
"com.google.truth:truth:1.4.2",
2424
"com.squareup.okhttp:okhttp:2.7.5",
2525
"com.squareup.okio:okio:2.10.0", # 3.0+ needs swapping to -jvm; need work to avoid flag-day
26-
"io.netty:netty-buffer:4.1.124.Final",
27-
"io.netty:netty-codec-http2:4.1.124.Final",
28-
"io.netty:netty-codec-http:4.1.124.Final",
29-
"io.netty:netty-codec-socks:4.1.124.Final",
30-
"io.netty:netty-codec:4.1.124.Final",
31-
"io.netty:netty-common:4.1.124.Final",
32-
"io.netty:netty-handler-proxy:4.1.124.Final",
33-
"io.netty:netty-handler:4.1.124.Final",
34-
"io.netty:netty-resolver:4.1.124.Final",
35-
"io.netty:netty-tcnative-boringssl-static:2.0.70.Final",
36-
"io.netty:netty-tcnative-classes:2.0.70.Final",
37-
"io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.124.Final",
38-
"io.netty:netty-transport-native-unix-common:4.1.124.Final",
39-
"io.netty:netty-transport:4.1.124.Final",
26+
"io.netty:netty-buffer:4.1.127.Final",
27+
"io.netty:netty-codec-http2:4.1.127.Final",
28+
"io.netty:netty-codec-http:4.1.127.Final",
29+
"io.netty:netty-codec-socks:4.1.127.Final",
30+
"io.netty:netty-codec:4.1.127.Final",
31+
"io.netty:netty-common:4.1.127.Final",
32+
"io.netty:netty-handler-proxy:4.1.127.Final",
33+
"io.netty:netty-handler:4.1.127.Final",
34+
"io.netty:netty-resolver:4.1.127.Final",
35+
"io.netty:netty-tcnative-boringssl-static:2.0.74.Final",
36+
"io.netty:netty-tcnative-classes:2.0.74.Final",
37+
"io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.127.Final",
38+
"io.netty:netty-transport-native-unix-common:4.1.127.Final",
39+
"io.netty:netty-transport:4.1.127.Final",
4040
"io.opencensus:opencensus-api:0.31.0",
4141
"io.opencensus:opencensus-contrib-grpc-metrics:0.31.0",
4242
"io.perfmark:perfmark-api:0.27.0",

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ For a guided tour, take a look at the [quick start
4444
guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
4545
basics](https://grpc.io/docs/languages/java/basics).
4646

47-
The [examples](https://github.com/grpc/grpc-java/tree/v1.75.0/examples) and the
48-
[Android example](https://github.com/grpc/grpc-java/tree/v1.75.0/examples/android)
47+
The [examples](https://github.com/grpc/grpc-java/tree/v1.76.0/examples) and the
48+
[Android example](https://github.com/grpc/grpc-java/tree/v1.76.0/examples/android)
4949
are standalone projects that showcase the usage of gRPC.
5050

5151
Download
@@ -56,42 +56,42 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
5656
<dependency>
5757
<groupId>io.grpc</groupId>
5858
<artifactId>grpc-netty-shaded</artifactId>
59-
<version>1.75.0</version>
59+
<version>1.76.0</version>
6060
<scope>runtime</scope>
6161
</dependency>
6262
<dependency>
6363
<groupId>io.grpc</groupId>
6464
<artifactId>grpc-protobuf</artifactId>
65-
<version>1.75.0</version>
65+
<version>1.76.0</version>
6666
</dependency>
6767
<dependency>
6868
<groupId>io.grpc</groupId>
6969
<artifactId>grpc-stub</artifactId>
70-
<version>1.75.0</version>
70+
<version>1.76.0</version>
7171
</dependency>
7272
```
7373

7474
Or for Gradle with non-Android, add to your dependencies:
7575
```gradle
76-
runtimeOnly 'io.grpc:grpc-netty-shaded:1.75.0'
77-
implementation 'io.grpc:grpc-protobuf:1.75.0'
78-
implementation 'io.grpc:grpc-stub:1.75.0'
76+
runtimeOnly 'io.grpc:grpc-netty-shaded:1.76.0'
77+
implementation 'io.grpc:grpc-protobuf:1.76.0'
78+
implementation 'io.grpc:grpc-stub:1.76.0'
7979
```
8080

8181
For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
8282
`grpc-protobuf-lite` instead of `grpc-protobuf`:
8383
```gradle
84-
implementation 'io.grpc:grpc-okhttp:1.75.0'
85-
implementation 'io.grpc:grpc-protobuf-lite:1.75.0'
86-
implementation 'io.grpc:grpc-stub:1.75.0'
84+
implementation 'io.grpc:grpc-okhttp:1.76.0'
85+
implementation 'io.grpc:grpc-protobuf-lite:1.76.0'
86+
implementation 'io.grpc:grpc-stub:1.76.0'
8787
```
8888

8989
For [Bazel](https://bazel.build), you can either
9090
[use Maven](https://github.com/bazelbuild/rules_jvm_external)
9191
(with the GAVs from above), or use `@io_grpc_grpc_java//api` et al (see below).
9292

9393
[the JARs]:
94-
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.75.0
94+
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.76.0
9595

9696
Development snapshots are available in [Sonatypes's snapshot
9797
repository](https://central.sonatype.com/repository/maven-snapshots/).
@@ -121,9 +121,9 @@ For protobuf-based codegen integrated with the Maven build system, you can use
121121
<artifactId>protobuf-maven-plugin</artifactId>
122122
<version>0.6.1</version>
123123
<configuration>
124-
<protocArtifact>com.google.protobuf:protoc:3.25.5:exe:${os.detected.classifier}</protocArtifact>
124+
<protocArtifact>com.google.protobuf:protoc:3.25.8:exe:${os.detected.classifier}</protocArtifact>
125125
<pluginId>grpc-java</pluginId>
126-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.75.0:exe:${os.detected.classifier}</pluginArtifact>
126+
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.76.0:exe:${os.detected.classifier}</pluginArtifact>
127127
</configuration>
128128
<executions>
129129
<execution>
@@ -149,11 +149,11 @@ plugins {
149149
150150
protobuf {
151151
protoc {
152-
artifact = "com.google.protobuf:protoc:3.25.5"
152+
artifact = "com.google.protobuf:protoc:3.25.8"
153153
}
154154
plugins {
155155
grpc {
156-
artifact = 'io.grpc:protoc-gen-grpc-java:1.75.0'
156+
artifact = 'io.grpc:protoc-gen-grpc-java:1.76.0'
157157
}
158158
}
159159
generateProtoTasks {
@@ -182,11 +182,11 @@ plugins {
182182
183183
protobuf {
184184
protoc {
185-
artifact = "com.google.protobuf:protoc:3.25.5"
185+
artifact = "com.google.protobuf:protoc:3.25.8"
186186
}
187187
plugins {
188188
grpc {
189-
artifact = 'io.grpc:protoc-gen-grpc-java:1.75.0'
189+
artifact = 'io.grpc:protoc-gen-grpc-java:1.76.0'
190190
}
191191
}
192192
generateProtoTasks {

SECURITY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ grpc-netty version | netty-handler version | netty-tcnative-boringssl-static ver
397397
1.60.x-1.66.x | 4.1.100.Final | 2.0.61.Final
398398
1.67.x-1.70.x | 4.1.110.Final | 2.0.65.Final
399399
1.71.x-1.74.x | 4.1.110.Final | 2.0.70.Final
400-
1.75.x- | 4.1.124.Final | 2.0.72.Final
400+
1.75.x-1.76.x | 4.1.124.Final | 2.0.72.Final
401+
1.77.x- | 4.1.127.Final | 2.0.74.Final
401402

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

alts/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ java_library(
1313
":handshaker_java_proto",
1414
"//api",
1515
"//core:internal",
16-
"//grpclb",
1716
"//netty",
1817
"//stub",
1918
"@com_google_protobuf//:protobuf_java",

alts/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ dependencies {
1414
implementation project(':grpc-auth'),
1515
project(':grpc-core'),
1616
project(":grpc-context"), // Override google-auth dependency with our newer version
17-
project(':grpc-grpclb'),
1817
project(':grpc-protobuf'),
1918
project(':grpc-stub'),
2019
libraries.protobuf.java,
2120
libraries.conscrypt,
22-
libraries.guava.jre, // JRE required by protobuf-java-util from grpclb
2321
libraries.google.auth.oauth2Http
2422
def nettyDependency = implementation project(':grpc-netty')
2523

alts/src/main/java/io/grpc/alts/HandshakerServiceChannel.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,29 @@
3737
* application will have at most one connection to the handshaker service.
3838
*/
3939
final class HandshakerServiceChannel {
40+
// Port 8080 is necessary for ALTS handshake.
41+
private static final int ALTS_PORT = 8080;
42+
private static final String DEFAULT_TARGET = "metadata.google.internal.:8080";
4043

4144
static final Resource<Channel> SHARED_HANDSHAKER_CHANNEL =
42-
new ChannelResource("metadata.google.internal.:8080");
43-
45+
new ChannelResource(getHandshakerTarget(System.getenv("GCE_METADATA_HOST")));
46+
47+
/**
48+
* Returns handshaker target. When GCE_METADATA_HOST is provided, it might contain port which we
49+
* will discard and use ALTS_PORT instead.
50+
*/
51+
static String getHandshakerTarget(String envValue) {
52+
if (envValue == null || envValue.isEmpty()) {
53+
return DEFAULT_TARGET;
54+
}
55+
String host = envValue;
56+
int portIndex = host.lastIndexOf(':');
57+
if (portIndex != -1) {
58+
host = host.substring(0, portIndex); // Discard port if specified
59+
}
60+
return host + ":" + ALTS_PORT; // Utilize ALTS port in all cases
61+
}
62+
4463
/** Returns a resource of handshaker service channel for testing only. */
4564
static Resource<Channel> getHandshakerChannelForTesting(String handshakerAddress) {
4665
return new ChannelResource(handshakerAddress);

alts/src/main/java/io/grpc/alts/internal/AltsProtocolNegotiator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import io.grpc.SecurityLevel;
3131
import io.grpc.Status;
3232
import io.grpc.alts.internal.RpcProtocolVersionsUtil.RpcVersionsCheckResult;
33-
import io.grpc.grpclb.GrpclbConstants;
3433
import io.grpc.internal.ObjectPool;
3534
import io.grpc.netty.GrpcHttp2ConnectionHandler;
3635
import io.grpc.netty.InternalProtocolNegotiator;
@@ -299,9 +298,7 @@ public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grpcHandler) {
299298
isXdsDirectPath = isDirectPathCluster(
300299
grpcHandler.getEagAttributes().get(clusterNameAttrKey));
301300
}
302-
if (grpcHandler.getEagAttributes().get(GrpclbConstants.ATTR_LB_ADDR_AUTHORITY) != null
303-
|| grpcHandler.getEagAttributes().get(GrpclbConstants.ATTR_LB_PROVIDED_BACKEND) != null
304-
|| isXdsDirectPath) {
301+
if (isXdsDirectPath) {
305302
TsiHandshaker handshaker =
306303
handshakerFactory.newHandshaker(grpcHandler.getAuthority(), negotiationLogger);
307304
NettyTsiHandshaker nettyHandshaker = new NettyTsiHandshaker(handshaker);

alts/src/main/java/io/grpc/alts/internal/AltsTsiHandshaker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public boolean processBytesFromPeer(ByteBuffer bytes) throws GeneralSecurityExce
8080
return true;
8181
}
8282
int remaining = bytes.remaining();
83-
// Call handshaker service to proceess the bytes.
83+
// Call handshaker service to process the bytes.
8484
if (outputFrame == null) {
8585
checkState(!isClient, "Client handshaker should not process any frame at the beginning.");
8686
outputFrame = handshaker.startServerHandshake(bytes);

alts/src/test/java/io/grpc/alts/HandshakerServiceChannelTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ public void sharedChannel_authority() {
6767
}
6868
}
6969

70+
@Test
71+
public void getHandshakerTarget_nullEnvVar() {
72+
assertThat(HandshakerServiceChannel.getHandshakerTarget(null))
73+
.isEqualTo("metadata.google.internal.:8080");
74+
}
75+
76+
@Test
77+
public void getHandshakerTarget_envVarWithPort() {
78+
assertThat(HandshakerServiceChannel.getHandshakerTarget("169.254.169.254:80"))
79+
.isEqualTo("169.254.169.254:8080");
80+
}
81+
82+
@Test
83+
public void getHandshakerTarget_envVarWithHostOnly() {
84+
assertThat(HandshakerServiceChannel.getHandshakerTarget("169.254.169.254"))
85+
.isEqualTo("169.254.169.254:8080");
86+
}
87+
7088
@Test
7189
public void resource_works() {
7290
Channel channel = resource.create();

0 commit comments

Comments
 (0)