Граф коммитов

348 Коммитов

Автор SHA1 Сообщение Дата
lyuxuan 4748a040c8
balancer: provide parsed target through BuildOptions (#2803) 2019-05-09 13:27:41 -07:00
Weiran Fang 776edd3ba1 interceptor: new APIs for chaining client interceptors. (#2696) 2019-04-15 11:13:34 -07:00
David Drysdale d37bd82db6 Fix DialContext when using a timeout (#2737)
Fixes #2736
2019-04-04 09:58:15 -07:00
lyuxuan ea5e6da287
service config: default service config (#2686) 2019-04-03 10:50:28 -07:00
lyuxuan 955eb8a3c8
channelz: cleanup channel registration if Dial fails (#2733) 2019-04-02 15:42:35 -07:00
Doug Fawley 3910b873d3
bar: add ability to update resolver state atomically and pass directly to the balancer (#2693) 2019-03-22 10:48:55 -07:00
Jean de Klerk d021e89b3f
internal: fix Dial_OneBackoffPerRetryGroup (#2689)
* internal: fix Dial_OneBackoffPerRetryGroup

Instead of mutating global variables, switches getMinConnectDeadline to a
dial option.

Fixes #2687.

* rename getMinConnectTimeoutFunc to minConnectTimeout, ditto dial opt
2019-03-20 13:58:29 -06:00
Menghan Li fba6715d1c
addrConn: resetTransport loop cleanup (#2676)
Refactor retry loop after #2673
2019-03-19 10:28:26 -07:00
Doug Fawley 3c84def893
balancer: remove Header from PickOptions; it is also available through context (#2674) 2019-03-15 09:00:55 -07:00
Menghan Li 3958fc86cc
addrConn: resetTransport cleanup (#2673) 2019-03-14 13:14:19 -07:00
Menghan Li 5abb35752c
client: reset backoff to 0 after a connection is established (#2669)
#2663
#2636
2019-03-08 10:16:19 -08:00
Jean de Klerk 5878d965b2
transport: remove RequireHandshakeHybrid support (#2529)
This removes RequireHandshakeHybrid support and changes the default behavior
to RequireHandshakeOn. Dial calls will now block and wait for a successful
handshake before proceeding. Users relying on the old hybrid behavior (cmux
users) should consult https://github.com/soheilhy/cmux/issues/64.

Also, several tests have been updated to take this into consideration by
sending settings frames.
2019-02-27 11:04:46 -07:00
Menghan Li 1dbad57dad
internal: delete an info log (#2640)
This log doesn't print much useful information, and causes flooding, especially when ClientConn is closed (one Shutdown log for each subconn).
2019-02-13 14:40:29 -08:00
Jean de Klerk a402911c6f
internal: resetTransport connect deadline is across addresses (#2540)
internal: resetTransport connect deadline is across addresses

Currently, the connect deadline is recalculated per-address. This PR amends
that behavior such that all addresses for a single connection attempt share
the same deadline.

Fixes #2462
2019-02-11 17:12:42 -07:00
shaun e9c1ac35ec fix: typos (#2591) 2019-01-23 09:59:48 -08:00
Doug Fawley 9572bbe0f9
cleanup: remove unused symbols (#2581) 2019-01-17 10:14:45 -08:00
Doug Fawley dfd7708d35
cleanup: use time.Until(t) instead of t.Sub(time.Now) (#2571) 2019-01-15 16:09:50 -08:00
Jean de Klerk 1b41b79fd1
internal: refactor transport to single retry mechanism (#2461)
Previously, the transport was able to reset via the retry loop,
or via the event closures calling resetTransport. This meant
a very large amount of synchronization was necessary: one
reset meant the other had to not reset; state had to be kept
at the addrconn; and very subtle interactions were hard to
reason about.

This change removes the ability for event closures to directly
reset the transport. Instead, they signal to to the retry
loop about the event, and the retry loop is always the single
place that retries occur.

This also allows us to refactor the address switching logic
into a much simpler for loop inside the retry loop instead of
using addrConn state to keep track of an index.
2018-12-17 13:10:13 -08:00
lyuxuan 5da252b6a6
health check test: prevent double close of hcEnterChan (#2441) 2018-12-13 16:44:36 -08:00
Doug Fawley f3eb5bc06e
client: add GRPC_GO_REQUIRE_HANDSHAKE options to control connection behavior (#2464)
Possible settings of this environment variable:

- "hybrid" (default; removed after the 1.17 release): do not wait for handshake before considering a connection ready, but wait before considering successful.

- "on" (default after the 1.17 release): wait for handshake before considering a connection ready/successful.

- "off": do not wait for handshake before considering a connection ready/successful.

This setting will be completely removed after the 1.18 release, and "on" will be the only supported behavior.
2018-11-26 15:06:46 -08:00
Doug Fawley 04ea82009c
cleanup: replace "x/net/context" import with "context" (#2439) 2018-11-12 13:30:41 -08:00
lyuxuan eb55fa50e6
resolverWrapper: remove the watcher goroutine (#2446) 2018-11-09 15:31:07 -08:00
Doug Fawley a612bb6847
client: block RPCs early until the resolver has returned addresses (#2409)
This allows the initial RPC(s) an opportunity to apply settings from the service config; without this change we would still block, but only after observing the current service config settings.
2018-11-09 13:53:47 -08:00
Doug Fawley 59a2cfbdf9
Remove support for Go1.6-1.8 (#2428) 2018-11-01 15:43:42 -07:00
lyuxuan 105f61423e
health: Client LB channel health checking (#2387) 2018-11-01 10:49:35 -07:00
Jean de Klerk e120c3f900
internal: transport nil should happen before backoff (#2392)
Seems to fix https://travis-ci.org/grpc/grpc-go/jobs/443409852, but regardless
it's a more correct place for it to happen.
2018-10-22 13:57:57 -07:00
Jean de Klerk ff2aa05958
internal: fix GO_AWAY deadlock (#2391)
internal: fix GO_AWAY deadlock

A deadlock can occur when a GO_AWAY is followed by a connection closure. This
happens because onClose needlessly closes the current ac.transport: if a
GO_AWAY already occured, and the transport was already reset, then the later
closure (of the original address) sets ac.transport - which is now healthy -
to nil.

The manifestation of this problem is that picker_wrapper spins forever trying
to use a READY connection whose ac.transport is nil.
2018-10-19 14:11:21 -07:00
Doug Fawley 0ee1544089
cleanup: remove ac.events (unused) and related dead code (#2385) 2018-10-18 16:29:41 -07:00
Jean de Klerk 04c0c4d299
internal: fix client send preface problems (#2380)
internal: fix client send preface problems

This CL fixes three problems:

- In clientconn_state_transitions_test.go, sometimes tests would flake because there's not enough buffer to send client side settings, causing the connection to unpredictably enter TRANSIENT FAILURE. Each time we set up a server to send SETTINGS, we should also set up the server to read. This allows the client to successfully send its SETTINGS, unflaking the test.

- In clientconn.go, we incorrectly transitioned into TRANSIENT FAILURE when creating an http2client returned an error. This should be handled in the outer resetTransport main reset loop. The reason this became a problem is that the outer resetTransport has very specific conditions around when to transition into TRANSIENT FAILURE that the egregious transition did not have. So, it could transition into TRANSIENT FAILURE after failing to dial, even if it was trying to connect to a non-final address in the list of addresses.

- In clientconn.go, we incorrectly stay in CONNECTING after `createTransport` when a server sends its connection preface but the client is not able to send its connection preface. This CL causes the addrconn to correctly enter TRANSIENT FAILURE when `createTransport` fails, even if a server preface was received. It does so by making ac.successfulHandshake to consider both server preface received as well as client preface sent.
2018-10-18 14:31:34 -07:00
Doug Fawley 5b2c343e0b
add header metadata to PickOptions (#2376) 2018-10-12 15:44:20 -07:00
Menghan Li c05280cc73
cleanup: remove unused channel ready (#2353) 2018-10-11 13:10:45 -07:00
Menghan Li cb11627444
clientconn: not panic when service config updated while closing (#2371)
Closing `ClientConn` sets `balancerWrapper` to nil.
If service config switches balancer, the new balancer will be notified of the existing addresses.

When these two happens together, there's a chance that a method will be called on the nil `balancerWrapper`. This change adds a check to make sure that never happens. 

fixes #2367
2018-10-11 11:43:16 -07:00
Jean de Klerk 8d75951f9b
Fix onclose state transition (#2346)
internal: fix onClose state transitions

When onClose occurs during WaitForHandshake, it should immediately
exit createTransport instead of leaving CONNECTING and entering READY.

Furthermore, when any onClose happens, the state should change to
TRANSIENT FAILURE.

Fixes #2340
Fixes #2341

Also fixes an unreported bug in which entering READY causes a
Dial call to end prematurely, instead of blocking until a READY
transport is found.
2018-10-08 16:58:54 -06:00
dfawley cc41663c52
client: fix panic caused by WithWaitForHandshake and related races (#2336) 2018-09-27 14:23:29 -07:00
Menghan Li 4dedfdc82c
credentials: support google default creds (#2315)
Google default creds is a combo of ALTS, TLS and OAuth2. The right set of creds will be picked to use based on environment.

This PR contains:
 - A new `creds.Bundle` type
   - changes to use it in ClientConn and transport
   - dial option to set the bundle for a ClientConn
   - balancer options and NewSubConnOption to set it for SubConn
 - Google default creds implementation by @cesarghali 
 - grpclb changes to use different creds mode for different servers
 - interop client changes for google default creds testing
2018-09-25 13:17:25 -07:00
Jean de Klerk 82f263dc2f internal: fix race between cancel and shutdown
This fixes a race in ac.tearDown and ac.resetTransport. If ac.resetTransport
is in backoff when ac.tearDown occurs, there's a race between the state
changing to Shutdown and ac.resetTransport calling ac.createTransport.

This fixes it by returning when ac.resetTransport encounters an error
during ac.nextAddr (specifically ac.ctx.Error()). It also fixes it by
making sure that ac.tearDown changes state to Shutdown before canceling
the context.

Both fixes were implemented because they both seem to be valuable
standalone additions: the former makes ac.resetTransport more
understandable and less dependent on behavior happening elsewhere,
and the latter makes ac.tearDown more correct.

Finally, TestDialParseTargetUnknownScheme had its buffer removed; the
buffer was likely added a while ago to assuage this issue. It should
not be necessary anymore.
2018-09-24 10:46:24 -07:00
Jean de Klerk 35c3afad17
Transport refactor (#2305)
internal: remove transportMonitor, replace with callbacks

This refactors the internal http2 transport to use callbacks instead
of continuously monitoring the transport in a separate goroutine. This
has several advantages:

- Less goroutines.
- Less complexity: synchronous callbacks are much easier to reason to
reason about than asynchronous monitoring goroutines.
- Callbacks: these provide definitive locations for monitoring the
creation and closure of a transport, paving the way for GracefulStop.

This CL also consolidates all the logic about backoff and iterating
through the list of addresses into a single method.
2018-09-20 15:45:40 -07:00
lyuxuan acd1429515
channelz: channel tracing (#2262)
* channelz: channel trancing

* add service

* update

* uuu

* better testing

* switch to single API

* fix lint

* fix review comments

* fix fix review

* uuuupdate

* switch on channel type, instead of using boolean
2018-09-12 11:15:32 -07:00
dfawley 5fe10fccaf
Remove unused symbols (#2287) 2018-09-05 12:29:02 -07:00
lyuxuan da7e20b83e
channelz: turn on channelz when importing service package, delete RegisterChannelz from grpc package (#2277) 2018-08-29 11:01:36 -07:00
dfawley d2aec4d7de
client: Add ClientConn.ResetConnectBackoff to force reconnections on demand (#2273)
Fixes #1037
2018-08-27 13:21:48 -07:00
Dustin Spicuzza 91c7ef84b5 client: fix FailOnNonTempDialError and add a test for it (#2276) 2018-08-27 10:28:41 -07:00
lyuxuan 07ef407d99
channelz: unexport unnecessary API on grpc entities (#2257) 2018-08-06 16:02:47 -07:00
lyuxuan f4da7eee53
channelz: use atomic instead of mutex (#2218) 2018-08-06 11:17:12 -07:00
dfawley b20cbb449d Revert "internal: remove transportMonitor, replace with callbacks" (#2252)
Reverts grpc/grpc-go#2219 because of #2251
2018-08-01 15:40:56 -07:00
Jean de Klerk 97da9e087c
internal: remove transportMonitor, replace with callbacks (#2219) 2018-07-31 14:10:13 -07:00
lyuxuan 980d9e0348
ClientConn: add Target() returning target string (#2233) 2018-07-23 16:19:11 -07:00
Menghan Li 445634bdcc
client: define dialOptions as interfaces instead of functions (#2230) 2018-07-19 17:33:42 -07:00
Jean de Klerk 1dab6d184d addrconn: remove unused wait() method (#2220) 2018-07-16 08:21:34 -07:00
dfawley e193757038
internal/transport: remove some unused fields from structs (#2213)
- Flush and Authority are never read by the transport.
- Authority is used indirectly; move it to dialOptions.
- Delay is only set to false.
2018-07-13 09:56:47 -07:00