sta / websocket-sharp

A C# implementation of the WebSocket protocol client and server
http://sta.github.io/websocket-sharp
MIT License
5.73k stars 1.66k forks source link

Resolved problem with StackOverflowException for .Net6.0 #703

Open michaelmeling opened 2 years ago

michaelmeling commented 2 years ago

Using StreamThreads library to flatten the recursion in receive. The flattened code has been put into StreamThreader.cs

Referencing issue #702

A fork has been created for a NET 6.0 build at https://github.com/michaelmeling/websocket-sharp

The StreamThreads library can be found at https://github.com/michaelmeling/StreamThreads

BrMatheusLopes commented 2 years ago

does not work with connection that starts with wss://

michaelmeling commented 2 years ago

My bad, had cast _stream to NetworkStream, instead of just Stream, so SslStream failed.

701982376509132690 commented 1 year ago

With your fork Close( any args ) - server part, is not working.

michaelmeling commented 1 year ago

@conspiracynomad Should be fixed

701982376509132690 commented 1 year ago

Now other issue, sometimes httpclient timeout happens

michaelmeling commented 1 year ago

Does this happen when you call Close(), or is it unrelated?

On Thu, 15 Dec 2022 at 10:13, conspiracynomad @.***> wrote:

Now other issue happens, sometimes http timeout happens

— Reply to this email directly, view it on GitHub https://github.com/sta/websocket-sharp/pull/703#issuecomment-1352762734, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQDV75HNOX73BDWOAJSIY23WNLOMXANCNFSM55IOHZEA . You are receiving this because you authored the thread.Message ID: @.***>

701982376509132690 commented 1 year ago

from stacktrace it's related to httpclient with SendAsync

701982376509132690 commented 1 year ago

Does this happen when you call Close(), or is it unrelated? On Thu, 15 Dec 2022 at 10:13, conspiracynomad @.> wrote: Now other issue happens, sometimes http timeout happens — Reply to this email directly, view it on GitHub <#703 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQDV75HNOX73BDWOAJSIY23WNLOMXANCNFSM55IOHZEA . You are receiving this because you authored the thread.Message ID: @.>

Also, yeah, issue with close not fully fixed, sometimes user connection not closes.

Daniel-O-Reilly commented 1 year ago

I don't think any of the code related to SendAsync or the sending functionality was modified in this PR. Do you have any sample code to reproduce this issue?

Is this issue reproducible on .NET 5 (or previous) using the normal websocket-sharp library without this PR?

701982376509132690 commented 1 year ago

Does this happen when you call Close(), or is it unrelated? On Thu, 15 Dec 2022 at 10:13, conspiracynomad @.> wrote: Now other issue happens, sometimes http timeout happens — Reply to this email directly, view it on GitHub <#703 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQDV75HNOX73BDWOAJSIY23WNLOMXANCNFSM55IOHZEA . You are receiving this because you authored the thread.Message ID: @.>

Apparently this happens because the connection does not have a timeout, try, for example, to connect from the client to the server, then let's say turn on the VPN, or turn off the Internet so that your connection breaks down, the bottom line is that the connection will remain "alive" after that