Commit Graph

1389 Commits

Author SHA1 Message Date
Eric Anderson c75d9bc19f core: Fix racy creation/set of the retry Future
This fixes two races: a data race where scheduledRetry is accessed
by cancel() and confusion where scheduledRetry could be set to null by
the schedule()d runnable before it is set by the schedule() return
value.

Although it seems these races can't actually cause problems due to other
conditions/constraints, it's hard to reason about. So let's plug these
preemptively, even if we can't add tests that trigger them.

ScheduledHedging was not specific to hedging, so can now be reused for
this retry case. It was renamed to avoid being misleading.
2019-01-31 16:24:34 -08:00
ZHANG Dapeng d0ecc08705
all: fix lint 2019-01-31 09:31:13 -08:00
Carl Mastrangelo ed0a9f3f1d
netty: support listening on multiple ports 2019-01-29 10:13:40 -08:00
Carl Mastrangelo 27253353e7
core: fix service config prefix matching in Dns
Fixes #5280
2019-01-28 12:46:23 -08:00
Eric Gribkoff ce2ae1fb6c
core: remove channel reference from ManagedChannelWrapper (#5283)
This avoids a memory leak when the channel itself participates in a
reference cycle (e.g., when an interceptor retains a reference to an
Android app's context). With the current implementation, the static
`ManagedChannelOrphanWrapper.refs` map will keep the channel reachable
and prevent the ref cycle from being GCed.
2019-01-25 16:36:04 -08:00
Carl Mastrangelo f6689a1f86
all: fix lint errors 2019-01-25 16:09:59 -08:00
Eric Gribkoff 1d97b50315
core: do not lose status when RST_STREAM with NO_ERROR received (#5264) 2019-01-24 08:50:09 -08:00
Ignacio del Valle Alles 3a38e59bae core: Allow specifying a ProxyDetector per ManagedChannel 2019-01-23 16:57:40 -08:00
Carl Mastrangelo 3d2e375aa1
core: drop VisibleForTesting on ServiceConfigUtil 2019-01-23 15:10:50 -08:00
Eric Anderson 5dbe53c050 core: Remove incorrect usages of VisibleForTesting
The visibility is (correctly) used in non-testing scenarios.
2019-01-15 18:58:43 -08:00
Eric Anderson ca41aeaac9 core: Use Truth's isEmpty/hasSize
It produces clearer result error messages where there are failures.
2019-01-14 17:00:16 -08:00
Eric Anderson bcd2372280 core: disable SRV records lookup
SRV has not yet been enabled in a release. Since work is rapidly
underway to replace GRPC-LB with a service config+XDS-based solution,
there's now thoughts that we won't ever enable grpclb by default (but
may allow it to be automatically enabled when using GoogleDefaultChannel
or similar). Since things are being worked out, disable it.

This effectively reverts c729a0f.
2019-01-11 15:13:33 -08:00
Kun Zhang 1ed196c585
core: promote the new API in CallCredentials2 (#5216)
This is the 3rd step of #4901

- The deprecated `CC.applyRequestMetadata(... Attributes ...)` is now **replaced** by the new API `CC.applyRequestMetadata(... CC.MetadataApplier ...)` transformed from `CC2.applyRequestMetadata(... CC2.MetadataApplier ...)`.
- The Attributes keys in `CallCredentials` were deprecated, and now deleted.
- The deprecated interface `CC.MetadataApplier` is **replaced** by an equivalent abstract class.
- `CallCredentials2` is now marked as deprecated, while keeping its interface intact so that it won't break current implementations that are still on `CallCredentials2`.
- From this point on, implementations should do a one-line change from `extends CallCredentials2` to `extends CallCredentials`
- `GoogleAuthLibraryCallCredentials` is kept as `CallCredentials2` for now, as there is an internal consumer that expects it to be `CallCredentials2`.
2019-01-10 15:16:18 -08:00
Kun Zhang 7475b7f110
core: fix a channel panic bug caused by calling NameResolver.refresh() when it's not started (#5223)
Resolves #5222
2019-01-10 11:28:58 -08:00
Eric Anderson 4adcf24363
Downgrade to Guava 25.1
This is temporary for the 1.18 release to give users a bit more time to
get past the breaking changes to Beta APIs in Guava 26.

Fixes #5166
2019-01-08 16:22:48 -08:00
Eric Anderson e74576b85b Remove old BetaApi failure suppressions
We've been on newer versions of Guava for a while now; these no longer
do anything.

Reworded the comment for Stopwatch.createUnstarted(), because it is not
safe (it doesn't matter if the method isn't marked Beta; you have to use
Ticker), except for the fact it is only used in our tests.
2019-01-08 16:07:40 -08:00
ZHANG Dapeng 4337da6d7d
Start 1.19.0 development cycle 2019-01-02 15:31:01 -08:00
Carl Mastrangelo b6af40e510 examples,netty: fix lint errors 2019-01-02 15:30:31 -08:00
ZHANG Dapeng df21e40285
all: fix lint 2019-01-02 15:28:44 -08:00
Carl Mastrangelo a4859c1e93
core: revert stream tracer order change to fix internal test 2018-12-20 18:45:38 -08:00
David Hoover 87cf40437c core: Mark CallOptions' deadline/executor as @Nullable
They are, but weren't consistently marked like the other members
2018-12-19 15:47:54 -08:00
Carl Mastrangelo 6779a5aa75
core,netty: refactor server builder
* makes Census tracing factories at the end of the user added ones
* makes more vars in AbstractServerImplBuilder package private
* annotates methods in ASIB to be clearer
* simplifies several of the setters to be single line
* Makes the generics on the Tracer factories proper
2018-12-17 17:22:33 -08:00
Carl Mastrangelo 1bf8476cd7
core: standardize logid format and add details for channelz 2018-12-17 17:22:11 -08:00
ZHANG Dapeng 0cf91e333b
core: hide RetriableStream type from ClientTransportProvider 2018-12-12 10:04:39 -08:00
ZHANG Dapeng 07f96f8000
core: fix a typo in javadoc 2018-12-10 10:53:08 -08:00
Kun Zhang c0175e4cbe
core: add LoadBalancer.canHandleEmptyAddressListFromNameResolution() (#5148)
Currently ManagedChannelImpl will interpret empty address list from
NameResolver as an error, and LoadBalancer will NEVER receive an empty
list from handleResolvedAddressGroups().  There is a case in the
request-routing design where a LoadBalancer only receives service
config with which it constructs children NameResolver/LoadBalancer
pairs, thus no address is expected at this level.

canHandleEmptyAddressListFromNameResolution() is a signal to Channel
(and to the parent LoadBalancer in case of hierachical LoadBalancers)
about whether it accepts empty address lists.  The default is false,
which is the current behavior.

The logic is currently duplicated in ManagedChannelImpl and
AutoConfiguredLoadBalancer.  The one in ManagedChannelImpl will be
removed once we delete ManagedChannelBuilder.loadBalancerFactory() as
AutoConfiguredLoadBalancer will always be the top-level LoadBalancer
by then.
2018-12-10 10:18:19 -08:00
Grant Oakley 01f79bb909 core: fix bug in CallOptions#withOption()
Previously, overwriting an existing Key would cause the original CallOptions instance to also be mutated.

See #5142

Also adds a regression test for this issue.
2018-12-07 16:32:02 -08:00
Eric Anderson 1299986999 core: Fix reversed arguments to assertEquals 2018-12-07 11:37:21 -08:00
Kun Zhang 1fbf7bb3a7
core: add ManagedChannelBuilder.defaultLoadBalancingPolicy() (#5135)
ManagedChannelBuilder.loadBalancingFactory() overrides the proper
policy selection logic implemented in AutoConfiguredLoadBalancer, thus
has problems in cases where NameResolver returns balancer addresses,
because custom LoadBalancers normally don't differentiate between
normal server addresses with balancer addresses.  The policy selection
logic will filter out balancer addresses.
2018-12-07 08:30:58 -08:00
Eric Anderson de9bc0bcf1 Specify Locale to toLowerCase and lint fixes 2018-12-06 17:15:48 -08:00
Kun Zhang 4631c0c7e8
core: fix a bug that Channel won't work if NameResolver returns a ServiceConfig without LB config. (#5134) 2018-12-06 16:51:45 -08:00
Kun Zhang 0cc0f2d170
core: do not fail RPCs if balancer address exists but grpclb is unavailable (#5129)
When service owner turns on grpclb through service config, it
shouldn't break existing clients that don't have grpclb in their
classpath.

Resolves #4602
2018-12-06 13:40:30 -08:00
Carl Mastrangelo 2d654496ee
context: make Deadline toString() more readable 2018-12-05 17:44:44 -08:00
Kun Zhang 3a86a176fe
core: add LoadBalancer.Helper.refreshNameResolution() (#5121) 2018-12-05 13:11:45 -08:00
ST-DDT 0dda74dda4 core: Fix deprecation warning in RoundRobinLoadBalancerFactory 2018-12-05 10:03:02 -08:00
ZHANG Dapeng 0c95dad0da
core: fix bazel NameResolverProvider not found 2018-12-05 09:45:41 -08:00
Kun Zhang 5054aefe03
core: support LoadBalancingConfig from Service Config (#5073) 2018-12-04 16:56:06 -08:00
Kun Zhang b5acbedd55
core: record real-time metrics to OpenCensus (updated to 1.18.0) (#5099)
Real-time metrics are total sent/received bytes and messages per
method, and are updated as the events occur rather than at the end of
RPCs.
2018-11-29 16:30:58 -08:00
Kun Zhang 2961857451
core: refactor flags in CensusStatsModule. (#5095)
There are currently three boolean flags, and there will be one more
soon.  Put them all in the top-level class instead of passing them as
arguments on lower levels.
2018-11-28 14:20:40 -08:00
Kun Zhang 98ae834dfa
core: use SynchronizationContext.schedule() for NameResolver refresh (#5089)
This also fixes the bug where NameResolverRefresh is not run from
syncContext if run from ScheduledExecutorService.
2018-11-28 09:42:29 -08:00
Kun Zhang 3ff4790212
core: allow ClientStreamTracer to intercept trailers. (#5088)
This would allow LoadBalancers to intercept trailers which could carry
load information.
2018-11-27 12:47:31 -08:00
Kun Zhang c8b2cdc023
core/services: test/debug friendlier (#5079)
Raise visibility of AutoConfiguredLoadBalancerFactory as internal
tests need to access it from a different package.

Rename HealthCheckingLoadBalancerFactory.LoadBalancerImpl to
*.HealthCheckingLoadBalancer so that its toString() output is more
informative.
2018-11-21 10:45:18 -08:00
Kun Zhang 268793f321
core: add (de)register() in LoadBalancerRegistry. (#5070) 2018-11-20 12:07:31 -08:00
zpencer 777bbbb121
core: TimeProvider should not assume that the clock never changes (#4883)
We should reflect changes in the system clock.
2018-11-20 11:34:58 -08:00
ZHANG Dapeng 6b15aa9e4e
core: implement hedging 2018-11-20 09:38:01 -08:00
Jihun Cho 1506135333 Start 1.18.0 development cycle 2018-11-19 14:49:35 -08:00
Eric Anderson 033cf21118 core: Explicitly mention MCB.intercept's execution order
New users are much more likely to use MCB to add an interceptor instead
of ClientInterceptors, so may not be aware of the interesting execution
order.
2018-11-19 11:02:44 -08:00
Jihun Cho ab5257504b
core: use fakeClock in MessageDeframer tests to fix flaky test (#5055) 2018-11-14 15:13:10 -08:00
Kun Zhang 5b87e99622
core: move round-robin to util and include it to hard-coded list (#5057)
This is needed for internal issue b/119247688.

A particular test that runs GRPC Android build in a non-Android
environment failed because RoundRobinLoadBalancerProvider was deleted
by ProGuard but the service-loader META-INF file still referred to it,
causing a loading failure.

This could be fixed by adding RoundRobinLoadBalancerProvider to the
hard-coded list, which is recognized by ProGuard then it will keep the
class.

However, we don't expect anyone to use RoundRobinLoadBalancerProvider
on Android, including the class on Android would increase code size,
which Android apps are sensitive to. Hence we move
RoundRobinLoadBalancerProvider to a different package (util), which is
built as a separate artifact internally which Android users usually
don't depend on. (Note that in open-source util is in the same artifact as core,
which is unfortunately).
2018-11-13 17:06:01 -08:00
Rodrigo Queiro 8481943866 Add missing j2objc dependency to Bazel build
This avoids a warning when building artifacts that depend on Guava.

Fixes #5046.
2018-11-13 13:39:35 -08:00