Commit Graph

6877 Commits

Author SHA1 Message Date
Abhishek Agrawal d0db129739 Bump version to 1.76.0 2025-10-06 15:52:15 +00:00
Abhishek Agrawal aa672ca125 Update README etc to reference 1.76.0 2025-10-06 15:41:59 +00:00
Eric Anderson 70b7249da8 netty: Unconditionally disable adaptive cumulator (#12390)
io.netty.util.Version is unreliable, so we stop using it. grpc-netty and
grpc-netty-shaded have their version.properties mix, and you can't tell
which is which.

Changed the tests to use assume, so it is clear in the results that they
weren't run.
2025-10-01 11:13:47 -07:00
Alex Panchenko f89d1d8fd4 api: remove nullable from StatusOr value methods (#12338)
It someone wants it nullable, that should be defined via the type
parameter, e.g. `StatusOr<@Nullable Foo> foo`
2025-10-01 11:13:34 -07:00
Eric Anderson 040665f243 examples: Explain Bazel BCR releases and git_override option 2025-09-19 13:23:49 -07:00
Eric Anderson 4995700069 xds: Remove verify TODO for onResult2 error status
This had been accidentally left in 0c179e3f9.

Requesting a refresh is pretty close to RetryingNameResolver's behavior
of exponential backoff. While not identical, it is the closest we can
get easily.
2025-09-19 08:23:51 -07:00
Eric Anderson afe72220d0
SECURITY.md: Mention gcompat for Alpine (#12365)
In the olden days Alpine didn't work at all. Then it worked. And then
sometime in 2021 it started failing (#8751) because of missing
__strndup. The most recent deep investigation showed it is missing
__strdup these days
https://github.com/grpc/grpc-java/issues/11660#issuecomment-2469284111 .

I'm not expecting too many people to find this themselves, but we can
link to it when they experience problems.
2025-09-19 11:25:53 +05:30
dmytroreutov 1a7042ac98
android: fix network change handling on API levels < 24
Fixes https://github.com/grpc/grpc-java/issues/12313

In case if VPN toggled on<->off `wasConnected` returns true and
`delegate.enterIdle()` is skipped.
2025-09-18 12:51:25 -07:00
Patrick Strawderman 8f0db07d5d
api: Avoid allocating empty array in LoadBalancer (#12337)
Use a singleton empty Object array to initialize the customOptions
default in LoadBalancer.Builder.
2025-09-18 12:43:40 -07:00
Eric Anderson 0c179e3f9e
xds: Convert ClusterResolverLb to XdsDepManager
No longer need to hard-code pick_first because of gRFC A61.
https://github.com/grpc/proposal/pull/477
2025-09-18 11:08:43 -07:00
Eric Anderson 4b5ce99b02 binder: Fix synchronization instead of suppressing GuardedBy
There's no reason why we shouldn't just have proper synchronization
here, even if only used in tests. We shouldn't get into the habit of
suppressing them.
2025-09-17 11:36:16 -07:00
Kannan J ead6a54602
binder: Suppress GuardedBy("this") warning for test access (#12362)
Co-authored-by: MV Shiva <speakupshiva@gmail.com>
2025-09-16 15:00:43 +05:30
Alex Panchenko d163c063b9
servlet: add extra 5s to AsyncContext timeout (#12321)
Currently there is a race between 2 tasks scheduled to handle request
timeout
* servlet AsyncContext timeout
* gRPC Context

which can cause instability. This change makes the gRPC Context timeout happen first.
2025-09-16 10:20:11 +05:30
Alex Panchenko 6f21bc2e6c
servlet: configurable methodNameResolver (#12333)
Introduces configuring a method name resolver in `ServletServerBuilder` for customizing the servlet context root path for request paths.
2025-09-16 09:17:18 +05:30
Umair Khan 6fae71b740
netty: disable Huffman coding in server response headers (#12357)
Follow up to PR #10563

Previously, we disabled Huffman encoding on the `NettyClientHandler` to
improve header encoding performance. This change also ensures
consistency in the header encoding strategy across both client and
server components.
2025-09-15 18:17:47 +05:30
Sangamesh c1f3287601
util: Fix misleading exception in AdvancedTlsX509TrustManager when cert file is missing (#12353) 2025-09-15 18:04:09 +05:30
Benjamin Peterson 53d81116c5
stub: fix typo in method name (#12356) 2025-09-15 09:39:17 +05:30
MV Shiva fe54dd618d
Add support for macOS aarch64 with universal binary (#12319) 2025-09-13 13:37:32 +05:30
MV Shiva 866d226c14
compiler: Mangle generated method names that conflict with java.lang.Object methods (#12332)
Generated gRPC method names in the BlockingV2Stub can conflict with
final methods on `java.lang.Object` (e.g., `toString()`, `hashCode()`)
for client-streaming and bidi-streaming RPCs. This occurs because
they are generated with no arguments, leading to a compilation error.
One such case in #12331.

This change introduces a dedicated list of no-argument method names
from java.lang.Object and applies name-mangling (appending an
underscore) only when generating these specific methods in the
v2 blocking stub.

This resolves the compilation failure while ensuring that the behavior
for all other stubs remains unchanged.

Fixes: #12331
2025-09-13 11:54:48 +05:30
John Cormie e91378cf96
binder: Only accept post-setup transactions from the server UID we actually authorize. (#12359) 2025-09-12 16:23:54 -07:00
John Cormie 7d6ea288a2
Add a basic SocketStats with just the local and remote addresses. (#12349)
This will make channelz more useful.
2025-09-11 08:13:56 -07:00
jiangyuan b2a95cae72
netty, okhttp: Add allow header for response code 405 (#12334)
Fixes #12329
2025-09-10 17:39:33 +05:30
Abhishek Agrawal d4e1b69e78
otel: subchannel metrics A94 (#12202)
Implements [A94](https://github.com/grpc/proposal/pull/485/files) except for the exact reason for disconnect_error
2025-09-09 03:25:40 +05:30
Sangamesh 5a543726fd
android-interop-testing : Fix lint warnings in android-interop and binder modules (#12272)
Fixes #6868
2025-09-04 11:25:04 +05:30
Eric Anderson 01f2862b90 xds: Pretty-print Resource in logs
Noticed at b/431017968#comment31
2025-09-03 20:30:18 -07:00
Eric Anderson b3390227ae Remove org.apache.tomcat:annotations-api dep
f8700a1 stopped using the dependency in our generated code and removed
the dependency the Bazel build. 4f6948f removed mention of the
dependency in our README. This deletes it from our Gradle build and the
examples.
2025-09-03 07:18:18 -07:00
MV Shiva 9746bb4bc3
allow java21 in jre matrix (#12281) 2025-09-01 13:10:09 +05:30
zrlw d9509b5bb3
Upgrade guava version to 33.4.8 (#12219)
Guava seems to call a deprecated sun.misc.Unsafe::objectFieldOffset
method which might be removed in a future JDK release.
There are still a few things to do for -android versions, which are
tracked in https://github.com/google/guava/issues/7742,
see details at google/guava#7811

Fixes #12215
2025-08-29 14:01:11 -07:00
Kannan J 4f6948f594
Remove org.apache.tomcat:annotations-api from README (#12320)
With the default @generated=omit option used by grpc-compiler, it is no longer necessary to have the compile-only dependency on org.apache.tomcat:annotations-api.
2025-08-29 12:00:22 +05:30
Hongxu Xu 3d5eff99ec
bazel: remove unnecessary build deps (#12310) 2025-08-28 16:12:16 -07:00
Lam Gia Thuan 7322c075ba
bazel: Use java/proto rules from rules_java/rules_proto instead of native rules
It's discouraged in modern Bazel to use native rules and will make it
difficult for modules dependent on grpc-java to fully migrate to new
versions of Bazel (like grpc-kotlin).

For example, try building this repo using:

```bash
$ bazelisk build ... --incompatible_autoload_externally=
```

It will fail.

**IMPORTANT**: Now you still see errors after this commit, but it's
better because the errors come from `@protobuf`, not `@grpc-java`.
2025-08-28 16:07:14 -07:00
John Cormie ad5c6d5575
binder: Replace queryIntentServices() hack with the new SystemApis.createContextAsUser() (#12280)
createContextAsUser() wrapper makes the call to PackageManager's
resolveService() look the same in both the same-user and cross-user
cases. This is how the Android team recommends accessing XXXAsUser() APIs in
general.

We can also remove all the apologies for using reflection since
SystemApis already explains all that.
2025-08-28 15:58:39 -07:00
Eric Anderson cdd3202a1f interop-testing: Show full status for interop test failures
It's pretty annoying to see a test failure with
"expected:<DEADLINE_EXCEEDED> but was:<INTERNAL>" and not know the
description or throwable cause of the status. Introduce a convenience to
include the full status on unexpected Status.Code. There were two
usages of assertWithMessage() that did give nice errors; those were
converted to this new utility.

It'd be even better to make a StatusSubject, but that'd take more time
and this was easy and still an improvement. This was created because
we're seeing servlet test failures with INTERNAL code, and we need to
see the details.
2025-08-28 07:55:02 -07:00
John Cormie c643e68aa1
binder: REMOTE_UID must hold exactly the uid passed to the SecurityPolicy and never change (#12314)
`attributes = setSecurityAttrs(attributes, remoteUid);` should not run
for :
- a malformed SETUP_TRANSPORT transaction
- a rogue SETUP_TRANSPORT transaction that arrives
post-TransportState.SETUP
2025-08-28 01:06:48 -07:00
Alex Panchenko afef4fe097
servlet: extract ServletServerStream.serializeHeaders() method (#12299) 2025-08-27 20:57:10 -07:00
Eric Anderson 695014adfd api: Reduce allocations of Attributes.Builder
Modifying existing Attributes was virtually guaranteed to allocate
within build(), just because `base` was not considered for the new map
size. Discard was also allocation-heavy because it often created a new
map. Using a regular copy-on-write approach is enough to avoid the
unnecessary allocations in both cases.

This was noticed in a profile that included xds's
AddressFilter.setPathFilter(), where Attributes.Builder.build()
allocated 6x the memory of Attributes.Builder.data().

b/435208946#comment41
2025-08-26 06:53:38 -07:00
John Cormie ca8f4dfa6d
binder: Improve error descriptions for ServiceConnection callbacks (#12263)
Non-experts don't really know what these ServiceConnection callback
names mean (eg b/437170499). Use the Status description to explain them
a bit. Compare to https://github.com/grpc/grpc-java/pull/11628
2025-08-26 15:57:49 +05:30
Alex Panchenko 8ac5599b92
servlet: fix threadingTest and update lincheck (#12306)
Seems like previously it was not testing all the flows but only: the
write/flush calls are added to the queue by `runOrBuffer` because
`readyAndDrained` is initially `false`.

So,
* `isReady()` is never called
* `isReadyReturnedFalse` never set to true
* `maybeOnWritePossible()` does nothing

All that makes me think that #9917 is caused by some bugs in older
versions of llincheck, can be closed now.

A more real simulation happens if calling `onWritePossible` first via
`initialOnWritePossible`, and then it has found a race condition in
`AsyncServletOutputStreamWriterConcurrencyTest.isReady()`, if
`maybeOnWritePossible()` is executed before `return isReady`.

Additionally updated lincheck, 
* it does not need jvmArgs now 
* is compatible with java 8 again
* changed asserts from Truth to junit, as lincheck was trying to use
`com.google.common.truth.Subject.equals(Object)`

It still does not detect #12268, but might be needs more time.
2025-08-25 16:25:46 -07:00
Alex Panchenko 2ba5c3d2a3
servlet: skip AsyncContext.complete() when already completed (#12296)
Currently `AsyncContext.complete()` is called multiple times in some
flows, e.g. when DEADLINE_EXCEEDED, and that results in
IllegalStateException from servlet container (Tomcat).
If counting IllegalStateException from the tests of the servlet module
here - the number of those is reduced significantly, a few cases still
left, would bet addressed separately.
2025-08-25 13:05:06 -07:00
Alex Panchenko f5b111708b
servlet: fix unpark() of onWritePossible() thread
This should fix #12268
2025-08-25 12:56:56 -07:00
Kannan J c7202c0db5
Bump readme (#12305) 2025-08-24 18:21:52 +05:30
Eric Anderson 028afbe352
xds: Implement equals in WRRLBConfig
Just an is a8de9f0, lack of equals causes cluster_resolver to consider every update a different configuration and restart itself.

Handling NaN should really be prevented with validation, but it looks like that
would lead to yak shaving at the moment.

b/435208946
2025-08-22 08:07:51 -07:00
John Cormie afdbecb235
binder: Move BinderTransport's inner classes to the top level (#12303)
BinderTransport.java was getting too long and deeply nested.

This is a pure refactor with no behavior changes.
2025-08-21 16:08:58 -07:00
MV Shiva 2039266ebc
xds: xdsClient caches transient error for new watchers (#12262) 2025-08-19 21:41:52 +05:30
Jiri Kaplan 43bef65cf9 netty: Support BCJSSE provider in GrpcSslContexts 2025-08-19 07:17:57 -07:00
Eric Anderson 437e03dc98
xds: Avoid PriorityLb re-enabling timer on duplicate CONNECTING (#12289)
Since c4256add4 we no longer fabricate a TRANSIENT_FAILURE update from
children. However, previously that would have set
seenReadyOrIdleSinceTransientFailure = false and prevented future timer
creation. If a LB policy gives extraneous updates with state CONNECTING,
then it was possible to re-create failOverTimer which would then wait
the 10 seconds for the child to finish CONNECTING. We only want to give
the child one opportunity after transitioning out of READY/IDLE.

https://github.com/grpc/proposal/pull/509
2025-08-19 12:53:47 +05:30
Eric Anderson 6462ef9a11 netty: Count sent RST_STREAMs against limit
Http2RstCounterEncoder has to be constructed before
NettyServerHandler/Http2ConnectionHandler so it must be static. Thus the
code/counters were moved into RstStreamCounter which then can be
constructed earlier and shared.

This depends on Netty 4.1.124 for a bug fix to actually call the
encoder:
be53dc3c9a
2025-08-18 07:23:34 -07:00
Eric Anderson 95d16d85c8 Upgrade to Netty 4.1.124.Final
This implicitly disables NettyAdaptiveCumulator (#11284), which can have a
performance impact. We delayed upgrading Netty to give time to rework
the optimization, but we've gone too long already without upgrading
which causes problems for vulnerability tracking.
2025-08-13 14:23:14 -07:00
Sangamesh f50726d32e
android: Clean up android lint and other warnings (#12143)
Worked on clearing the lint warnings (OldTargetApi, ObsoleteSdkInt,
InlinedApi, NewApi)

Fixes #12142
2025-08-11 15:18:01 -07:00
Eric Anderson 06707f7c38 xds: Use a different log name for XdsClientImpl and ControlPlaneClient
Seems like a good time to stop hating ourselves, as that seems to be the
only reason to use the same string.
2025-08-08 14:23:43 -07:00