Commit Graph

3039 Commits

Author SHA1 Message Date
Easwar Swaminathan 027cd627f8
Fix a data race in resolver_conn_wrapper.go (#3090) 2019-10-14 15:13:33 -07:00
Menghan Li 0859afa33d
xds: set dial target in request resource_names (#3081) 2019-10-14 09:31:56 -07:00
Menghan Li 1610f0fd86
mod: move test/tools to a different module (#3086) 2019-10-14 09:31:07 -07:00
Ning Xie c0122323a5 fix typo for grpclb token key (#3094) 2019-10-14 08:57:17 -07:00
Easwar Swaminathan ef403a2ec1
Make healthcheck tests in end2end_test.go more readable. (#2883)
* Make healthcheck tests in end2end_test.go more readable.

- Made these tests use the default health service implementation
  wherever possible.
- Refactored some common code used in these tests into helper functions.
- Added function comments for all these tests to improve readability.

In a follow up PR, I will be moving all these tests into
healthcheck_test.go.
2019-10-11 10:38:51 -07:00
Joe Betz f07f2cffa0 credentials: Use net.SplitHostPort safely parse IPv6 authorities in ClientHandshake (#3082) 2019-10-09 10:48:24 -07:00
lzhfromustc ff0c603b9b proxy_test: Fix a goroutine-leak bug in testHTTPConnect: now use channel done to store err and call t.Fatalf when err not nil (#3080) 2019-10-09 10:12:01 -07:00
Anthony Fok 2d6a3edc72 cleanup: fix typo (#3084) 2019-10-09 10:10:07 -07:00
Joe Betz 2e7984e2c0 clientconn: override authority with address's ServerName, if set (#3073) 2019-10-08 13:59:02 -07:00
Quang Le Hong d08614fd39 examples: add UnimplementedGreeterServer in debugging example (#3079) 2019-10-05 15:38:30 -07:00
Menghan Li b4f13811f7 [xds_config_rename] xds bootstrap: rename helper.go to config.go (#3059) 2019-10-04 14:46:26 -07:00
Doug Fawley df162eae76
test: embed Unimplemented___Server in every service (#3076) 2019-10-04 13:22:31 -07:00
Ben Wells 691f3b44ba cleanup: fix various misspellings (#3075) 2019-10-04 13:07:47 -07:00
Doug Fawley ed563a02ea
resolver: add State fields to support error handling (#2951) 2019-10-04 12:59:43 -07:00
Easwar Swaminathan aa4eae656c
Remove couple of unused fields in the resolver wrapper. (#3070) 2019-10-04 10:54:57 -07:00
Doug Fawley 50c4579fc2
examples: add Unimplemented___Server to all example servers (#3071) 2019-10-04 10:54:09 -07:00
Bryan Boreham dcd1c9748d Use exact size, if known, to allocate decompression buffer (#3048)
For large messages this generates far less garbage than ioutil.ReadAll().

Implement for gzip - RFC1952 requires it, and the Go implementation
checks it already (modulo 2^32).
2019-10-04 10:05:56 -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
Easwar Swaminathan 31911ed09e
client: add WithConnectParams to configure connection backoff and timeout (#2960)
* Implement missing pieces for connection backoff.

Spec can be found here:
https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md

Summary of changes:
* Added a new type (marked experimental), ConnectParams, which contains
  the knobs defined in the spec (except for minConnectTimeout).
* Added a new API (marked experimental), WithConnectParams() to return a
  DialOption to dial with the provided parameters.
* Added new fields to the implementation of the exponential backoff in
  internal/backoff which mirror the ones in ConnectParams.
* Marked existing APIs WithBackoffMaxDelay() and WithBackoffConfig() as
  deprecated.
* Added a default exponential backoff implementation, for easy use of
  internal callers.

Added a new backoff package which defines the backoff configuration
options, and is used by both the grpc package and the internal/backoff
package. This allows us to have all backoff related options in a
separate package.
2019-10-03 16:47:13 -07:00
Mo Zhonghua fb2e5cdc85 server: add ServerOption HeaderTableSize (#2931) 2019-10-03 16:08:31 -07:00
AbserAri 3778847a73 examples: create an example for enabling and configuring retry (#3028) 2019-10-03 16:04:43 -07:00
Easwar Swaminathan 492ab452a2
xds: incorporate changes to bootstrap file format. (#3065)
* Incorporate changes to bootstrap file format.

The format of the bootstrap file will be as follows:
{
  "xds_server": {
    "server_uri": <string containing URI of xds server>,
    // List of channel creds; client will stop at the first type it
    // supports.
    "channel_creds": [
      {
        "type": <string containing channel cred type>,
        // The "config" field is optional; it may be missing if the
        // credential type does not require config parameters.
        "config": <JSON object containing config for the type>
      }
    ]
  },
  "node": <JSON form of Node proto>
}

- Also, the bootstrap file will be read everytime a new xDS client is created.
- Change NewConfig() to not return error. Instead it just returns with
  certain fields left unspecified if it encounters errors.
- Do not fail the bootstrap process if we see unknown fields in the
  bootstrap file.
2019-10-03 15:41:16 -07:00
Menghan Li 5bf44136bb
xds: make balancer group restartable (#2999)
This is a preparing change to support priority failover. It adds start() and close() to balancer group, so we can have a balancer group that's not in use, but has all the data and is ready to be started (think about a lower priority when the higher priority is in use).

A balancer group is split into two parts: static and dynamic:

static: the data from EDS, and gets updated even if balancer group is closed
balancer IDs and builders, addresses for each balancer
dynamic: the sub-balancers
These are only created when the balancer group is started. They are closed when the balancer group is closed.
And only when the balancer group is started, the sub-balancers will get address updates.
2019-10-02 10:04:32 -07:00
Doug Fawley 2e14ef2723
transport: don't check s.header on the server side in Stream.Header (#3063)
Previously this would fall into returning the same "s.header.Copy(), nil"
condition at the end of the function, returning an empty MD.  After a recent
change it would instead check headerValid, which is always false on servers,
and return nil and an error.  Callers were ignoring this error so no behavior
change was seen, but there is no need to check s.headers here.
2019-10-02 10:00:00 -07:00
Doug Fawley 5df282efcf
transport: fix race between operateHeaders and closeStream and reading headers (#3062)
headerChan isn't necessarily closed when closeStream returns; block on it in
waitOnHeader.
2019-10-02 09:59:28 -07:00
KimMachineGun 7aa94b7eef health: Use sync.RWMutex instead of sync.Mutex (#3058) 2019-10-01 13:59:53 -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
yuxiaobo96 861d8e7992 internal: fix typos in comments (#3046) 2019-09-30 15:30:07 -07:00
Easwar Swaminathan 1e7ab3dab0
Move keepalive tests to a separate test file. (#3014)
This is a follow-up to https://github.com/grpc/grpc-go/pull/2992.
2019-09-30 12:44:16 -07:00
Doug Fawley e75b8f4830
test: fix flake in GoAwayThenClose (#3052)
In the event of a race, the first server may not be fully serving before the
client attempt to connect, then the second server may attempt to field the
FullDuplexCall, which it does not implement.

Fix the race by giving the client only the first server's address until after
the FullDuplexCall is started.
2019-09-27 13:42:15 -07:00
Doug Fawley e351044388
clientconn: fix potential deadlock caused by ResetConnectBackoff (#3051) 2019-09-27 10:51:22 -07:00
Doug Fawley 1950dc9db9
travis: add go1.13 and remove go1.10 and go1.9 without GAE (#3050) 2019-09-27 09:48:01 -07:00
Doug Fawley 275a76f490
Change version to 1.25.0-dev (#3043) 2019-09-25 14:20:15 -07:00
Adhityaa Chandrasekar 230def7691 docs: fix debugging README typo (#3037) 2019-09-24 16:00:30 -07:00
Srini Polavarapu 788ffe6275
Update governance, contributing, code of conduct docs (#3033)
* change from Inc. to LLC for Google

* Add CODE-OF-CONDUCT.md, GOVERNANCE.md and update CONTRIBUTING.md
2019-09-23 11:24:27 -07:00
Doug Fawley 6b46f470d1
client: consider service config invalid if loadBalancingConfig… (#3034) 2019-09-20 16:07:23 -07:00
Doug Fawley a5e64ec425
test: fix channelz test for violating flow control (#3031)
- Send a message from the test server that the client can block on to know for sure the RPC's header was sent.
- Don't receive in the test server so we can violate flow control
- Set a deadline on the RPC so it can't hang forever.
2019-09-18 13:07:23 -07:00
Doug Fawley e2cfd1c28f
internal: update proto library version (#3025)
Also, two fixes:

- Fix long-standing `.travis.yml` bug where `VET_SKIP_PROTO` was not `export`ed (so not seen by `vet.sh`).
- Update `vet.sh` to work with new `goimports -l` that does not print a `:` after filenames.
2019-09-17 13:49:26 -07:00
Easwar Swaminathan 7b8c5564b6
Add functionality to read xDS bootstrap file. (#3000)
As of this implementation, the bootstrap file will be provided in the
GRPC_XDS_BOOTSTRAP environment variable and will be read by the xDS
balancer. The file will be in JSON form with two top-level entities: a
Node proto and an ApiConfigSource proto.  The overall JSON format will
be:
{
  "node": <Node proto>,
  "xds_server": <ApiConfigSource proto>
}

In the ApiConfigSource proto, We will support only one grpc_services
entry. The api_type field must be GRPC.

As for creds, we will use default TLS creds (which will use CAs from
system default directories, and will not use any client certificates)
for transport and default compute engine creds for call credentials.
This will evolve into something more configurable in the future.
2019-09-12 14:51:55 -07:00
Doug Fawley 40ed2eb467
server: set and advertise max frame size of 16KB (#3018) 2019-09-11 10:34:34 -07:00
Menghan Li ac35b67779
grpclb: fix deadlock in grpclb connection cache (#3017)
Before the fix, if the timer to remove a SubConn fires at the same time
NewSubConn cancels the timer, it caused a mutex leak and deadlock.
2019-09-10 12:40:48 -07:00
Doug Fawley 4ccf24ac5d
vet: ignore status code from grep -L (#3016) 2019-09-10 12:39:47 -07:00
Menghan Li 92075d79a7
modules: add go 1.11 to go.mod (#3013) 2019-09-09 16:11:21 -07:00
Doug Fawley 74f33a446d
github: add mergeable config (#3008)
This PR causes mergeable to enforce the following rules on PRs:

- must include a "Type:" label
- must include either the "no release notes" label or a Release milestone
2019-09-05 15:47:27 -07:00
Doug Fawley 5735d6dcf1
github: add stalebot config (#3007) 2019-09-05 14:38:11 -07:00
Doug Fawley e2d4ecf5a6
doc: clarify client concurrency (#3001) 2019-09-05 13:20:03 -07:00
Easwar Swaminathan 59c5eb751b
Keepalive test improvements. (#2992)
* Added a test for keepalive dormancy.
* Added comments to all tests, explicitly stating their intention.
* Used the exported APIs wherever possible instead of relying on
  internal state.
* Specifically checked for GoAway reason, instead of just relying on the
  receipt of a goaway.
* Improved error messages printed upon test failures.
* Made the tests more consistent with each other in terms of variables
  names, whitespace usage etc.

Once this PR is approved and merged, we can move all these tests to a
separate file.
2019-09-05 12:43:39 -07:00
Easwar Swaminathan da768de056
Improve xds_test.go (#2991)
Rename TestXdsBalanceHandleResolvedAddrs as TestXdsFallbackResolvedAddrs
and add comments to explain what the test is doing. Also added some
other comments and made minor formatting changes.
2019-09-04 15:09:39 -07:00
Easwar Swaminathan 6c2b3b1ba4
Add a micro benchmark for context.WithValue() to compare using local and (#2986)
global keys.
2019-09-03 10:43:58 -07:00
James Protzman 4d39b48954 transport: derive transport context from context.Background (#2930) 2019-08-29 14:36:45 -07:00