statianzo / Fleck

C# Websocket Implementation
MIT License
2.28k stars 583 forks source link

Server side queue limit #266

Closed RenaudGelai closed 10 months ago

RenaudGelai commented 5 years ago

265

AppVeyorBot commented 5 years ago

:white_check_mark: Build Fleck 0.0.43-ci completed (commit https://github.com/statianzo/Fleck/commit/4240f14f6a by @)

AppVeyorBot commented 5 years ago

:white_check_mark: Build Fleck 0.0.43-ci completed (commit https://github.com/statianzo/Fleck/commit/4240f14f6a by @)

RenaudGelai commented 5 years ago

I implemented it so that it doesn't alter the current behavior without explicitly specifying it, this way, people can simply update without worrying.

statianzo commented 5 years ago

I implemented it so that it doesn't alter the current behavior without explicitly specifying it, this way, people can simply update without worrying.

I'll release it as a major version bump to indicate possible breaking behavior.

RenaudGelai commented 5 years ago

So, you want me to change to a default 5Mb limit ?

AppVeyorBot commented 5 years ago

:white_check_mark: Build Fleck 0.0.44-ci completed (commit https://github.com/statianzo/Fleck/commit/6dbf9fd87b by @)

AppVeyorBot commented 5 years ago

:white_check_mark: Build Fleck 0.0.44-ci completed (commit https://github.com/statianzo/Fleck/commit/6dbf9fd87b by @)

darkl commented 5 years ago

I know I'm pretty late here, but I would rather using a BlockingCollection than throwing away the messages in this case.

statianzo commented 5 years ago

I know I'm pretty late here, but I would rather using a BlockingCollection than throwing away the messages in this case.

That would allow slow clients to use up the threadpool, giving the same resource exhaustion issue Fleck has (#265), just with threads instead of memory.

RenaudGelai commented 5 years ago

I know I'm pretty late here, but I would rather using a BlockingCollection than throwing away the messages in this case.

It's not throwing away the messages, it's closing the connexion because the client can't keep up, it's a pretty common mechanism in network communications.

Muny commented 4 years ago

Any news on this being merged?

RenaudGelai commented 4 years ago

Just to let you know, i forked and deployed this in production, it works well, and i don't have memory issues anymore.

Muny commented 4 years ago

Thanks for the update Renaud.

I tried this, but unfortunately it doesn't work for my application. I'm still narrowing down the issue I'm having, but so far it seems that when clients using smartphones connect to my Fleck server, then leave the web page (without closing it) the connection is left open. This is expected. However, the connection never seems to close, even when the device goes offline. This makes the messages the server sends (every 10ms or so) pile up and significantly increase memory usage.

RenaudGelai commented 4 years ago

You used the code i changed in the PR ?

Muny commented 4 years ago

You used the code i changed in the PR ?

Yes. I solved the problem by enforcing a heartbeat to be sent by the client. If the client stops sending heartbeats, the server closes the connection.