-
Notifications
You must be signed in to change notification settings - Fork 3k
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
erts: Fix child_setup partial read #5861
erts: Fix child_setup partial read #5861
Conversation
CT Test Results 3 files 125 suites 39m 20s ⏱️ Results for commit efc7f4c. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
0ccb83e
to
96d7edd
Compare
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.
In main
there is a read(sigchld_pipe[0], ibuff, sizeof(ibuff));
.
Should that also use read_all
?
What about a write_all
? write can also return partial results according to docs.
Yes, might as well change that one also.
I've never seen a write do a partial write in practice... though I suppose it does not hurt to be extra safe. |
Fixed, please review again @sverker. |
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.
Ok, except I don't get the point of that EPIPE condition in neither write_all or read_all.
when 0 is read/written that is usually an indication that the pipe has been closed. Testcases for the old implementation of child_setup checked that this was the error code returned, so to be compatible I've had to return EPIPE for all of those as well. Strictly speaking I think it may only be one or two of the reads where is behaviour can be observed by the user, but I decided to add it for all just to be consistent. |
When calling read it may return a partial result. So we make sure that all the data is read before returning. The problem has been observed when reading the ACK message, but we use the new routine for all reads in the child so that we know that it will work everywhere.
efc7f4c
to
0d17cd6
Compare
When calling read it may return a partial result. So we make
sure that all the data is read before returning.
The problem has been observed when reading the ACK message,
but we use the new routine for all reads in the child so that
we know that it will work everywhere.