Skip to content

StackOverflowException on .Net 6.0 #702

Open
@michaelmeling

Description

@michaelmeling

I kept running into StackOverflowException when compiled on .Net 6.0, but not .Net 5.0. The issue was mostly happening on fast networks with large packages (1MB). The reason for this was that websocket-sharp uses recursion when receiving packages. After 49 recursions, it ran out of stack memory.

I believe Net6.0 introduced some network optimiazations by increaseing buffers, or similar.

Not sure this is something everyone is exeprienceing, but the recursive architecture is inherently prone to this problem, so I suspect this is going to happen more and more as people switch to Net6.0.

As a possible solution, I will upload a pull request that flattens the receive function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions