H.Pipes
H.Pipes copied to clipboard
Large messages on .NET 6 fail to send
Describe the bug
When transferring messages larger than 65535 bytes on .NET 6 the server throws an exception stating
Expected <number of sent> bytes but read 65536
Steps to reproduce the bug
Send the contents of a 1MB file over the channel and catch the exception
Same issue whether I send a serializable object or a standard string
Expected behavior
No response
Screenshots
No response
NuGet package version
No response
Platform
Console
IDE
Visual Studio 2022
Additional context
Seems to be related to this: https://github.com/HavenDV/H.Pipes/blob/9299ffd93b5518a7c06e7fe12529bf45dfd8809c/src/libs/H.Pipes/IO/PipeStreamReader.cs#L72
This is on the base H.Pipes library, with no formatter libraries installed/in-use
Are you using Windows or another OS?
Windows 11
This is rather odd given that our tests are run on Windows and include cases where there is a 1MB data transfer. My local tests on Windows 11 also complete gracefully. Perhaps some additional conditions are required for the problem to manifest itself?
This is the sendcode I use
DelegateMessage dm;
IEnumerable<string> parts = json.SplitByLength(50000);
foreach (string part in parts)
{
if (part == parts.Last())
{
dm = new DelegateMessage()
{
uuid = message.uuid,
message = part,
final = true
};
}
else
{
dm = new DelegateMessage()
{
uuid = message.uuid,
message = part,
final = false
};
}
await this.serverPipe.WriteAsync(dm);
}
This is after I implemented chunking to work around my issue. Previously it was just one message, which was the contents of a 50MB file encoded in base64
await this.serverPipe.WriteAsync(dm);
The pipe server is just set to
this.serverPipe = new PipeServer<DelegateMessage>("mypipe");
Clarification, this happens when used on a local network. When transferring between computers. I have to divide the data into chunks through my add-on, and then collect it back on the other side.
Most likely fixed in the latest update.
sweet I'll try it out!
this looks like a limit of 64kb beyond this, more data transfer is not guaranteed from the OS side