Skip to content

Prevent infinite attempts to write to Win32 pipes #796

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

Merged
merged 1 commit into from
Jun 15, 2023
Merged

Prevent infinite attempts to write to Win32 pipes #796

merged 1 commit into from
Jun 15, 2023

Conversation

tristanlabelle
Copy link
Contributor

#781 set the PIPE_NOWAIT flag on pipes in an attempt to get posix-like semantics. However, Windows will immediately return 0 from WriteFile if the entire write would not complete. This means that asking to write more bytes than the size of the pipe's buffer will never do anything. The same applies to asking to write more bytes than is left available in the buffer.

This change keeps #781's PIPE_NOWAIT and brings back some of its pipe buffer size checking logic, with the caveat to be careful with trusting FILE_PIPE_LOCAL_INFORMATION.WriteQuotaAvailable since we've seen it return 0 when a reader is blocked waiting on the other end of the pipe.

Fixes swiftlang/sourcekit-lsp#752

@compnerd
Copy link
Member

@swift-ci please test

@compnerd
Copy link
Member

CC: @rokhinip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Large completion lists (e.g. typing "Se") break language services in VS Code on Windows
2 participants