Mvp fixes #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "mvp_fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A set of fixes to make the primary sponsor's MVP work
assigned to @geoff
added 7 commits
63843ecb- 1 commit from branchmasterf64bdd40- We may or may not have an objcore71281335- The stdin filedescriptor needs to be non-blocking2b1c5d9a- No need to close file descriptors which we dup2() toba3d530a- Close all file descriptors for the external program0b12aa09- Test two pipe VDPs in a rowe16dc7b0- Improve VDP_END handlingCompare with previous version
I don't follow "Somehow related: - do not wait for the program to close stderr" -- why not? From the look of things, we're no longer reading stderr at all. As indicated by this hunk, and I don't see any stderr output in any of the vtc logs. When I run the coverage target (make -j10 coverage), it shows that none of the code to read stderr is executed (starting at about line 498 of the C source). Further down, we have loop continue on the POLLIN event for stderr.
The docs say that the VDP/(future VFP) reads stderr and writes it to the log. You know how I am, if the docs say something, I consider it an obligation.
I don't remember if we ever discussed capturing stderr as a minimal requirement (it's been a while), but it just seems obvious to me. If someone is using the pipe VDP and it's not working, they need to see the error message, otherwise the problem may be impossible to diagnose.
If we want to leave out stderr altogether, we might as well remove all of the code related it. Then we only have two fd's to deal with. But I think that would be a bad idea.
If for some reason your application has a need to ignore stderr, what if we make that a configurable option? IMO in general (not just for a specific application), a VD/FP like this that makes stderr in accessible isn't "minimally viable".
As mentioned above, this looks to me like we ignore stderr altogether.
On the positive side, I see the point here, this is a good idea.
For my understanding, isn't the point here actually to close all non-std* fd's that were inherited after fork? This happens before execve(), and it's easy to see why we need to do that. In contrast, I'm not quite following the bit in the commit message about the second external program and stdin's write end. %^) Don't interactions with another program like that happen after the execve()? I'm not seeing how we have any influence at this point on what happens to fd's after the newly exec'd process starts.
@slink I'm concerned about what seems to be the complete disappearance of stderr; other than that it's all lgtm.
The coverage report (make -j10 coverage) says that these lines (from line 481 in vdfp_pipe.c) are never executed during the tests, after
nybtesare returned fromread(2):Probably because we're now closing fd's earlier (and maybe because we're skipping over stderr?). It might be worth it to consider whether the 0-byte read can provably never happen and we can safely remove these lines (maybe AN(nbytes) after read(2)).
I wrote down a couple of other questions in the comments, more about my own understanding.
On a second external progam would also hold the stdin pipe's write end open. from the commit message:
Before addition of the
VSUB_closefrom()this would happen:read(0)because the write-end of that pipe is still open in program2In other words, this prevented a setup with more than two programs in a pipeline to work at all.
This block checks for POLLHUP on either stdin or stderr.
If we stderr is closed by the peer, we also close stderr, as before.
The change is that if the peer closes stdin, we also close stderr.
This is to ensure that if any tool we start in the pipeline misses to close its stderr, we do not wait for this to happen. In my mind, once we have received all payload, we should be done with the program and not wait for it to close stderr eventually.
The actual read of stderr happens just below this block identical for stdin and stderr, and is unchanged.
I have also added a commit to test that we actually log stderr.
added 1 commit
c462dc54- Test that we capture stderrCompare with previous version
see next discussion
added 1 commit
26fafeb6- Assert that, for POLLIN received, there actually is data to be readCompare with previous version
Right. I agree that the presence of POLLHUP should be reliable, such that we can assert that whenever we receive a POLLIN, there is data available to read.
I have added a commit to that effect
As discussed 1:1 you convinced me that we should really capture stderr to provide proper diagnosis information.
I will change that commit and force push.
added 3 commits
32258d50- Improve VDP_END handling88f9b872- Test that we capture stderr684aa039- Assert that, for POLLIN received, there actually is data to be readCompare with previous version
done, force-pushed
@slink I'm now getting an error in append.vtc:
added 9 commits
6663055d- 1 commit from branchmasterdcc7f1be- We may or may not have an objcore631443ec- The stdin filedescriptor needs to be non-blocking937622d9- No need to close file descriptors which we dup2() tod1c7d43c- Close all file descriptors for the external program0ac4b2d4- Test two pipe VDPs in a rowae6c25d0- Improve VDP_END handling69d0f64a- Test that we capture stderrcf74f76c- Assert that, for POLLIN received, there actually is data to be readCompare with previous version
@geoff this should be fixed now. I missed to add tolerance for one possible change in ordering
@slink I'm sorry, but I'm still getting an error, the Error messages in append.vtc are still coming in a different order than what logexpect wants. Will attach append.log
added 2 commits
b1ec77f9- Test that we capture stderrb5f25139- Assert that, for POLLIN received, there actually is data to be readCompare with previous version
sigh sorry @geoff , same thing again. Any change now?
merged
All green and lgtm now, and merged. Thanks @slink!