-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
net/rpc: race condition in Server.ServeCodec #17239
Comments
I think the intent here is for the loop to block again when it loops on readRequest. How are you managing to exit the loop? We could of course fix this by adding a |
By closing the connection to shut down the server gracefully. |
CL sent. |
Change https://golang.org/cl/79515 mentions this issue: |
Awesome! Thanks @rsc! |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?It was 1.6 (on a work computer I don't have access to anymore).
What operating system and processor architecture are you using (
go env
)?It was Mac OS 10.11 (on a work computer I don't have access to anymore).
What did you do?
There's a race condition in Server.ServeCodec, where the connection is closed without waiting for all calls to finish:
In this code, the go statement is executed in a loop, and then the codec is closed immediately after the loop ends, which in the case of the jsonrpc codec closes the connection used by the calls before they can finish, resulting in errors.
The text was updated successfully, but these errors were encountered: