-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
TestSafeConfigSelector block issue #4942
Comments
@dfawley Hi there, below is more detail description about this issue: Test Output:
Golang stack trace
So according to the analysis above, if timeout happened first, goroutine 9 will be blocked forever. (The line number could be mismatched since the code is instrumented by the bug finding tool. config_selector_test.go:74 infers
|
But also in this case, the test has failed. I'm not super concerned about a secondary goroutine hanging in a test after it fails. It's not ideal, but it's also not worth over-complicating the code to handle more gracefully. Also, it seems the channel is buffered, so I'm not actually sure what the full set of circumstances that would lead to this would be. I could see this one hanging here:
Making that have a buffer size of 1 should fix it pretty simply, too. Aaaaand, I just noticed that you're running some pretty old code. It seems someone else noticed this already, and that's why there is now a buffer on the channel when there was not one in the version of the code you are running. (#4570) |
@dfawley Exactly. Like your mentioned, line 118 is also an potential place if fail in timeout. Same things for grpc-go/internal/resolver/config_selector_test.go Lines 49 to 50 in 997ce61
|
What version of gRPC are you using?
commit 9280052
What version of Go are you using (
go version
)?1.16
What operating system (Linux, Windows, …) and version?
Linux/Debian
What did you do?
If possible, provide a recipe for reproducing the error.
These potential blocking issues are found by our current WIP project. Some issues are hard to reproduce without our tool/instrumentation. We will release it as soon as it is ready.
This issue is part of #4672, I simply seperate them into individual issue so that we can track them one by one.
What did you expect to see?
no blocking issue
What did you see instead?
During the execution of following tests, the program might have blocking issues/deadlock at following positions if some selects/timeout are chosen/happened:
TestSafeConfigSelector (internal/resolver/config_selector_test.go)
grpc-go/internal/resolver/config_selector.go
Lines 153 to 157 in 997ce61
grpc-go/internal/resolver/config_selector_test.go
Lines 63 to 67 in 997ce61
grpc-go/internal/resolver/config_selector_test.go
Lines 114 to 123 in 997ce61
If internal/resolver/config_selector_test line 121 is chosen, then g1 will be blocked at sending to cs1Called so
grpc-go/internal/resolver/config_selector.go
Line 161 in 997ce61
cannot be unlocked. This also lead
UpdateConfigSelector
, will be blocked at lock.// g1 blocked at sending to cs1Called, mu cannot be unlock, so g2 also blocked at mu.Lock()
The text was updated successfully, but these errors were encountered: