115 Commits

Author SHA1 Message Date
decb43806d http2client: remove unnecessary allocations for header fields (#2925) 2019-07-24 10:32:39 -07:00
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
c654cab129 server: avoid allocations related to tracking excessive pings (#2923) 2019-07-22 09:56:26 -07:00
64ddb19a93 client: fix canceled vs deadline exceeded double-check logic (#2906) 2019-07-16 09:41:37 -07:00
24b2fb8959 client: remove option to send RPCs before HTTP/2 handshake is completed (#2904) 2019-07-12 13:37:27 -07:00
5caf962939 client: addrConn NewStream and health check cleanup (#2848) 2019-06-26 11:15:17 -07:00
7472edcc1e metadata: write original md before appended md (#2879) 2019-06-25 10:34:12 -07:00
eca11cb9e4 transport: share recv buffers (#2813)
transport: share recv buffers
2019-06-20 15:01:58 -07:00
cd89eaf40e test: fix Test/GracefulStop by not removing activeStreams too aggresivelly (#2857)
Before this fix, stream is removed from activeStreams in finishStream,
which happens when the service handler returns status, without waiting
for the status to be sent by loopyWriter. If GracefulStop() is called in
between, it will close the connection (because activeStreams is empty),
which causes the RPC to fail with "transport is closing". This change
moves the activeStreams cleanup into loopyWriter, after sending status
on wire.
2019-06-12 10:26:18 -07:00
a5396fd45c Remove call to proto.Clone() in http2Server.WriteStatus. (#2842)
* Expose a method from the internal package to get to the raw
  StatusProto wrapped by the status error, and use it from
  http2Server.WriteStatus().
* Add a helper method in internal/testutils to compare two status errors
  and update test code to use that instead of reflect.DeepEqual()
2019-06-10 15:03:12 -07:00
d40a995895 balancer/resolver: add loadBalancingConfig and pre-parsing support (#2732) 2019-05-30 09:12:58 -07:00
f34abd9513 xds: add orca generated file, and move orca to xds folder (#2804) 2019-05-24 12:35:57 -07:00
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
42baa8b199 channelz: wait for clean up before next test (#2797) 2019-05-02 14:47:50 -07:00
a9408321c7 internal: remove err from ClientTransport.GracefulClose (#2771) 2019-05-02 14:20:28 -06:00
d7af56a5e4 internal: tweak ClientTransport.GracefulClose documentation (#2772)
* internal: tweak ClientTransport.GracefulClose documentation

* address menghanl@ review comment
2019-04-16 16:54:26 -06:00
3fc743058b transport: fix a race that could lead to memory leaks (#2765)
* When a RST_STREAM is received by the server transport, a cleanupStream
item is placed into controlbuf no matter what.

* Updates comments.

* Replaces getCleanupStream with inline struct initialization.
2019-04-15 14:20:22 -07:00
d389f9fac6 balancer: add server loads from RPC trailers to DoneInfo (#2641) 2019-04-02 11:15:36 -07:00
924457101b syscall: remove logging in init(). (#2734)
The same as https://github.com/grpc/grpc-go/pull/2373.

Signed-off-by: Yangmin Zhu <ymzhu@google.com>
2019-04-02 10:36:15 -07:00
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
ef9bac2604 cleanup: remove unnecessary ignoreContentType field (#2715) 2019-03-22 13:56:18 -07:00
66cd524910 transport: stop using http.CloseNotifier in handler server (#2697) 2019-03-20 13:32:46 -07:00
272a4b69f1 transport: do not close channel that can lean to panic (#2695)
`Write` can be called concurrently, for which it calls the `do` function.
As `WriteStatus` can close the `ht.writes` in parallel as well the `Write`
will try to write into the `ht.writes` in the `do` function, this can
lead into a panic. As there is no real usability on closing this channel
we can simply leave it to the garbage collector so we can avoid panic
during an execution.

Signed-off-by: André Martins <aanm90@gmail.com>
2019-03-19 10:29:19 -07:00
2d5c4dfb95 server: send RST_STREAM after trailers if client has not half-closed (#2684)
Fixes #834
2019-03-14 15:15:50 -07:00
79c9bc6794 client: handle HTTP header parsing error correctly (#2599) 2019-03-06 10:59:01 -08:00
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
a51d23e017 transport: return ErrConnClosing for proper handling (#2644)
transport: return ErrConnClosing for proper handling
2019-02-27 09:36:25 -08:00
40cb5618f4 dialOption: export WithContextDialer() (#2629)
fixes #2627
2019-02-25 15:22:10 -08:00
ed70822b12 keepalive: apply minimum ping time of 10s to client and 1s to server (#2642)
* keepalive: apply minimum ping time of 10s to client and 1s to server

* review fixes
2019-02-21 13:09:37 -08:00
587cec03e6 Moves swapState up, so it gets executed no matter what. (#2649)
* Moves swapState up, so it gets executed no matter what.

* Adds an explanation.
2019-02-20 18:03:46 -08:00
6d026ae45a internal: transport_test init expected byte slice to be not all zero (#2643) 2019-02-14 09:51:36 -08:00
32559e2175 internal: server deletes stream after receiving an RST_STREAM frame
* Fixes established streams leak in the loopy writer.

RSTStreamFrames used to be ignored by the server transport, if a trailer had already been put into the transport's control buffer. If loopy writer couldn't write anything into a stream because of an error on the client side, then this trailer would never be sent. At that point, server would receive an RSTStreamFrame from client. But this RSTStreamFrame would be ignored because a trailer was already put into the control buffer. This would keep the stream open and in memory on the server side.

With this change, a cleanupStream item is put into the transport's control buffer, whenever an RSTStreamFrame is received by the server, even after a trailer has been put into the buffer.

* When client sends a header to initiate a stream just after sending an RST_STREAM, server gets these frames in the correct order.
When server receives the RST_STREAM, it marks the stream as done and defers the deletion of the stream to the loopy writer by putting a cleanupStream item into control buffer.
Then the server receives the header to initiate a stream. It acts on the header immediately and attempts to create the stream. But because the old stream is not deleted, it hits the number of streams limit and fails.
This commit solves this problem by letting server handle the deletion immediately after receiving the RST_STREAM.

* Refactors deleteStream method.

* Moves consts declarations into test function's body.
2019-02-11 17:33:22 -08:00
1263ed4d2e internal: add buffer for channelz flowcontrol getter channel (#2625)
to avoid goroutine leak
2019-02-11 10:31:17 -08:00
5d5c0ac4a3 internal: check flush err (#2632) 2019-02-08 16:17:16 -07:00
eda3b7e3ed client: fix handling of GRPC_GO_REQUIRE_HANDSHAKE=on to not interpret as "hybrid" (#2603)
6cc789b34b made `envconfig.RequireHandshakeOn` the default when unspecified by environment variable, but missed a fallthrough leading to `GRPC_GO_REQUIRE_HANDSHAKE=on` specifying `envconfig.RequireHandshakeHybrid`.  This change adds the missing fallthrough.
2019-01-29 15:00:25 -08:00
d7e8e3da0d cleanup: remove staticcheck exception (#2582) 2019-01-17 10:24:42 -08:00
59acad4c45 cleanup: more simplifications (#2574) 2019-01-16 13:07:56 -08:00
4e92c060da cleanup: replace unnecessary loops (#2573) 2019-01-16 13:06:58 -08:00
dfd7708d35 cleanup: use time.Until(t) instead of t.Sub(time.Now) (#2571) 2019-01-15 16:09:50 -08:00
38b35dcb7c cleanup: lower-case starting character of error strings (#2572) 2019-01-15 16:09:35 -08:00
6cc789b34b client: make handshake required 'on' by default, not 'hybrid' (#2565) 2019-01-15 09:19:32 -08:00
f647b6facb grpctest: defer Teardown to guarantee it is run even after t.Fatal (#2562) 2019-01-14 15:22:43 -08:00
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
bd0b3b2aa2 grpctest: fix comments to be more readable (#2555) 2019-01-09 15:32:22 -08:00
b6f0a0f3fc grpctest: add example to show how it is used (#2552) 2019-01-09 12:52:40 -08:00
8fd063a5aa channelz: Implement GetServer method for channelz (#2537) 2019-01-09 10:50:34 -08:00
0a391ff2b7 grpctest: add new package to manage tests and support per-test setup/teardown (#2523)
- Migrate `grpc` & `grpc/test` packages to use `Teardown` support to guarantee `leakcheck` is used
2019-01-07 14:24:56 -08:00
1838dedee3 channelz: respect max_results in listing methods (#2516) 2018-12-20 13:53:39 -08:00
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
5da252b6a6 health check test: prevent double close of hcEnterChan (#2441) 2018-12-13 16:44:36 -08:00