fail2ban icon indicating copy to clipboard operation
fail2ban copied to clipboard

Pages load slowly when plugin enabled

Open aqos156 opened this issue 3 years ago • 1 comments

Hi, we have tried running this plugin (v0.6.6) in production to test out the fix of #52 but all the pages have started to load very slowly (before 200ms, 5-10s after enabling the plugin)

I suspect #51 to be the problem, where it always locks and waits until a requests is finished (maybe?)

aqos156 avatar Jan 18 '22 11:01 aqos156

Hello @aqos156,

Thanks for your interest in this Traefik plugin !

Oh! yeah, you might be right. The mutex is closed when the function end using a defer.

https://github.com/tomMoulard/fail2ban/blob/5b110872e0c520f95158377ab8bc190630e62360/fail2ban.go#L245

This implies that the mutext is unlocked after the HTTP request has been served.

https://github.com/tomMoulard/fail2ban/blob/5b110872e0c520f95158377ab8bc190630e62360/fail2ban.go#L297

A good fix might be to remove the defer and unlock the mutex after ipViewed has been used.

tomMoulard avatar Feb 07 '22 08:02 tomMoulard

@tomMoulard would this issue make the plugin unusable? I that is the case, I would love seeing it fixed -- it's a shame that GoLang is not my strong suite :cry:

fradeve avatar Sep 20 '23 22:09 fradeve

No, this plugin is usable as is, but it might not be as fast as it can be. Using the plugin might throttle a bit down the overall HTTP performance of the request handling of Traefik.

tomMoulard avatar Sep 20 '23 22:09 tomMoulard

As this issue is being too broad, following my comment https://github.com/tomMoulard/fail2ban/issues/59#issuecomment-1031181693, the pr #77 closes this issue.

tomMoulard avatar Oct 05 '23 08:10 tomMoulard