Comments (3)
Root Cause
- Balancer Wrapper calls connect in a new go routine: https://github.com/grpc/grpc-go/blame/bdd707e642e40cf75db5ac3f0f6af48077f48368/balancer_wrapper.go#L276C22-L276C22
- This in turn calls addrConn.connect() which briefly locks the mutex, ensures the channel is idle releases the mutex before calling resetTransport here:
Lines 914 to 925 in bdd707e
- resetTransport locks the mutex when it starts, it also sets the state to connecting to prevent parallel connections:
Lines 1234 to 1262 in bdd707e
When addrConn.connect releases the mutex after checking for idleness, another call to addrConn.connect can come in which also sees the channel as idle because resetTransport hasn't acquired the lock yet. So we have two connection attempts in parallel.
A simple fix it to set the state to connecting while addrConn.connect has the mutex locked. I tried it and it fixed the flakiness. Will discuss with the team and raise a PR.
from grpc-go.
There is roughly 0.4% flakiness when run on forge: 399 out of 100000 failures
from grpc-go.
Investigation
It looks like the subchannel picks the same address twice in case of failures
tlogger.go:116: INFO clientconn.go:1329 [core] [Channel #522 SubChannel #523]Subchannel picks a new address "127.0.0.1:44757" to connect (t=+1.285688ms)
tlogger.go:116: INFO clientconn.go:1329 [core] [Channel #522 SubChannel #523]Subchannel picks a new address "127.0.0.1:44757" to connect (t=+1.429717ms)
tryAllAddrs is being called twice.
from grpc-go.
Related Issues (20)
- How to give grpc connection Creating a Listener HOT 2
- server.ServeHTTP Experimental Status HOT 10
- Dependency on "testing" from "google.golang.org/grpc/experimental/stats" HOT 6
- encoding.GetCodec(proto.Name) broke in 1.66.0 HOT 7
- Create tests for two potential cardinality violation bugs HOT 1
- Backport #7571 to 1.66 once merged HOT 2
- Why is Metadata still being used instead of Attributes in clientconn.go? HOT 3
- Feature Request: Add Support for Generating Full Method Names List for Service-Level gRPC Interceptors
- xds: v1.66.0 regression in `xds.BootstrapContentsForTesting` HOT 11
- mem package & bufferPoolingThreshold HOT 3
- Generic Streams from protoc-gen-go-grpc are not detected by mock tools HOT 4
- Allow generated handlers to check the correct errors are returned at compile time HOT 1
- Flaky Test: xds/TestUnmarshalListener_WithUpdateValidatorFunc HOT 2
- gRPC server rarely returns UNAVAILABLE on seemingly successful requests HOT 14
- Flaky test: Test/ClientCloseReturnsEarlyWhenGoAwayWriteHangs HOT 4
- Where are the v1.66.1 release notes? HOT 3
- Uptick of FLOW_CONTROL_ERROR errors in CI after updating to 1.66.0 HOT 3
- google.golang.org/grpc v1.66.1 is missing a retraction HOT 4
- gRPC Server Sends RST_STREAM without trailers when TCP Reassembly occurs HOT 9
- 1.66.0 - increase in produced zero addresses HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-go.