Skip to content

win,pipe: restoring fallback handling for blocking pipes#4511

Merged
vtjnash merged 2 commits intolibuv:v1.xfrom
vtjnash:jn/restore-pipe-blocking-read
Aug 22, 2024
Merged

win,pipe: restoring fallback handling for blocking pipes#4511
vtjnash merged 2 commits intolibuv:v1.xfrom
vtjnash:jn/restore-pipe-blocking-read

Conversation

@vtjnash
Copy link
Copy Markdown
Member

@vtjnash vtjnash commented Aug 19, 2024

In #4470, I accidentally copied the bug from unix, where calling uv_stream_set_blocking can cause the whole process to hang on a read. However, unlike unix, where libuv attempts to set the O_NONBLOCK flag in uv_pipe_open (as long as the handle never gets passed to uv_spawn), the NT kernel is not capable of enabling OVERLAPPED operation later (but fortunately, it also cannot disable it later too).

This implementation might be good to copy to unix (using FIONREAD) to address the same bug that happens there if the user has called uv_spawn or uv_stream_set_non_blocking on this handle in the past.

In libuv#4470, I accidentally copied the bug from unix, where calling
uv_stream_set_blocking can cause the whole process to hang on a read.
However, unlike unix, where libuv attempts to set the O_NONBLOCK flag in
uv_pipe_open (as long as the handle never gets passed to uv_spawn), the
NT kernel is not capable of enabling OVERLAPPED operation later (but
fortunately, it also cannot disable it later too).

This implementation might be good to copy to unix (using FIONREAD) to
address the same bug that happens there if the user has called uv_spawn
or uv_stream_set_non_blocking on this handle in the past.
@vtjnash vtjnash mentioned this pull request Aug 19, 2024
Copy link
Copy Markdown
Member

@santigimeno santigimeno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me

@vtjnash vtjnash merged commit c869cd1 into libuv:v1.x Aug 22, 2024
@vtjnash vtjnash deleted the jn/restore-pipe-blocking-read branch August 22, 2024 15:08
@clason
Copy link
Copy Markdown
Contributor

clason commented Aug 22, 2024

(Unfortunately, it looks like the Neovim tests still hang even with this fix, albeit in a different place.... https://github.com/neovim/neovim/actions/runs/10512280463/job/29126681847?pr=29915)

@vtjnash
Copy link
Copy Markdown
Member Author

vtjnash commented Aug 22, 2024

Thanks. Looks like I missed an assignment to r. I hope #4515 should fix it

vtjnash added a commit that referenced this pull request Sep 5, 2024
Yet another followup to #4511. The functional/legacy/increment_spec.lua
test failed most of the time without this, and passes consistently with
it. It seemed unexpected this code path gets reached (perhaps imply
that the user wrote zero bytes?), but good to fix of course.
vtjnash added a commit to vtjnash/libuv that referenced this pull request Sep 30, 2024
The implementation of IPC pipe in libuv on Windows does not properly support
async reading. This means we cannot set the more parameter without likely
causing hangs. Sorry this is yet another followup to libuv#4511.

Fixes libuv#4548
santigimeno pushed a commit that referenced this pull request Oct 3, 2024
The implementation of IPC pipe in libuv on Windows does not properly support
async reading. This means we cannot set the more parameter without likely
causing hangs. Sorry this is yet another followup to #4511.

Fixes #4548
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants