tomMoulard / fail2ban

Traefik plugin on fail2ban middleware

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Websocket causes a deadlock until its closed?

AnderssonPeter opened this issue · comments

commented

Hi I'm not 100% sure as I'm a total noob when it comes to go.
But if I read the code correctly, the lock is not released until a http connection is done sending it's content?

This works great for normal requests, but when you have a websocket it can stay open for a long long time and cause all other requests to stall until its done? (in my case that's until I close my browser)

commented

I'm guessing that streaming a video/music file would cause the same issue.

Hello @AnderssonPeter,

Thanks for your interest in this Traefik plugin !

Could you provide a reproducible use case by any change ? This would help pinpoint the error you are facing.

commented

Well you start a lock before ServeHTTP, and keep that lock until after the request is done processing.

But the problem is that websockets tend to be long running, in my case I have a Home Assistant instance running that I want to protect using fail2ban.

But when you visit the home assistant, then the web page starts a websocket that is keept open until you leave the page.
So this causes all other requests that go thru fail2ban block until I leave the HomeAssistant page.

I'm 99% sure that #68 will solve this issue, but I'm not 100% sure it wont cause any other issues as I'm by no means a go developer.

commented

@tomMoulard did my explanation help?