Skip to content

net/rpc: race condition in Server.ServeCodec #17239

@willfaught

Description

@willfaught

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:

477         go service.call(server, sending, mtype, req, argv, replyv, codec)
478     }
479     codec.Close()

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions