-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clientconn: go idle if conn closed after preface received #5714
Conversation
ping @dfawley ~ |
The select branch will be selected randomly, if there are several ready branches. If the preface has been received and then connection is closed, the `createTransport` might hit the `connClosed.Done()` branch. Ideally, the subConn should go idle and reconnect. Fixes: grpc#5688 Signed-off-by: Wei Fu <fuweid89@gmail.com>
Hi @zasweq would you mind to take a look on this? Thanks We are hitting this issue if my understanding is correct ~ |
Sorry, I was out of town for a few days; I can review this. Close+reopen to make GA run the recently-added Go 1.19 tests. |
I believe in the event this case of the (By the same logic, I think setting the state to IDLE in the case where the preface was received but |
Maybe there's a misunderstanding as to the functionality here? gRPC will not reconnect automatically unless there is a new RPC or |
Hi @dfawley thanks for the review. In the
For the unary call, the caller's goroutine is just waiting to get subConn. The gRPC client's background loop-goroutine will try to connect it if the subConn is idle. grpc-go/balancer/base/balancer.go Line 205 in fe59226
|
It seems that the CI issue https://github.com/grpc/grpc-go/actions/runs/3269279382/jobs/5376604126 is not related to this change. |
Flaky test is #5631 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, I see. I think this is fine, then. What we really need to do is make the preface receipt part of creating the transport, synchronously, to avoid all this extra complexity. But this fixes the small race that we have, so LGTM.
reopen to rerun CI. |
Thanks for your contribution @fuweid !! |
Thanks for the review! |
Fixes #5688
The select branch will be selected randomly, if there are several ready
branches. If the preface has been received and then connection is
closed, the
createTransport
might hit theconnClosed.Done()
branch.Ideally, the subConn should go idle and reconnect.
RELEASE NOTES: