Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
io: Close and CloseWithError overwrite the error stored in a pipe #24283
Opening an issue for discussion first, since there is test coverage verifying this behavior, though it seems to only be there to check the
Since pipes are often used concurrently, and multiple calls to
But in this case, if there is an error and the
Moving the error assignment into the
I'm fairly certain that this change will break many people. However, I do agree the proposed semantics is probably preferred. In generally, the first encountered error is more accurate than some later error. For example,
My hunch was that most code which is hitting this case is probably unknowingly broken, and this is in effect fixing it. I guess we need to decide whether this would be considered a bug or not.
Thanks, looking more closely I see that concurrent Read or Write calls still need mutual exclusion around the error values, but that doesn't really matter much for the discussion of the error semantics.