Commit Graph

84 Commits

Author SHA1 Message Date
Easwar Swaminathan c26cd97e18
transport: make http2Client.getStream() to only return a stream. (#2984)
Suggested in https://github.com/grpc/grpc-go/pull/2980.
2019-08-16 11:25:09 -07:00
David Zbarsky 030824531b transport: remove defer in http2Client.getStream (#2980) 2019-08-15 11:50:32 -07:00
Doug Fawley ee21c923a2
transport: block reading frames when too many transport control frames are queued (#2970)
Addresses CVE-2019-9512 (Ping Flood), CVE-2019-9514 (Reset Flood), and CVE-2019-9515 (Settings Flood).
2019-08-13 10:52:26 -07:00
Menghan Li a4f24690a4
internal: log when connection is closed due to keepalive (#2940) 2019-07-29 14:33:10 -07:00
David Zbarsky decb43806d http2client: remove unnecessary allocations for header fields (#2925) 2019-07-24 10:32:39 -07:00
Doug Fawley 977142214c
client: fix race between transport draining and new RPCs (#2919)
Before these fixes, it was possible to see errors on new RPCs after a
connection began draining, and before establishing a new connection.  There is
an inherent race between choosing a SubConn and attempting to creating a stream
on it.  We should be able to avoid application-visible RPC errors due to this
with transparent retry.  However, several bugs were preventing this from
working correctly:

1. Non-wait-for-ready RPCs were skipping transparent retry, though the retry
design calls for retrying them.

2. The transport closed itself (and would consequently error new RPCs) before
notifying the SubConn that it was draining.

3. The SubConn wasn't synchronously updating itself once it was notified about
the closing or draining state.

4. The SubConn would go into the TRANSIENT_FAILURE state instantaneously,
causing RPCs to fail instead of queue.
2019-07-22 16:07:55 -07:00
Doug Fawley 64ddb19a93
client: fix canceled vs deadline exceeded double-check logic (#2906) 2019-07-16 09:41:37 -07:00
Yongzheng Lai 7472edcc1e metadata: write original md before appended md (#2879) 2019-06-25 10:34:12 -07:00
Can Guler eca11cb9e4
transport: share recv buffers (#2813)
transport: share recv buffers
2019-06-20 15:01:58 -07:00
Can Guler 25ad15b871
transport: Fix the inconsistency between headerChan and headerDone (#2818)
transport: Fix the inconsistency between headerChan and headerDone
2019-05-22 14:02:23 -07:00
Jean de Klerk a9408321c7
internal: remove err from ClientTransport.GracefulClose (#2771) 2019-05-02 14:20:28 -06:00
David Symonds 9a2caafd93 client: restore remote address in traces (#2718)
The client-side traces were otherwise only showing `RPC: to <nil>`,
which is not helpful.

Also clean up construction of traceInfo and firstLine in a few places.
2019-03-27 09:52:40 -07:00
lyuxuan ef9bac2604
cleanup: remove unnecessary ignoreContentType field (#2715) 2019-03-22 13:56:18 -07:00
lyuxuan 79c9bc6794
client: handle HTTP header parsing error correctly (#2599) 2019-03-06 10:59:01 -08:00
Jean de Klerk 5d5c0ac4a3
internal: check flush err (#2632) 2019-02-08 16:17:16 -07:00
Doug Fawley dfd7708d35
cleanup: use time.Until(t) instead of t.Sub(time.Now) (#2571) 2019-01-15 16:09:50 -08:00
Can Guler 9e7c146356
Return nil trailer metadata, if the RPC's status is context canceled. (#2554)
* Closes the client transport stream, if context is cancelled while recvBuffer is reading.

* Passes a function pointer to recvBufferReader, instead of a Stream and an http2Client.

* Adds more descriptive error messages.

* If waitOnHeader notices the context cancelation, shouldRetry no longer returns a ContextError. Instead, it returns the error from the last try.

* Makes sure that test gets both statuses at least 5 times.

* Makse cntPermDenied a lambda function.
2019-01-14 10:59:44 -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
Doug Fawley 04ea82009c
cleanup: replace "x/net/context" import with "context" (#2439) 2018-11-12 13:30:41 -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
Doug Fawley 59a2cfbdf9
Remove support for Go1.6-1.8 (#2428) 2018-11-01 15:43:42 -07:00
Menghan Li c4d3b2fa07
channelz: register sockets with meaningful refnames (#2416) 2018-10-30 16:28:48 -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
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 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 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 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
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 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