-
Notifications
You must be signed in to change notification settings - Fork 3.9k
rpc: removed dependency on deprecated (*grpc.ClientConn).State() #7949
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
Conversation
Fixed the issue. A grpc update started set NextProtos on our global tls.Config object instead of making a copy with it. |
I don't think you can copy it like that; vet is going to complain. That's probably why upstream made the change begin with. |
I thought so too but it isn't complaining for some reason |
Reviewed 9 of 10 files at r3. rpc/context.go, line 73 [r3] (raw file):
nit: you can have a single comment for this entire const block when the names are descriptive. In this case, these comments aren't really useful. rpc/context.go, line 240 [r3] (raw file):
s/prioritized/prioritize/ rpc/context.go, line 248 [r3] (raw file):
"trigger"? rpc/context.go, line 250 [r3] (raw file):
instead of hanging these method on the context, can you make the dial method return a thin wrapper around the grpc.ClientConn that implements these methods? I don't see any reason to go back to the context every time. I'd use that technique to just provide exactly the API that grpc gave us and continue to use that. rpc/context.go, line 258 [r3] (raw file):
"error. state." rpc/context.go, line 260 [r3] (raw file):
seems like you could generalize this to exactly what grpc's WaitForStateChange provided. rpc/context.go, line 263 [r3] (raw file):
why not time.After? call it timeoutChan if you make the change. Comments from Reviewable |
if state == grpc.Shutdown { | ||
return nil, roachpb.NewErrorf("roachpb.Batch RPC failed as client connection was closed") | ||
} | ||
if err := s.rpcContext.WaitForConnected(s.remoteAddr, healthyTimeout); err != nil { |
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.
shouldn't WaitForConnected
take the context.Context
and fail early when it expires?
Reviewed 4 of 5 files at r1, 1 of 10 files at r3, 9 of 9 files at r4, 1 of 1 files at r5, 2 of 2 files at r6. security/tls.go, line 122 [r6] (raw file):
Have you checked this with go 1.7 vet? It's gotten better about detecting copied locks. Whether vet complains or not, it's unsafe to use this unless you can be sure that no one has started using a non-copied version of this The Go standard library ran into this and solved it for themselves with a non-public method (grumble, grumble): golang/go@d931716 (two subtly different non-public methods, in fact) Other projects appear to have copied the same code (which will need to be updated for go 1.7 as two new fields have been added to the config struct). We could do the same but this really needs to be part of the standard library (See golang/go#15771). Or maybe we could pass around Comments from Reviewable |
…iginal GRPC used to make a copy of the tls.Config when using it in grpc.NewTLS. Not making a copy lead to globally setting `(*tls.Config).NextProtos = []string{"h2"}` which messed up protocol negotation in HTTP endpoint tests. grpc/grpc-go@78e558b
Review status: all files reviewed at latest revision, 10 unresolved discussions, some commit checks failed. internal/client/rpc_sender.go, line 57 [r6] (raw file):
|
Review status: 0 of 30 files reviewed at latest revision, 10 unresolved discussions, some commit checks pending. security/tls.go, line 122 [r6] (raw file):
|
security/tls.go, line 122 [r6] (raw file):
|
Can you rebase this into two commits: 1bfe1db in one and everything else in another? Reviewed 18 of 30 files at r7, 9 of 9 files at r8, 1 of 1 files at r9, 2 of 2 files at r10. base/context.go, line 201 [r10] (raw file):
can you add comments explaining why? internal/client/rpc_sender.go, line 33 [r10] (raw file):
are these new fields still used? looks like no. internal/client/rpc_sender.go, line 64 [r10] (raw file):
while you're here, give this a better message (WaitForStateChange failed) kv/send_test.go, line 137 [r10] (raw file):
why not use the method provided by rpc/client.go, line 35 [r10] (raw file):
this comment implies a boolean return value, which is not the case. rpc/client.go, line 47 [r10] (raw file):
why shutdown? rpc/context.go, line 69 [r10] (raw file):
why is this a pointer? in fact, why does connMeta still exist at all? security/tls.go, line 122 [r6] (raw file):
|
Reviewed 5 of 5 files at r1, 9 of 9 files at r2, 10 of 10 files at r3, 9 of 9 files at r4, 1 of 1 files at r5, 2 of 2 files at r6, 30 of 30 files at r7, 9 of 9 files at r8, 1 of 1 files at r9, 2 of 2 files at r10. Comments from Reviewable |
Fixes #7430.
Tests fail with the updated dependencies.
Doesn't seem to be an issue when actually running a node.
This change is