Commit Graph

1998 Commits

Author SHA1 Message Date
Eric Anderson c120e364d2 core: PF Index.size() should be number of addresses
This would impact TRANSIENT_FAILURE and refreshNameResolver() logic for
dual-stack endpoints.
2024-08-17 08:54:18 -07:00
Eric Anderson ff8e413760
Remove direct dependency on j2objc
Bazel had the dependency added because of #5046, where Guava was
depending on it as compile-only and Bazel build have "unknown enum
constant" warnings. Guava now has a compile dependency on j2objc, so
this workaround is no longer needed. There are currently no version skew
issues in Gradle, which was the only usage.
2024-08-13 21:33:55 -07:00
Petr Portnov | PROgrm_JARvis 40e2b165b7
Make once-set fields of `AbstractClientStream` `final` (#11389) 2024-08-08 10:48:12 +05:30
Kurt Alfred Kluever 06135a0745 Migrate from the deprecated `Charsets` constants (in Guava) to the `StandardCharsets` constants (in the JDK)
cl/658539667
2024-08-05 13:31:08 -07:00
Eric Anderson 9bed655c56 Revert "Netty upgrade to 4.1.110 in grpc-java (#11273)"
This reverts commit f9b072cfe2.

Changes from the release process got mixed in with the commit.
2024-08-02 15:30:31 -07:00
Eric Anderson 15456f8f0a core: In PF, pass around SubchannelData instead of Subchannel
Each usage of the subchannel immediately looked up the SubchannelData.
2024-08-02 14:23:25 -07:00
Kannan J f9b072cfe2
Netty upgrade to 4.1.110 in grpc-java (#11273)
* Bump Netty to 4.1.110.Final.
2024-08-03 01:05:44 +05:30
Eric Anderson e567b4427a
core: Don't reuse channels in PickFirstLeafLB test
PickFirstLeafLB uses channel reference equality to see if it has
re-created subchannels. The tests reusing channels breaks the expected
invariant.
2024-08-02 11:40:02 -07:00
Kurt Alfred Kluever 00136096ed Migrate from the deprecated Charsets constants (in Guava) to the StandardCharsets constants (in the JDK).
cl/658546708
2024-08-02 09:54:05 -07:00
Eric Anderson 780e4ba086 api: Move ClientStreamTracerTest from core to api
It uses nothing from core and tests an api class.
2024-08-02 09:06:04 -07:00
Kannan J 90d0fabb1f
Introduce onResult2 in NameResolver Listener2 that returns Status
Lets the Name Resolver receive the status of the acceptance of the name resolution by the load balancer.
2024-08-02 20:40:31 +05:30
Larry Safran cc1cbe9871
Revert "Enable new PickFirst LB (#11348)" (#11425)
This reverts commit ccfd351a2e.
2024-08-01 11:30:36 -07:00
Eric Anderson ebffb0a6b2 Revert "Introduce onResult2 in NameResolver Listener2 that returns Status (#11313)"
This reverts commit 9ba2f9dec5.

It causes a channel panic due to unimplemented onResult2().

```
java.lang.UnsupportedOperationException: Not implemented.
        at io.grpc.NameResolver$Listener2.onResult2(NameResolver.java:257)
        at io.grpc.internal.DnsNameResolver$Resolve.lambda$run$0(DnsNameResolver.java:334)
        at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:94)
        at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:126)
	at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333)
```

b/356669977
2024-07-31 14:16:01 -07:00
Kannan J 0090a526d7
Start 1.67.0 development cycle (#11416) 2024-07-31 11:13:59 +05:30
Kannan J 9ba2f9dec5
Introduce onResult2 in NameResolver Listener2 that returns Status (#11313)
Introducing NameResolver listener method "Status Listener2::onResult2(ResolutionResult)" that returns Status of the acceptance of the name resolution by the load balancer, and the Name Resolver will call this method for both success and error cases.
2024-07-26 15:43:36 +05:30
Eric Anderson 7ba293f49f
Upgrade ErrorProne Core to 2.28.0 2024-07-12 14:59:20 -07:00
Eric Anderson 47aa7b9bca Upgrade Checkstyle to 10.17.0
The code changes are to place all overloaded methods next to each other.
2024-07-09 08:12:33 -07:00
João Vitor Stein 062ebb4d77
grpc-core: use retryThrottling from defaultServiceConfig 2024-07-03 08:19:22 -07:00
Benjamin Peterson 6e25c03a7b core: remove GrpcUtil.getHost
This utility is not relevant on supported JDK versions anymore.
2024-07-02 08:18:03 -07:00
Larry Safran ccfd351a2e
Enable new PickFirst LB (#11348) 2024-06-28 16:30:54 -07:00
Larry Safran 0b68eff120
core:Change address deduping to be across EAGs (#11345)
* Change dedup to be cross EAG, not just within an EAG
2024-06-28 14:58:50 -07:00
Larry Safran 7a53fa8bc1
Dualstack interop testing enablement (#11231)
* Have java test server listen on appropriate address based upon new optional flag "address_type"
2024-06-27 16:37:48 -07:00
Larry Safran 3777c303f5
deduplicate addresses within a single EAG (#11342) 2024-06-27 16:12:24 -07:00
Vindhya Ningegowda 4849e0a191
core: Add label values size validation in MetricRecorder (#11306)
Enhance MetricRecorder: Validate label values count against registered label keys count for default record APIs
2024-06-21 17:06:55 -07:00
Larry Safran 9b39b3ec6b
Eliminate NPE after recovering from a temporary name resolution failure. (#11298)
* Eliminate NPE after recovering from a temporary name resolution failure.

* Add test case for 2 failing subchannels to make sure it causes channel to go into TF.
2024-06-21 13:20:44 -07:00
Eric Anderson 47249c5f00 Start 1.66.0 development cycle 2024-06-07 10:33:57 -07:00
Eric Anderson b2731f27ad core: Delete AbstractTransportTest.clientShutdownBeforeStartRunnable
The test was added in e4e7f3a06 when InProcess stopped returning a
Runnable from start(). In c5a63a1 we realized (indirectly) that there's
no point in using the Runnable any more.

This test failed with Binder (which seems to have been using the
Runnable unnecessarily), and InProcess, Netty, and OkHttp don't use the
Runnable. Instead of fixing it, we'll just move toward stopping using
Runnable.

I'm not removing the Runnable usage from Binder in this commit because
this test is currently causing CI failures and I don't want to do a
behavior change when fixing it.
2024-06-04 13:43:14 -07:00
Eric Anderson c5a63a16a7 core: Remove "can't call transport listener from start()" restriction
This hasn't been needed since f8f569e07, when InternalSubchannel stopped
calling start() with a lock held. Note that also means no transport
needs to return a Runnable (but some still are).

I had noticed in e4e7f3a06 that it was safe for InProcess to call the
listener directly within start(), but I didn't notice this Javadoc that
said it wasn't allowed.
2024-06-04 11:26:08 -07:00
Eric Anderson e4e7f3a068
inprocess: Fix listener race if transport is shutdown while starting
Returning the runnable did nothing, as both the start method and the
runnable are run within the synchronization context. I believe the
Runnable used to be required in the previous implementation of
ManagedChannelImpl (the lock-based implementation before we created
SynchronizationContext).

This fixes a NPE seen in ServerImpl because the server expects proper
ordering of transport lifecycle events.
```
Uncaught exception in the SynchronizationContext. Panic!
java.lang.NullPointerException: Cannot invoke "java.util.concurrent.Future.cancel(boolean)" because "this.handshakeTimeoutFuture" is null
	at io.grpc.internal.ServerImpl$ServerTransportListenerImpl.transportReady(ServerImpl.java:440)
	at io.grpc.inprocess.InProcessTransport$4.run(InProcessTransport.java:215)
	at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:94)
```

b/338445186
2024-05-28 15:47:15 -07:00
Eric Anderson 107fdb4b7c core: Make RPC buffering comment more clear
It wasn't entirely clear what "it" referred to.
2024-05-28 15:26:13 -07:00
Eric Anderson 018917ae59 core: Restore optimization for InProcess RPC order
fea577c80 disabled an optimization that some tests notice, as it can
change execution order. This restores the old behavior, at slight
expense to seeing relationship between in-use tracking and idle mode.
2024-05-24 13:02:17 -07:00
Eric Anderson 960012d76e api: Add ClientStreamTracer.inboundHeaders(Metadata)
This will be used by the metadata exchange of CSM. When recording
per-attempt metrics, we really need per-attempt data and can't leverage
ClientInterceptors.
2024-05-24 11:28:40 -07:00
Eric Anderson fea577c804
core: Exit idle mode when delayed transport is in use
8844cf7b8 triggered a regression where a new RPC wouldn't cause the
channel to exit idle mode, if an RPC was still progressing on an old
transport. This was already possible previously, but was racy.
8844cf7b8 made it less racy and more obvious.

The two added `exitIdleMode()` calls in this commit are companions to
those in `enterIdleMode()`, which detect whether the channel should
immediately exit idle mode.

Noticed in cl/635819804.
2024-05-23 14:45:38 -07:00
Eric Anderson db96219be1
core: Remove direct test dependency on inprocess
An inprocess class was just being abused. Note that grpc-testing depends
on inprocess, so there is still an indirect dependency on inprocess
present.
2024-05-22 14:50:26 -07:00
Eric Anderson 8844cf7b87 core: Fully delegate picks to DelayedClientTransport
DelayedClientTransport already had to handle all the cases, so
ManagedChannelImpl picking was acting only as an optimization.
Optimizing DelayedClientTransport to avoid the lock when not queuing
makes ManagedChannelImpl picking entirely redundant, and allows us to
remove the duplicate race-handling logic.

This avoids double-picking when queuing, where ManagedChannelImpl does a
pick, decides to queue, and then DelayedClientTransport re-performs the
pick because it doesn't know which pick version was used. This was
noticed with RLS, which mutates state within the picker.
2024-05-14 11:37:14 -07:00
Eric Anderson 7a663f633c api: Hide internal metric APIs
Some APIs were marked experimental but had internal APIs in their
surface. These were all changed to internal. And then the internal APIs
were mostly hidden from generated documentation.

All these APIs will eventually become public and maybe even stable. But
they need some iteration before we're ready for others to start using
them.
2024-05-08 10:24:24 -07:00
Larry Safran 59b189bf91
Change HappyEyeballs and new pick first LB flags default value to false (#11120)
* Change HappyEyeballs flag default value to false since some G3 users are seeing problems.
Put the flag logic in a common place for PickFirstLeafLoadBalancer & WRR's test.

* Set expected requestConnection count based on whether happy eyeballs is enabled or not

* Disable new PickFirstLB

* Fix test expectations to handle both new and old PF LB paths.
2024-05-08 10:08:23 -07:00
hakusai22 6ec744f2a0
Fix various typos (#11144) 2024-05-06 20:29:44 -07:00
Eric Anderson 354b028cae
Add gauge metric API and Otel implementation
This is needed by gRFC A78 for xds metrics, and for RLS metrics. Since
gauges need to acquire a lock (or other synchronization) in the
callback, the callback allows batching multiple gauges together to avoid
acquiring-and-requiring such locks.

Unlike other metrics, gauges are reported on-demand to the MetricSink.
This means not all sinks will receive the same data, as the sinks will
ask for the gauges at different times.
2024-05-06 11:38:04 -07:00
Eric Anderson ca35577327 Add internal channel builder API to get target
This will be used for gRFC A66's OTel per-RPC metric label:

> `grpc.target` : Canonicalized target URI used when creating gRPC
> Channel, e.g. "dns:///pubsub.googleapis.com:443",
> "xds:///helloworld-gke:8000". Canonicalized target URI is the form
> with the scheme included if the user didn't mention the scheme
> (`scheme://[authority]/path`).

The majority of the changes are to move target computation from
ManagedChannelImpl into the builder. A small hack API was added to
ManagedChannelBuilder to get the target to create an interceptor.
2024-05-06 10:53:46 -07:00
Eric Anderson c368a0f9f8
Migrate GlobalInterceptors to ConfiguratorRegistry
This should preserve all the existing behavior of GlobalInterceptors as
used by grpc-gcp-observability, including it disabling the implicit
OpenCensus integration.

Both the old and new API are internal. I hid Configurator and
ConfiguratorRegistry behind Internal-prefixed classes, like had been
done with GlobalInterceptors to further discourage use until the API is
ready.

GlobalInterceptorsTest was modified to become ConfiguratorRegistryTest.
2024-05-06 07:27:41 -07:00
Vindhya Ningegowda 13a929025b
Add MetricSink implementation for gRPC OpenTelemetry
This adds the following components that are required for gRPC A79
non-per-call metrics architecture.

- MetricSink implementation for gRPC OpenTelemetry
- Configurator for plumbing per call metrics ClientInterceptor and
  ServerStreamTracer.Factory via unified OpenTelemetryModule.
2024-05-03 10:45:46 -07:00
Terry Wilson 64ae9f057a
Start 1.65.0 development cycle (#11143) 2024-05-01 16:58:08 -07:00
Eric Anderson 4561bb5b80 Plumb target to load balancer
gRFC A78 has WRR and pick-first include a `grpc.target` label, defined
in A66:

> `grpc.target` : Canonicalized target URI used when creating gRPC
> Channel, e.g. "dns:///pubsub.googleapis.com:443",
> "xds:///helloworld-gke:8000". Canonicalized target URI is the form
> with the scheme included if the user didn't mention the scheme
> (`scheme://[authority]/path`). For channels such as inprocess channels
> where a target URI is not available, implementations can synthesize a
> target URI.
2024-05-01 09:19:45 -07:00
Eric Anderson 4c78a9746c
Plumb optional labels from LB to ClientStreamTracer
As part of gRFC A78:

> To support the locality label in the per-call metrics, we will provide
> a mechanism for LB picker to add optional labels to the call attempt
> tracer.
2024-04-29 16:30:51 -07:00
Vindhya Ningegowda 795ee0f6e3
Add MetricRecorder implementation (#11128)
* added MetricRecorderImpl and unit tests for MetricInstrumentRegistry

* updated MetricInstrumentRegistry to use array instead of ArrayList

* renamed record<>Counter APIs to add<>Counter. Added check for mismatched label values

* added lock for instruments array
2024-04-26 13:47:55 -07:00
Laglangyue 52e65ec0d8
minor: remove the unnecessary final,static (#11098) 2024-04-18 15:26:01 -07:00
Sergii Tkachenko e490273edd
netty: Handle write queue promise failures (#11016)
Handles Netty write frame failures caused by issues in the Netty
itself.

Normally we don't need to do anything on frame write failures because
the cause of a failed future would be an IO error that resulted in
the stream closure.  Prior to this PR we treated these issues as a
noop, except the initial headers write on the client side.

However, a case like netty/netty#13805 (a bug in generating next
stream id) resulted in an unclosed stream on our side. This PR adds
write frame future failure handlers that ensures the stream is
cancelled, and the cause is propagated via Status.

Fixes #10849
2024-04-16 16:27:51 -07:00
David Burns 00649913b0
bazel: Use the `artifact` macro for loading maven deps
The recommended way to load dependencies from `rules_jvm_external`
is to make use of the `@maven` workspace, and the most readable
way of doing that is to use the `artifact` macro provides.

This removes the need to generate the "compat" namespaces, which
`rules_jvm_external` provided for backwards compatibility with
older releases. This change also sets things up for supporting
`bzlmod`: this requires all workspaces accessed by a library to
be named "up front" in the `MODULE.bazel` file. This way, the
only repo that needs to be exported is `@maven`, rather than the
current huge list.
2024-03-28 14:33:32 -07:00
Larry Safran 4ef1baddd2
core: Remove useless ExperimentalApi annotation from pick first
PickFirstLeafLoadBalancer is in internal and also isn't public.
2024-03-28 08:07:53 -07:00