Commit Graph

84 Commits

Author SHA1 Message Date
Easwar Swaminathan aaff9e7ab9
grpc: better RFC 3986 compliant target parsing (#4817) 2021-10-14 14:54:02 -07:00
Doug Fawley 75f1d4b986
transport: call stats handler for trailers before closeStream (#4816) 2021-09-28 12:20:57 -07:00
Doug Fawley 11437f66f2
test: add option to make httpServer wait for END_STREAM; fix RetryStats race (#4811) 2021-09-24 15:29:25 -07:00
Doug Fawley d53469981f
transport: fix transparent retries when per-RPC credentials are in use (#4785) 2021-09-21 10:39:59 -07:00
Menghan Li 0d6854ab5e
transport: fix race accessing s.recvCompress (#4641) 2021-08-03 14:17:02 -07:00
Doug Fawley 1ddab33869
client: fix detection of whether IO was performed in NewStream (#4611)
For transparent retry.

Also allow non-WFR RPCs to retry indefinitely on errors that resulted in no I/O; the spec used to forbid it at one point during development, but it no longer does.
2021-07-23 10:37:18 -07:00
John Howard 0103ea2d6c
client: improve GOAWAY debug messages (#4587) 2021-07-14 13:59:50 -07:00
James Protzman ba41bbac22
transport: validate http 200 status for responses (#4474) 2021-07-14 10:54:58 -07:00
Vicent Martí 83f9def5fe
internal/transport: do not mask ConnectionError (#4561) 2021-06-28 09:51:21 -07:00
Zach Reyes b9270c3a7f
client: add deadline for TransportCredentials handshaker (#4559)
* Add deadline on connection for TransportCredentials handshake
2021-06-23 16:36:24 -04:00
Doug Fawley 84d0920b59
transport: unblock read throttling when controlbuf exits (#4447) 2021-05-19 11:05:26 -07:00
Doug Fawley 23a83dd097
transport: various simplifications noticed during #4447 (#4455) 2021-05-18 15:26:51 -07:00
James Protzman a95a5c3bac
transport: remove decodeState from client to reduce allocations (#3313) 2021-05-12 08:49:07 -07:00
apolcyn 9572fd6fae
client: include details about GOAWAYs in status messages (#4316) 2021-04-23 17:26:26 -07:00
Doug Fawley 87eb5b7502
credentials/google: remove unnecessary dependency on xds protos (#4339) 2021-04-13 16:19:17 -07:00
apolcyn c229922995
client: propagate connection error causes to RPC statuses (#4311) 2021-04-13 13:06:05 -07:00
Doug Fawley 60843b1066
xds: add support for HTTP filters (gRFC A39) (#4206) 2021-02-25 14:04:15 -08:00
Edmond 39a500abb9
support unix-abstract schema (#4079) 2020-12-22 08:56:49 -08:00
Garrett Gutierrez c456688b18
client: fix "unix" scheme handling for some corner cases (#4021) 2020-11-30 10:04:47 -08:00
Menghan Li 78864797b8
balancer: set RPC metadata in address attributes, instead of Metadata field (#4041)
This metadata will be sent with all RPCs on the created SubConn
2020-11-18 17:12:51 -08:00
yihuaz aeb04798c5
credentials: fix PerRPCCredentials w/RequireTransportSecurity and security levels (#3995) 2020-11-09 15:33:53 -08:00
Nick Jones 89faf1c3e8
internal/transport: fix a bug causing -bin metadata to be incorrectly encoded. (#3985)
Most interfaces for adding metadata to a context downcase keys, except metadata.AppendToOutgoingContext (presumably for performance reasons).  Documentation for metadata.AppendToOutgoingContext, referring to that of metadata.Pairs, states that metadata keys are downcased.

The bug is manifest if you use metadata.AppendToOutgoingContext to add metadata with a non-downcased `-Bin` suffix.  http2Client will not encode such metadata, as encodeMetadataHeader just performs a lower suffix check.
2020-10-29 13:52:55 -07:00
Garrett Gutierrez 4be647f7f6
internal/resolver/unix: Implemented unix resolver. (#3890) 2020-10-16 11:52:54 -07:00
Sorah Fukumori 9a3c02f983
http2_client: fix reader segfault on PROTOCOL_ERRORs (#3926) 2020-10-06 14:21:57 -07:00
Tzu-Chiao Yeh bf9584e105
internal/transport: handle h2 errcode on header decoding (#3872)
Handles HTTP2 error code when malformed request/response header appears.
Fixes: #3819
2020-09-17 10:34:27 -07:00
Menghan Li 266c7b6f82
xdsrouting: add fake headers (#3748) 2020-07-20 13:40:03 -07:00
Garrett Gutierrez 506b773066
Implemented component logging (#3617) 2020-06-26 12:04:47 -07:00
Doug Fawley 3b63c2b110
retry: re-enable retrying on non-IO transport errors (#3691) 2020-06-16 10:03:59 -07:00
Bryan Boreham 4709b05f2c
transport: move append of header and data down to http2 write loop to save garbage (#3568) 2020-05-21 14:21:54 -07:00
yihuaz 9eb3e7ddf3
credentials: local creds implementation (#3517)
Local credentials should be used in either a UDS and local TCP connection. The former will be associated with the security level PrigvacyAndIntegrity while the latter is associated with NoSecurity. Local credentials should be used instead of WithInsecure for localhost connections.
2020-05-20 15:43:38 -07:00
Easwar Swaminathan 6a3c03883d
Pass address attributes from balancer to creds handshaker. (#3548) 2020-04-23 11:03:42 -07:00
Easwar Swaminathan 4c4cafbab7
internal/transport: Get rid of TargetInfo struct. (#3527) 2020-04-14 14:43:14 -07:00
Matthew Dolan b3dcc68129
stats: set response compression codec on stats.InHeader and stats.OutHeader (#3390) 2020-03-20 10:12:38 -07:00
Matthew Dolan 5c17da6907
stats: add comments about why out headers and out trailers have no wire length (#3408) 2020-03-10 09:15:28 -07:00
Doug Fawley 6b9bf4296e
Revert "profiling: add hooks within grpc (#3159)" (#3378)
This reverts commit 83263d17f7.
2020-02-14 07:56:46 -08:00
Adhityaa Chandrasekar 83263d17f7
profiling: add hooks within grpc (#3159) 2020-02-12 11:10:44 -08:00
Menghan Li 3ae60ebf74
stats: create new MD for outgoing header if no MD is available (#3357) 2020-02-04 08:07:17 -08:00
Piotr Kowalczuk 7621679bee
stats: add client side user agent to outgoing header (#3331) 2020-01-31 10:34:44 -08:00
Menghan Li 8c50fc2565
revert buffer reuse (#3338)
* Revert "stream: fix returnBuffers race during retry (#3293)"

This reverts commit ede71d589c.

* Revert "codec/proto: reuse of marshal byte buffers (#3167)"

This reverts commit 642675125e.
2020-01-27 13:30:41 -08:00
yihuaz 4346c5926d credentials: create API for transport security level information (#3214) 2020-01-07 15:38:45 -08:00
Adhityaa Chandrasekar 642675125e codec/proto: reuse of marshal byte buffers (#3167)
Performance benchmarks can be found below. Obviously, a 8 KiB
request/response is tailored to showcase this improvement as this is
where codec buffer reuse shines, but I've run other benchmarks too (like
1-byte requests and responses) and there's no discernable impact on
performance.

We do not allow reuse of buffers when stat handlers or binlogs are
turned on. This is because those two may need access to the data and
payload even after the data has been written to the wire. In such cases,
we never return the data back to the pool.

A buffer reuse threshold of 1 KiB was determined after several
experiments. There's diminished returns when buffer reuse is enabled for
smaller messages (actually, a negative impact).

unary-networkMode_none-bufConn_false-keepalive_false-benchTime_40s-trace_false-latency_0s-kbps_0-MTU_0-maxConcurrentCalls_6-reqSize_8192B-respSize_8192B-compressor_off-channelz_false-preloader_false
               Title       Before        After Percentage
            TotalOps       839638       906223     7.93%
             SendOps            0            0      NaN%
             RecvOps            0            0      NaN%
            Bytes/op    103788.29     80592.47   -22.35%
           Allocs/op       183.33       189.30     3.27%
             ReqT/op 1375662899.20 1484755763.20     7.93%
            RespT/op 1375662899.20 1484755763.20     7.93%
            50th-Lat    238.746µs    225.019µs    -5.75%
            90th-Lat    514.253µs    456.439µs   -11.24%
            99th-Lat    711.083µs    702.466µs    -1.21%
             Avg-Lat     285.45µs    264.456µs    -7.35%
2019-12-20 09:41:23 -08:00
Adhityaa Chandrasekar 021bd5734e profiling: add internal changes to support profiling of gRPC (#3158) 2019-12-11 09:06:38 -08:00
Easwar Swaminathan d720ab346f
server: Keepalive pings should be sent every [Time] period (#3172)
This PR contains the server side changes corresponding to the client
side changes made in https://github.com/grpc/grpc-go/pull/3102.

Apart from the fix for the issue mentioned in
https://github.com/grpc/grpc-go/issues/2638, this PR also makes some
minor code cleanup and fixes the channelz test for keepalives count.
2019-11-19 14:43:22 -08:00
Jiacai Liu 967379b15b client: set grpc-accept-encoding header based on outgoing compressor (#3139) 2019-11-18 09:44:48 -08:00
Matthew Dolan 347a6b4db3 stats: attach metadata to In/Out Headers/Trailers (#3169) 2019-11-14 15:22:36 -08:00
Doug Fawley 0f32486dd3
transport: minor code simplification (#3136) 2019-11-01 11:11:23 -07:00
Easwar Swaminathan 0f2d539339
client: Keepalive pings should be sent every [Time] period (#3102)
This commit makes the following changes:
- Keep track of the time of the last read in the transport.
- Use this in the keepalive implementation to decide when to send out
  keepalives.
- Address the issue of keepalives being sent every [Time+Timeout] period
  instead of every [Time] period, as mandated by proposal A8.

Proposal A8 is here:
https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md
2019-10-23 20:33:53 -07:00
Shane Liebling 47d3cfe042 Adding a RequestInfo struct for propagating request data to Get… (#3057)
Add a RequestInfo struct which initially is used for passing the full request method (though could later be expanded to pass more info) so that things like GetRequestMetadata can be used to apply logic based on that data.

This is a fix for #3019
2019-10-04 09:27:09 -07:00
Doug Fawley 663e4ce0c9
client: fix race between client-side stream cancellation and compressed server data arriving (#3054)
`transport/Stream.RecvCompress` returns what the header contains, if present,
or empty string if a context error occurs.  However, it "prefers" the header
data even if there is a context error, to prevent a related race.  What happens
here is:

1. RPC starts.

2. Client cancels RPC.

3. `RecvCompress` tells `ClientStream.Recv` that compression used is "" because
   of the context error.  `as.decomp` is left nil, because there is no
   compressor to look up in the registry.

4. Server's header and first message hit client.

5. Client sees the header and message and allows grpc's stream to see them.
   (We only provide context errors if we need to block.)

6. Client performs a successful `Read` on the stream, receiving the gzipped
   payload, then checks `as.decomp`.

7. We have no decompressor but the payload has a bit set indicating the message
   is compressed, so this is an error.  However, when forming the error string,
   `RecvCompress` now returns "gzip" because it doesn't need to block to get
   this from the now-received header.  This leads to the confusing message
   about how "gzip" is not installed even though it is.

This change makes `waitOnHeader` close the stream when context cancellation happens.
Then `RecvCompress` uses whatever value is present in the stream at that time, which
can no longer change because the stream is closed.  Also, this will be in sync with
the messages on the stream - if there are any messages present, the headers must
have been processed first, and `RecvCompress` will contain the proper value.
2019-10-01 10:47:40 -07:00
Easwar Swaminathan 45bd2846a3
Use sync.Cond to implement keepalive dormancy. (#2987)
The current code was using a buffered channel which was used to signal
whether the keepalive goroutine should enter dormancy or if it should be
awaked from sleep. Using sync.Cond makes the code much simpler to read,
and also improves the performance numbers in all but one front.
2019-08-26 15:01:49 -07:00