-
Notifications
You must be signed in to change notification settings - Fork 2k
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
testprocess: process_testStdinToStdout hanging when run non-interactively #11006
Comments
Helps: libsdl-org#11006 Signed-off-by: Simon McVittie <[email protected]>
The result of the `%` operator will be in the range 0 to 31, so it would never be 32, but it can be 0. Helps: libsdl-org#11006 Signed-off-by: Simon McVittie <[email protected]>
This will make it more obvious when writing has finished and we are only waiting for reading. Helps: libsdl-org#11006 Signed-off-by: Simon McVittie <[email protected]>
Helps: libsdl-org#11006 Signed-off-by: Simon McVittie <[email protected]>
Helps: libsdl-org#11006 Signed-off-by: Simon McVittie <[email protected]>
#11007 will hopefully help to debug this. It might be too verbose to leave it all applied, I don't know. |
… and then nothing more is read until:
|
One thing that I notice is that the stdio-based read/write interface does this:
But on my Linux system, the Perhaps on Unix systems it would be better to have a file-descriptor-backed SDL_IOStream implementation that uses |
In 7241dd9, I changed childprocess.c from character based to memory block based io: it's faster. Does reverting childprocess to character based io make any difference? |
After hacking in some code to close the stdin fd as soon as we have written everything out to the stdout fd, it looks as though a block of 8192 bytes from the middle of the input has got lost from the output, with everything after that point shifted 8192 bytes to fill the gap, and zeroes at the end of the buffer. I don't know which stage this is a problem with:
(Unfortunately the only reliable reproducer I have for this is noninteractive.) If I can't see an obvious problem from another look at the code, I'll see what happens if I make |
Is it definitely faster in practice, or just theoretically faster? (I ask because
Really? On POSIX, it looks to me as though the changes in that commit are making it blocking (the |
0.2s vs 0.7s on my system.
Oh damn, you're right. |
I'm not sure whether the result of combining buffered I/O with |
It sounds like we do want read/write based I/O here. I was trying to be clever and switched from file descriptor to FILE implementation, but maybe we should switch it back. |
Possibly fixes libsdl-org#11006
Possibly fixes libsdl-org#11006
Possibly fixes libsdl-org#11006
Possibly fixes libsdl-org#11006
Use low level non-blocking I/O for process pipe streams. This may fix issues with data not getting through the pipe occasionally. Related: libsdl-org#11006
Use low level non-blocking I/O for process pipe streams. This may fix issues with data not getting through the pipe occasionally. Related: #11006
On Unix, I think There are several layers going on here. In Unix world, the layers go like this: A pipe is basically some memory allocated inside the kernel, with file descriptors to talk to its two ends.
In a better kernel design, whether to block would be a flag that we pass to the syscall, like stdio ( The combinations are:
If you are using stdio, then On Windows, On Unix, |
I think the intent is for the child process to use stdio and flush the output. I’ll double check that when I get back to my desk. |
Use low level non-blocking I/O for process pipe streams. This may fix issues with data not getting through the pipe occasionally. Related: libsdl-org#11006
When I run
testprocess
manually, it all succeeds and is fine, but when I run it fromctest
as part of build-time testing in a Debian package, or when I run it as part ofginsttest-runner
as an "as-installed" test, it fails.The last output I see from it is:
suggesting that it has got stuck somewhere in the loop where it reads and writes stdin and stdout.
The text was updated successfully, but these errors were encountered: