-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Reading from named pipe seems limited to 4096 bytes #5307
Comments
Seems like this one: Thoughts @Thomasdezeeuw ? |
Yes, @carllerche wrote this code I believe. It's already a know issue, see tokio-rs/mio#1582 and tokio-rs/mio#1608, but we don't really have a good solution for it at the moment. |
Maybe we can use the length/capacity of the buffer passed in initialising or resizing the buffer. The pr I send with an additional method is not great as then we're stuck with exposing that implementation details (no other types in Mio use a buffer pool). |
I guess it makes no sense to tie the buffer size to the buffer size of the named pipe itself? May be a dumb question, but isn't it possible to allocated the buffer as needed? |
I'm not familiar enough with Window's named pipe to determine if this a good idea or not.
That's what we're already doing right now. The problem is that we pass ownership of the buffer to the Windows kernel while scheduling a read. But that doesn't work with the |
I will try and perform some tests with this.
I can also try to create/test a proof of concept for this if you'd like that. |
👍
That sounds good. I think the simplest version would be to add a capacity argument to |
First tests with a buffer of two meant significant performance degradation, but I need to dive deeper into the implications of smaller buffers.
As that is indeed awkward, how about an approach where you can provide a size but the actual size is max of the given size and the last size used? This means that buffers can grow over time if the caller increases them, but they will never become smaller. |
Here is a proof of concept commit, I'll see how it behaves later this week: Update: Never mind, this doesn't fix anything at all, we're still getting chunks of 4096 bytes at least in my example code. |
Version
tokio v1.23.0
Platform
Windows 11 64-bit
Description
I'm using Tokio as a named pipe server. However, when reading data from a pipe, I"m only getting chunks with a max of 4096 bytes, even though my vector has a higher capacity.
I tried this code:
I expected to see this happen: When connecting to this pipe from a client and sending a message of 8192 bytes, I'd expect a message of 8192 bytes coming in at the sever's end.
Instead, this happened: The message came in as two chunks of 4096 bytes in size. It seems like there is a hard limit of 4096 bytes somewhere.
The text was updated successfully, but these errors were encountered: