jchristn / WatsonWebsocket

A simple C# async websocket server and client for reliable transmission and receipt of data
MIT License
277 stars 53 forks source link

Dispose Method Makes CPU %100 and hangs #132

Closed etempm closed 1 year ago

etempm commented 1 year ago

Hi,

WcServer.Stop(); WcServer.Dispose();

If I have more than one client connected, Dispose method makes cpu usage %100 and hangs. Maybe loop in that?

etempm commented 1 year ago

I removed Stop method, and worked.

jchristn commented 1 year ago

Hi @etempm thanks for letting me know. To make sure I understand, when you call Stop followed by Dispose, the CPU spikes and hangs, but, when you only call Dispose, it does not?

jchristn commented 1 year ago

(Re-opening in case there's a fix that I need to apply)

jchristn commented 1 year ago

I just tried to replicate this using the Test.Server and Test.Client projects. I was unable to get CPU to spike on Stop and Dispose or just Dispose alone. image

Please let me know if you are able to reliably reproduce this behavior, I'd love to fix it!

Cheers, Joel

etempm commented 1 year ago

Thank you. It is not always being. By the way, Dispose method also calls stop, son not important for me. I deleted stop method and no problem now.