Commit Graph

65 Commits

Author SHA1 Message Date
Menghan Li 191cc8e37b
grpclb: filter out grpclb addresses if balancer in use is not grpclb (#2509) 2018-12-13 10:54:42 -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 0fccf8bf59
transport: increase BDP limit to 16MB to improve performance for high latency networks (#2455) 2018-11-13 16:12:37 -08:00
Doug Fawley 04ea82009c
cleanup: replace "x/net/context" import with "context" (#2439) 2018-11-12 13:30:41 -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
Michael Raimondi d27440de3f client: set TCP_USER_TIMEOUT socket option for linux (#2307)
Implements proposal A18 (https://github.com/grpc/proposal/blob/master/A18-tcp-user-timeout.md).

gRPC Core issue for reference: https://github.com/grpc/grpc/issues/15889
2018-11-05 15:13:34 -08:00
Menghan Li 761a6b364c
binarylog: fix end2end test race (#2433) 2018-11-02 10:18:47 -07:00
Doug Fawley 59a2cfbdf9
Remove support for Go1.6-1.8 (#2428) 2018-11-01 15:43:42 -07:00
Menghan Li 0efb1e105d
binarylog: no warning if no config string is set (is empty string) (#2430) 2018-11-01 14:31:10 -07:00
Menghan Li f4273b1bc8
binarylog: fix racy TestClientBinaryLogCancel (#2423) 2018-11-01 10:20:23 -07:00
Menghan Li 3332afdfad
internal: binarylog test replace += 1 with ++ (#2420) 2018-10-31 13:34:00 -07:00
Menghan Li 24638f5984
binarylog: call binary log in Client and Server (#2388)
Also includes:
 - Export `NewLoggerFromConfigString` so it can be also used when config string is specified in another way (e.g. command line flag)
 - Export `Logger` so user can install custom sink
 - Add temp file sink implementation
2018-10-31 10:21:20 -07:00
Doug Fawley a88340f3c8 internal: add testutils package comment (#2414) 2018-10-30 16:29:06 -07:00
Menghan Li c4d3b2fa07
channelz: register sockets with meaningful refnames (#2416) 2018-10-30 16:28:48 -07:00
lyuxuan aaaaffa63b
channelz: data race fix (#2411) 2018-10-29 17:54:21 -07:00
Menghan Li ecb5db9eb3
channelz: returns sockets after startID in GetServerSockets() (#2401) 2018-10-25 16:39:43 -07:00
Menghan Li 93a2ad2c87 internal: rename proto imports to pb (#2395) 2018-10-22 13:55:52 -07:00
Menghan Li 39444b99c0
binarylog: implement methodlogger (#2334)
Method logger will be picked by each RPC at the beginning to log binary entries. It also handles truncating.

This PR also adds script to download proto from grpc/grpc-proto
2018-10-18 17:27:11 -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 cfb9600851
server: fix handling of RPC timeouts that overflow int64 nanos (#2379)
Fixes #2374
2018-10-16 13:34:53 -07:00
lyuxuan 557b6b5f68
healthcheck: client-side internal hook (#2378) 2018-10-15 17:57:20 -07:00
Andrew Seigner 1da8e51941 transport: http2Client sends RST_STREAM (#2354)
If http2Client receives END_STREAM before it sends END_STREAM, it will send RST_STREAM to fully closed the stream.
2018-10-15 14:28:12 -07:00
lyuxuan 5a2acb1f52
channelz: remove init logging (#2373) 2018-10-12 14:34:08 -07:00
Doug Fawley c195587d96
balancer: add trailer metadata to DoneInfo (#2359) 2018-10-10 13:21:08 -07:00
dfawley b48e364c83
client: read from Conn while writing preface to unblock synchronous Conns (#2337) 2018-09-28 10:38:48 -07:00
dfawley cc41663c52
client: fix panic caused by WithWaitForHandshake and related races (#2336) 2018-09-27 14:23:29 -07:00
Menghan Li a338994886
binarylog: implement env variable config parsing (#2299) 2018-09-26 13:03:54 -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 30212c8423 internal: fix various problems in transport_test.go
Commit 35c3afad17 added a `defer cancel()` line
to transport_test. While this line is generally good, there happens to be a
Go 1.6 bug that when a context that gets passed into Dial is canceled, it
has a 50% chance to incorrectly causes all future Dial writes to fail.

This commit removes that defer and adds a comment explaining the situation.

https://github.com/golang/go/issues/15078
https://github.com/golang/go/issues/15035

This commit also fixes a perceived (by the race detector) racy use of
server.conn by making conn.Close happen inside the goroutine that
uses conn.

This commit also fixes a SIGSEV caused by an incorrect typed nil
check.
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 0ec11dceb4
typo: remove duplicate "the" (#2309) 2018-09-17 14:01:20 -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
dfawley 90f728eaf7
Remove shadowing of built-ins (#2290) 2018-09-05 09:05:40 -07:00
dfawley ccd64cfcfa
Miscellaneous small cleanups (#2291) 2018-09-04 15:11:50 -07:00
lyuxuan f4da7eee53
channelz: use atomic instead of mutex (#2218) 2018-08-06 11:17:12 -07:00
dfawley a344a35754
internal: remove TestingUseHandlerImpl (#2253) 2018-08-03 09:35:00 -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
dfawley efcc5364b8
internal/grpcsync: introduce package for synchronization (#2244) 2018-07-30 10:08:08 -07:00
Jean de Klerk 804c2a9051
remove 1.6 support for channelz (#2242)
ChannelZ is a debugging feature in grpc. It has not had appengine support; this commit
removes its support for 1.6, too. This change is because in a recent sys/unix commit
1.6 support was broken.
2018-07-26 14:24:04 -07:00
dfawley 339b6cb107
transport: eliminate StreamError; use status errors instead (#2239) 2018-07-26 10:30:58 -07:00
dfawley c03697249e
transport: replace ClientTransport with *http2Client for internal usage (#2238) 2018-07-26 10:19:45 -07:00
dfawley b534d2d20e
internal/transport: remove unnecessary ServerTransport method (#2224) 2018-07-17 08:26:04 -07:00
lyuxuan a7d6032db4
internal/transport_test.go: prevent leaking context (#2227) 2018-07-16 18:48:37 -07:00
lyuxuan 7273294e1a
internal/syscall: add package description (#2226) 2018-07-16 16:32:09 -07:00
lyuxuan d8ecae53ed
transport.go: minor typo fix (#2225) 2018-07-16 15:44:40 -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
lyuxuan 8c15646409
Benchmark: fix build tags (#2099) 2018-07-12 13:06:42 -07:00
dfawley 11b582728a
transport: move to internal to make room for new, public transport API (#2212)
This is a breaking change, but the transport package was never intended for use outside of grpc.  Any current users that we are aware of are incorrect or have a preferred alternative.
2018-07-11 11:22:45 -07:00