Skip to content

Commit 40d5c6b

Browse files
committed
Merge remote-tracking branch 'origin/master' into ext-proc-server
# Conflicts: # api/src/main/java/io/grpc/ServerCall.java # core/src/main/java/io/grpc/internal/ServerCallImpl.java # core/src/test/java/io/grpc/internal/ServerCallImplTest.java
2 parents 1ad8aa5 + 2c9b067 commit 40d5c6b

168 files changed

Lines changed: 13179 additions & 2186 deletions

File tree

Some content is hidden

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

‎CONTRIBUTING.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,29 @@ In order to protect both you and ourselves, you will need to sign the
1313
[Contributor License Agreement](https://easycla.lfx.linuxfoundation.org/). When
1414
you make a PR, a CLA bot will provide a link for the process.
1515

16+
## Generative AI Policy
17+
18+
AI tools have the ability to produce more code than is possible for the gRPC
19+
team to read, understand, review, and accept into the repository. For this
20+
reason, we request that all contributions adhere to the following rules:
21+
22+
1. **No AI-Generated Interactions:** All communication in the repo must be
23+
authored by a human. _Exception: AIs may be used for directed writing
24+
assistance or translation._ Absolutely no automated agents are allowed to
25+
directly publish to GitHub.
26+
27+
2. **Author Ownership and Accountability:** Code contributions are expected to
28+
be fully owned and understood by the human contributor. If the code was
29+
produced by generative AI, the author is expected to have reviewed and
30+
understood it in its entirety before submitting it for review. This includes
31+
all content: production code, tests, examples, tools, etc.
32+
33+
In addition to the above requirements, any AI-assisted contributions must also
34+
comply with the [Linux Foundation Generative AI
35+
Policy](https://www.linuxfoundation.org/legal/generative-ai). This includes
36+
confirming that all contributions are legally allowed to be contributed to the
37+
gRPC project under the applicable license terms.
38+
1639
## Compiling
1740

1841
See [COMPILING.md](COMPILING.md). Specifically, you'll generally want to set

‎MODULE.bazel‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module(
22
name = "grpc-java",
3-
version = "1.85.0-SNAPSHOT", # CURRENT_GRPC_VERSION
3+
version = "1.86.0-SNAPSHOT", # CURRENT_GRPC_VERSION
44
repo_name = "io_grpc_grpc_java",
55
)
66

@@ -25,20 +25,20 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
2525
"dev.cel:common:0.13.1",
2626
"com.squareup.okhttp:okhttp:2.7.5",
2727
"com.squareup.okio:okio:2.10.0", # 3.0+ needs swapping to -jvm; need work to avoid flag-day
28-
"io.netty:netty-buffer:4.2.16.Final",
29-
"io.netty:netty-codec-base:4.2.16.Final",
30-
"io.netty:netty-codec-http2:4.2.16.Final",
31-
"io.netty:netty-codec-http:4.2.16.Final",
32-
"io.netty:netty-codec-socks:4.2.16.Final",
33-
"io.netty:netty-common:4.2.16.Final",
34-
"io.netty:netty-handler-proxy:4.2.16.Final",
35-
"io.netty:netty-handler:4.2.16.Final",
36-
"io.netty:netty-resolver:4.2.16.Final",
28+
"io.netty:netty-buffer:4.2.17.Final",
29+
"io.netty:netty-codec-base:4.2.17.Final",
30+
"io.netty:netty-codec-http2:4.2.17.Final",
31+
"io.netty:netty-codec-http:4.2.17.Final",
32+
"io.netty:netty-codec-socks:4.2.17.Final",
33+
"io.netty:netty-common:4.2.17.Final",
34+
"io.netty:netty-handler-proxy:4.2.17.Final",
35+
"io.netty:netty-handler:4.2.17.Final",
36+
"io.netty:netty-resolver:4.2.17.Final",
3737
"io.netty:netty-tcnative-boringssl-static:2.0.81.Final",
3838
"io.netty:netty-tcnative-classes:2.0.81.Final",
39-
"io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.2.16.Final",
40-
"io.netty:netty-transport-native-unix-common:4.2.16.Final",
41-
"io.netty:netty-transport:4.2.16.Final",
39+
"io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.2.17.Final",
40+
"io.netty:netty-transport-native-unix-common:4.2.17.Final",
41+
"io.netty:netty-transport:4.2.17.Final",
4242
"io.opencensus:opencensus-api:0.31.0",
4343
"io.opencensus:opencensus-contrib-grpc-metrics:0.31.0",
4444
"io.perfmark:perfmark-api:0.27.0",

‎README.md‎

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ gRPC-Java - An RPC library and framework
1717
[![Line Coverage Status](https://coveralls.io/repos/grpc/grpc-java/badge.svg?branch=master&service=github)](https://coveralls.io/github/grpc/grpc-java?branch=master)
1818
[![Branch-adjusted Line Coverage Status](https://codecov.io/gh/grpc/grpc-java/branch/master/graph/badge.svg)](https://codecov.io/gh/grpc/grpc-java)
1919

20+
Statistics
21+
---------------
22+
![Issues](https://img.shields.io/github/issues/grpc/grpc-java)
23+
![Pull Requests](https://img.shields.io/github/issues-pr/grpc/grpc-java)
24+
![Forks](https://img.shields.io/github/forks/grpc/grpc-java)
25+
![Stars](https://img.shields.io/github/stars/grpc/grpc-java)
26+
2027
Supported Platforms
2128
-------------------
2229

@@ -44,8 +51,8 @@ For a guided tour, take a look at the [quick start
4451
guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
4552
basics](https://grpc.io/docs/languages/java/basics).
4653

47-
The [examples](https://github.com/grpc/grpc-java/tree/v1.84.0/examples) and the
48-
[Android example](https://github.com/grpc/grpc-java/tree/v1.84.0/examples/android)
54+
The [examples](https://github.com/grpc/grpc-java/tree/v1.84.1/examples) and the
55+
[Android example](https://github.com/grpc/grpc-java/tree/v1.84.1/examples/android)
4956
are standalone projects that showcase the usage of gRPC.
5057

5158
Download
@@ -56,42 +63,42 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
5663
<dependency>
5764
<groupId>io.grpc</groupId>
5865
<artifactId>grpc-netty-shaded</artifactId>
59-
<version>1.84.0</version>
66+
<version>1.84.1</version>
6067
<scope>runtime</scope>
6168
</dependency>
6269
<dependency>
6370
<groupId>io.grpc</groupId>
6471
<artifactId>grpc-protobuf</artifactId>
65-
<version>1.84.0</version>
72+
<version>1.84.1</version>
6673
</dependency>
6774
<dependency>
6875
<groupId>io.grpc</groupId>
6976
<artifactId>grpc-stub</artifactId>
70-
<version>1.84.0</version>
77+
<version>1.84.1</version>
7178
</dependency>
7279
```
7380

7481
Or for Gradle with non-Android, add to your dependencies:
7582
```gradle
76-
runtimeOnly 'io.grpc:grpc-netty-shaded:1.84.0'
77-
implementation 'io.grpc:grpc-protobuf:1.84.0'
78-
implementation 'io.grpc:grpc-stub:1.84.0'
83+
runtimeOnly 'io.grpc:grpc-netty-shaded:1.84.1'
84+
implementation 'io.grpc:grpc-protobuf:1.84.1'
85+
implementation 'io.grpc:grpc-stub:1.84.1'
7986
```
8087

8188
For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
8289
`grpc-protobuf-lite` instead of `grpc-protobuf`:
8390
```gradle
84-
implementation 'io.grpc:grpc-okhttp:1.84.0'
85-
implementation 'io.grpc:grpc-protobuf-lite:1.84.0'
86-
implementation 'io.grpc:grpc-stub:1.84.0'
91+
implementation 'io.grpc:grpc-okhttp:1.84.1'
92+
implementation 'io.grpc:grpc-protobuf-lite:1.84.1'
93+
implementation 'io.grpc:grpc-stub:1.84.1'
8794
```
8895

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

93100
[the JARs]:
94-
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.84.0
101+
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.84.1
95102

96103
Development snapshots are available in [Sonatypes's snapshot
97104
repository](https://central.sonatype.com/repository/maven-snapshots/).
@@ -123,7 +130,7 @@ For protobuf-based codegen integrated with the Maven build system, you can use
123130
<configuration>
124131
<protocArtifact>com.google.protobuf:protoc:3.25.8:exe:${os.detected.classifier}</protocArtifact>
125132
<pluginId>grpc-java</pluginId>
126-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.84.0:exe:${os.detected.classifier}</pluginArtifact>
133+
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.84.1:exe:${os.detected.classifier}</pluginArtifact>
127134
</configuration>
128135
<executions>
129136
<execution>
@@ -153,7 +160,7 @@ protobuf {
153160
}
154161
plugins {
155162
grpc {
156-
artifact = 'io.grpc:protoc-gen-grpc-java:1.84.0'
163+
artifact = 'io.grpc:protoc-gen-grpc-java:1.84.1'
157164
}
158165
}
159166
generateProtoTasks {
@@ -186,7 +193,7 @@ protobuf {
186193
}
187194
plugins {
188195
grpc {
189-
artifact = 'io.grpc:protoc-gen-grpc-java:1.84.0'
196+
artifact = 'io.grpc:protoc-gen-grpc-java:1.84.1'
190197
}
191198
}
192199
generateProtoTasks {

‎SECURITY.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ grpc-netty version | netty-handler version | netty-tcnative-boringssl-static ver
403403
1.81.x | 4.1.132.Final | 2.0.75.Final
404404
1.82.x | 4.1.133.Final | 2.0.75.Final
405405
1.83.x | 4.2.15.Final | 2.0.75.Final
406-
1.84.x- | 4.2.16.Final | 2.0.81.Final
406+
1.84.x | 4.2.16.Final | 2.0.81.Final
407+
1.85.x- | 4.2.17.Final | 2.0.81.Final
407408

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

‎api/src/main/java/io/grpc/ClientStreamTracer.java‎

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,45 @@ public void createPendingStream() {
5858
}
5959

6060
/**
61-
* Called when an attempt-level delay segment (such as waiting for a load balancing pick or
62-
* connection establishment) starts.
61+
* Called when an attempt-level delay (such as waiting for a load balancing pick or connection
62+
* establishment) starts, or when the {@code delayType} of the ongoing delay changes, in which
63+
* case {@link #recordDelayEnd} is called for the previous delay first.
6364
*
64-
* <p>This method is invoked synchronously on the attempt thread. Implementations should start
65-
* internal timers or child tracing spans (named strictly {@code "Attempt Delay"}) carrying the
66-
* canonical {@code grpc.delay_type} attribute.
65+
* <p>Implementations should start a timer and open a child tracing span (named strictly
66+
* {@code "Delay"}) carrying the canonical {@code grpc.delay_type} attribute.
6767
*
6868
* @param delayType canonical low-cardinality label categorizing the delay (e.g., "connecting")
6969
* @param delayReason high-cardinality diagnostic string describing granular runtime conditions
70-
* @since 1.82.0
70+
* @since 1.86.0
7171
*/
72-
public void recordAttemptDelayStart(String delayType, String delayReason) {
72+
public void recordDelayStart(String delayType, String delayReason) {
7373
}
7474

7575
/**
76-
* Called when an attempt-level delay reason changes while the overall delay type remains
77-
* constant (for example, when a priority load balancing policy fails over between tiers).
76+
* Called when an attempt-level delay reason changes while the delay type remains constant (for
77+
* example, when a load balancing policy updates its connection status detail).
7878
*
79-
* <p>Implementations should record structured events (such as {@code "Delay state transition"})
80-
* on the active delay span without recreating the span or resetting cumulative timers.
79+
* <p>Implementations should record a structured event (such as {@code "Delay triggered"}) on
80+
* the active delay span without recreating the span or resetting cumulative timers.
8181
*
82+
* @param delayType canonical low-cardinality label of the ongoing delay
8283
* @param delayReason updated high-cardinality diagnostic string describing new conditions
83-
* @since 1.82.0
84+
* @since 1.86.0
8485
*/
85-
public void recordAttemptDelayReasonChanged(String delayReason) {
86+
public void recordDelayReasonChanged(String delayType, String delayReason) {
8687
}
8788

8889
/**
89-
* Called when an attempt-level delay segment ends upon successful pick or stream creation.
90+
* Called when an attempt-level delay ends upon successful pick or stream creation, or when the
91+
* attempt is cancelled or reaches its deadline while still waiting.
9092
*
91-
* <p>Implementations should simultaneously close active child tracing spans and record elapsed
92-
* duration to the {@code grpc.client.attempt.delay.duration} histogram.
93+
* <p>Implementations should close the active child tracing span and record the elapsed duration
94+
* to the {@code grpc.client.attempt.delay.duration} histogram labeled with {@code delayType}.
9395
*
94-
* @since 1.82.0
96+
* @param delayType canonical low-cardinality label of the delay being ended
97+
* @since 1.86.0
9598
*/
96-
public void recordAttemptDelayEnd() {
99+
public void recordDelayEnd(String delayType) {
97100
}
98101

99102
/**
@@ -156,6 +159,47 @@ public abstract static class Factory {
156159
public ClientStreamTracer newClientStreamTracer(StreamInfo info, Metadata headers) {
157160
throw new UnsupportedOperationException("Not implemented");
158161
}
162+
163+
/**
164+
* Called when a call-level delay (such as waiting for name resolution) starts before any
165+
* individual RPC attempt is created, or when the {@code delayType} of the ongoing delay
166+
* changes, in which case {@link #recordDelayEnd} is called for the previous delay first.
167+
*
168+
* <p>Implementations should start a timer and open a child tracing span (named strictly
169+
* {@code "Delay"}) carrying the canonical {@code grpc.delay_type} attribute.
170+
*
171+
* @param delayType canonical low-cardinality label categorizing the delay (e.g., "resolving")
172+
* @param delayReason high-cardinality diagnostic string describing granular runtime conditions
173+
* @since 1.86.0
174+
*/
175+
public void recordDelayStart(String delayType, String delayReason) {
176+
}
177+
178+
/**
179+
* Called when a call-level delay reason changes while the delay type remains constant.
180+
*
181+
* <p>Implementations should record a structured event (such as {@code "Delay triggered"}) on
182+
* the active call delay span without recreating the span or resetting timers.
183+
*
184+
* @param delayType canonical low-cardinality label of the ongoing delay
185+
* @param delayReason updated high-cardinality diagnostic string describing new conditions
186+
* @since 1.86.0
187+
*/
188+
public void recordDelayReasonChanged(String delayType, String delayReason) {
189+
}
190+
191+
/**
192+
* Called when a call-level delay ends upon successful name resolution, or when the RPC is
193+
* cancelled or reaches its deadline before resolution completes.
194+
*
195+
* <p>Implementations should close the active call delay span and record the elapsed duration
196+
* to the {@code grpc.client.call.delay.duration} histogram labeled with {@code delayType}.
197+
*
198+
* @param delayType canonical low-cardinality label of the delay being ended
199+
* @since 1.86.0
200+
*/
201+
public void recordDelayEnd(String delayType) {
202+
}
159203
}
160204

161205
/**

‎api/src/main/java/io/grpc/EquivalentAddressGroup.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ public final class EquivalentAddressGroup {
6969
@Attr
7070
static final Attributes.Key<Long> ATTR_WEIGHT =
7171
Attributes.Key.create("io.grpc.EquivalentAddressGroup.ATTR_WEIGHT");
72+
/**
73+
* Name associated with individual address, if available (e.g., DNS name).
74+
*/
75+
@Attr
76+
static final Attributes.Key<String> ATTR_ADDRESS_NAME =
77+
Attributes.Key.create("io.grpc.EquivalentAddressGroup.ATTR_ADDRESS_NAME");
7278

7379
private final List<SocketAddress> addrs;
7480
private final Attributes attrs;

‎api/src/main/java/io/grpc/InternalEquivalentAddressGroup.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,10 @@ private InternalEquivalentAddressGroup() {}
3232
*/
3333
public static final Attributes.Key<String> ATTR_BACKEND_SERVICE =
3434
EquivalentAddressGroup.ATTR_BACKEND_SERVICE;
35+
36+
/**
37+
* Name associated with individual address, if available (e.g., DNS name).
38+
*/
39+
public static final Attributes.Key<String> ATTR_ADDRESS_NAME =
40+
EquivalentAddressGroup.ATTR_ADDRESS_NAME;
3541
}

‎api/src/main/java/io/grpc/LoadBalancer.java‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -739,21 +739,29 @@ public static PickResult withNoResult() {
739739
*
740740
* @param delayType low-cardinality root cause label (e.g., "connecting")
741741
* @param delayReason high-cardinality diagnostic string for trace events
742-
* @since 1.82.0
742+
* @since 1.86.0
743743
*/
744744
public static PickResult withNoResult(String delayType, String delayReason) {
745745
Preconditions.checkNotNull(delayType, "delayType");
746746
Preconditions.checkNotNull(delayReason, "delayReason");
747747
return new PickResult(null, null, Status.OK, false, null, delayType, delayReason);
748748
}
749749

750-
/** Returns the delay type label if any. */
750+
/**
751+
* Returns the delay type label if any.
752+
*
753+
* @since 1.86.0
754+
*/
751755
@Nullable
752756
public String getDelayType() {
753757
return delayType;
754758
}
755759

756-
/** Returns the diagnostic delay reason if any. */
760+
/**
761+
* Returns the diagnostic delay reason if any.
762+
*
763+
* @since 1.86.0
764+
*/
757765
@Nullable
758766
public String getDelayReason() {
759767
return delayReason;

‎api/src/main/java/io/grpc/ServerCall.java‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ public void onReady() {}
108108
* callbacks (like {@link #onMessage}, {@link #onHalfClose}). This means the implementation
109109
* does not need internal synchronization to access call-specific state.
110110
*
111+
* <p><strong>Deadlock avoidance:</strong> In some transports (such as Binder transport)
112+
* or when using a direct executor, this callback may be invoked while transport-level
113+
* locks are held. Implementations should avoid acquiring locks that are held by callers of
114+
* {@link ServerCall} methods (such as {@link ServerCall#triggerEvent},
115+
* {@link ServerCall#close}, or {@link ServerCall#request}), and should avoid calling
116+
* {@link ServerCall} methods while holding application-level locks, as this can lead to
117+
* deadlocks from lock-order inversion.
118+
*
111119
* @param event the triggered event.
112120
*/
113121
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/12979")
@@ -280,8 +288,19 @@ public String getAuthority() {
280288
* Triggers a custom event to be processed by the listener.
281289
* The event will be delivered to {@link Listener#onEvent(Object)} on the call's executor.
282290
*
283-
* <p>This method is thread-safe and can be called from any thread. No events will be delivered
284-
* after the RPC is cancelled or completed.
291+
* <p>This method is safe to call from multiple threads without external synchronization. No
292+
* events will be delivered after the RPC is cancelled or completed.
293+
*
294+
* <p><strong>Deadlock avoidance:</strong> Callers should avoid holding application-level or
295+
* interceptor locks when calling this method. Depending on the transport and executor
296+
* configuration (such as {@code directExecutor()} or transports like Binder),
297+
* {@code triggerEvent} may acquire transport-level locks and may dispatch
298+
* {@link Listener#onEvent(Object)} synchronously on the calling thread.
299+
* If the caller holds an application lock while calling {@code triggerEvent}, and
300+
* {@code onEvent} or a concurrent transport operation (such as {@link #close} or
301+
* {@link #request}) attempts to acquire that same lock, a deadlock can occur from
302+
* lock-order inversion. Applications should mutate internal state under lock, release
303+
* the lock, and only then invoke {@code triggerEvent}.
285304
*
286305
* @param event the event to trigger.
287306
*/

0 commit comments

Comments
 (0)