273 Commits

Author SHA1 Message Date
207e2760fd Fix test race: Atomically access minConnecTimout in testing environment. (#1897) 2018-03-07 10:36:17 -08:00
7c5299d71e Fix flaky test: TestCloseConnectionWhenServerPrefaceNotReceived (#1870)
* Atomically update minConnectTimeout in test.

* Refactor the flaky test.

* Post review update

* mend
2018-03-02 13:39:55 -08:00
12da026194 clientconn: fix a typo in GetMethodConfig documentation (#1867) 2018-02-21 10:14:52 -08:00
3926816d54 addrConn: Report underlying connection error in RPC error (#1855) 2018-02-14 14:13:10 -08:00
e014063a43 addrConn: keep retrying even on non-temporary errors (#1856) 2018-02-13 16:07:10 -08:00
365770fcbd streams: Stop cleaning up after orphaned streams (#1854)
This change introduces some behavior changes that should not impact users that
are following the proper stream protocol. Specifically, one of the following
conditions must be satisfied:

1. The user calls Close on the ClientConn.
2. The user cancels the context provided to NewClientStream, or its deadline
    expires. (Note that it if the context is no longer needed before the deadline
    expires, it is still recommended to call cancel to prevent bloat.) It is always
    recommended to cancel contexts when they are no longer needed, and to
    never use the background context directly, so all users should always be
    doing this.
3. The user calls RecvMsg (or Recv in generated code) until a non-nil error is
    returned.
4. The user receives any error from Header or SendMsg (or Send in generated
    code) besides io.EOF.  If none of the above happen, this will leak a goroutine
    and a context, and grpc will not call the optionally-configured stats handler
    with a stats.End message.

Before this change, if a user created a stream and the server ended the stream,
the stats handler would be invoked with a stats.End containing the final status
of the stream. Subsequent calls to RecvMsg would then trigger the stats handler
with InPayloads, which may be unexpected by stats handlers.
2018-02-08 10:51:16 -08:00
37346e3181 Revert "Add WithResolverUserOptions for custom resolver build options" (#1839)
This reverts commit ff1be3fcc57773d500921fad479d82ec171e2358.
2018-02-05 12:52:35 -08:00
5ba054bf37 encoding: Introduce new method for registering and choosing codecs (#1813) 2018-01-23 11:39:40 -08:00
10598f3eb3 Explain target format in DialContext's documentation (#1785) 2018-01-18 13:10:52 -08:00
e975017b47 Don't set reconnect parameters when the server has already responded. (#1779) 2018-01-04 11:16:47 -08:00
e6549e636d Add dial option to set balancer (#1697)
WithBalancerName dial option specifies the name of the balancer to be used by the ClientConn. Service config updates can NOT override the balancer option.
2017-12-18 15:35:42 -08:00
98b17f20a2 relocate check for shutdown in ac.tearDown() (#1723) 2017-12-15 12:03:41 -08:00
dba60db4f4 Switch balancer to grpclb when at least one address is grpclb address (#1692) 2017-12-12 12:45:05 -08:00
ff1be3fcc5 Add WithResolverUserOptions for custom resolver build options (#1711) 2017-12-06 15:54:01 -08:00
be077907e2 make load balancing policy name string case-insensitive (#1708) 2017-12-04 14:03:22 -08:00
ddbb27e545 client: backoff before reconnecting if an HTTP2 server preface was not received (#1648) 2017-12-01 09:55:42 -08:00
1e1a47f0f2 Re-resolve target when one connection becomes TransientFailure (#1679)
This allows ClientConn to get more up-to-date addresses from resolver.
ClientConn compares new addresses with the cached ones. So if resolver returns the same set of addresses, ClientConn will not notify balancer about it.

Also moved the initialization of resolver and balancer to avoid race. Balancer will only be started when ClientConn gets resolved addresses from balancer.
2017-11-28 13:16:53 -08:00
2ef021f78d New grpclb implementation (#1558)
The new grpclb supports fallback to backends if remote balancer is unavailable
2017-11-27 11:16:26 -08:00
10873b30bf Fix panics on balancer and resolver updates (#1684)
- NewAddress with empty list (addrConn with an empty address list)
 - NewServiceConfig to switch balancer before the first balancer is built
2017-11-22 13:59:20 -08:00
d6cc72862b switch balancer based on service config info (#1670) 2017-11-17 11:11:05 -08:00
816fa5b06f Add proper support for 'identity' encoding type (#1664) 2017-11-17 09:24:54 -08:00
409fd8e23b addrConn: set ac.state to TransientFailure upon non-temporary errors (#1657)
So failfast RPCs will fail with unavailable errors when this happens.
2017-11-13 16:33:42 -08:00
8ff8683602 Implement transparent retries for gRFC A6 (#1597) 2017-11-06 13:45:11 -08:00
af224a8a48 Check ac state shutdown before setting it to TransientFailure (#1643) 2017-11-02 09:56:04 -07:00
5db344a40a Introduce new Compressor/Decompressor API (#1428) 2017-10-31 10:21:13 -07:00
b3ed81a60b Fix connectivity state transitions when dialing (#1596) 2017-10-23 14:06:33 -07:00
1687ce5770 ClientHandshake should get the dialing endpoint as the authority (#1607) 2017-10-23 11:40:43 -07:00
5c3d956e18 Re-add support for Go1.6 (#1603) 2017-10-20 12:05:20 -07:00
94f1917696 Make passthrouth resolver the default instead of dns (#1606) 2017-10-20 12:03:44 -07:00
de0cff50aa Fix goroutine leak in grpclb_test (#1595) 2017-10-19 15:16:16 -07:00
6f3b6ff46b Parse ServiceConfig JSON string (#1515) 2017-10-19 12:09:19 -07:00
a353537ff5 Register and use default balancers and resolvers (#1551) 2017-10-19 11:32:06 -07:00
c8405557a4 Remove Go1.6 support (#1492) 2017-10-04 13:57:10 -07:00
5a82377e69 transport: refactor of error/cancellation paths (#1533)
- The transport is now responsible for closing its own connection when an error
  occurs or when the context given to it in NewClientTransport() is canceled.

- Remove client/server shutdown channels -- add cancel function to allow
  self-cancellation.

- Plumb the clientConn's context into the client transport to allow for the
  transport to be canceled even after it has been removed from the ac (due to
  graceful close) when the ClientConn is closed.
2017-10-02 11:56:31 -07:00
4bbdf230d7 New implementation of roundrobin and pickfirst (#1506) 2017-10-02 09:22:57 -07:00
8214c28a62 Make IO Buffer size configurable. (#1544)
* Make IO Buffer size configurable.

* Fixing typo
2017-09-28 14:11:14 -07:00
59cb69e66d Fix misspells (#1531) 2017-09-20 14:55:57 -07:00
8233e124e4 Add new Resolver and Balancer APIs (gRFC L9) (#1408)
- Add package balancer and resolver.
 - Change ClientConn internals to new APIs and adds a wrapper for v1 balancer.
2017-08-31 10:59:09 -07:00
2308131c44 addrConn: change address to slice of address (#1376)
* addrConn: change address to slice of address
* add pickfirst balancer to test new addrconn
2017-08-21 12:27:04 -07:00
9d99afc2fd Automatic WriteStatus for RecvMsg/SendMsg error on server side (#1409)
automatically WriteStatus if there's any error when RecvMsg/SendMsg on server side.
2017-08-14 12:24:23 -07:00
e81b5698fd Add and use connectivity package for states (#1430)
* Add and use connectivity package
* Mark cc state APIs as experimental
2017-08-09 10:31:12 -07:00
4e56696c6c Fix a goroutine leak in DialContext (#1424)
A leak happens when DialContext times out before a balancer returns any
addresses or before a successful connection is established.

The loop in ClientConn.lbWatcher breaks and doneChan never gets closed.
2017-08-04 13:40:50 -07:00
aa5b2f7368 Enabling client process multiple GoAways (#1393) 2017-07-28 09:37:53 -07:00
a5d184a8a1 Expose ConnectivityState of a ClientConn. (#1385) 2017-07-24 15:00:53 -07:00
98eab9baf6 Do not create new addrConn when connection error happens (#1369) 2017-07-20 13:22:59 -07:00
71260d2171 Fix logging method (#1375) 2017-07-18 10:25:36 -07:00
d6723916d2 Use log severity and verbosity level (#1340)
- All logs use 1 severity level instead of printf
 - All transport logs only go to verbose level 2+
 - The default logger only log errors and verbosity level 1
 - Add environment variable GRPC_GO_LOG_SEVERITY_LEVEL and GRPC_GO_LOG_VERBOSITY_LEVEL to set severity or verbosity levels for the default logger
2017-07-13 12:10:19 -07:00
77d4a9f456 Add documentation to deprecate WithTimeout dial option (#1333) 2017-06-26 15:18:57 -07:00
c5c761dbca fix spell (#1314) 2017-06-16 09:59:37 -07:00
ddbf6c46a6 autofix license notice 2017-06-08 14:42:19 +02:00