When gRPC keepalives are enabled (which isn't the case by default at
this time) and PermitWithoutStream is false (the default), the client
can deadlock when transitioning between having no active stream and
having one active stream. Subsequent attempts to create a new stream
or to close the client will hang on the transport's mutex, while the
keepalive goroutine is waiting indefinitely on a channel while holding
the transport's mutex.
This fixes#1459.
This is in preparation for preventing any user-supplied metadata starting with "grpc-", which is reserved.
* stats: add methods to allow setting grpc-trace-bin and grpc-tags-bin headers
Pick these up in grpc's transport when sending and fill them when receiving.
* Add tags/trace to metadata and tests for that behavior
This is temporary to maintain compatibility and provide a migration strategy.
* First commit.
* Basic implementation
* Server should send two GoAways to gracefully shutdown the connection.
* mend
* Post-review updates
* Fixed issue after rebase
* Fixing typo
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.
* initial dns resolver impl
* add srv lookup
* more srv
* change from string to Update
* added port handling
* a complete draft for dns resovler except the polling mechanism
* added sleep to infrequently poll the DNS server
* commented out test case since they are not portable
* remove duplicate declaration/definition in grpclb
* change namespace for grpclb structures
* goimports gofmt
* fix sorting issue
* implement sort.Interface
* different sort implementation for different go version
* add missing files
* fix missing comments
* handle err
* fix comments: unexport dnsResolver and dnsWatcher, add chan to exit Next(), add freq to control polling frequency
* enhance target string handling, add static IPWatcher, add mock test
* debug travis
* disable real address resolver test, since travis return 3 resolved IPs, 2 of them are duplicates
* shorten test time by reduce sleep time in TestIPWatcher, since it doesn't really do the DNS round trip
* resolve data race
* resolve data race using waitgroup
* reimplement setHostPort, compileUpdate, unexport ipWatcher
* delete sort related stuff, fix close bug for Next(), fix compileUpdate bug(change to map[Update]bool, plus fix minor review comments
* fix minor test case
* minor change to Next()
* use net.DefaultResolver with context as input
* add different build rules for lookupHost and lookupSRV
* minor fix
* go1.6 shall fail, but 1.7, 1.8 should pass
* go1.6 is expected to pass
* all go version should pass, added pre17 and 17 for replaceNetFunc to handle context problem
* rename test helper file name. should fix build problem
* goimports
* fix 1.7 context problem
* reformat dns_resolver_test structures
* change Next() behavior to have equal stalling interval between each lookup. Restructure dns_resolver_test.
* gofmt
* update go17_test.go, go18_test.go to reuse code. dns_resolver_test: check result and behavior correctness separately.
* update Next() logic