Skip to content
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

Large messages on .NET 6 fail to send #21

Open
checkymander opened this issue May 24, 2022 · 9 comments
Open

Large messages on .NET 6 fail to send #21

checkymander opened this issue May 24, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@checkymander
Copy link

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:

var read = await BaseStream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false);

@checkymander checkymander added the bug Something isn't working label May 24, 2022
@checkymander
Copy link
Author

This is on the base H.Pipes library, with no formatter libraries installed/in-use

@HavenDV
Copy link
Owner

HavenDV commented May 25, 2022

Are you using Windows or another OS?

@checkymander
Copy link
Author

Windows 11

@HavenDV
Copy link
Owner

HavenDV commented May 27, 2022

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?

@checkymander
Copy link
Author

checkymander commented May 27, 2022

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");

@Yakonrus
Copy link

Yakonrus commented Aug 13, 2022

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.

@HavenDV
Copy link
Owner

HavenDV commented May 25, 2023

Most likely fixed in the latest update.

@checkymander
Copy link
Author

sweet I'll try it out!

@rahul-dutt-sharma
Copy link

this looks like a limit of 64kb
beyond this, more data transfer is not guaranteed from the OS side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants