StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.85k stars 1.5k forks source link

Multiple Connections waiting in FIN_WAIT_2 State after OS Upgrade #2611

Closed ajnavsun1806 closed 5 months ago

ajnavsun1806 commented 7 months ago

Hi,

We are facing this unique issue after NET6 migration. After every OS Upgrade, there are multiple ports which are stuck in FIN_WAIT_2 state at 6380 port. Because of which the Redis connection starts failing. image

Please let me know if you need more information. Kindly help as we are unable to root cause this issue. We are using Microsoft.Extensions.Caching.StackExchangeRedis version 6.0.25

Best Regards, Ankit

NickCraver commented 7 months ago

This looks like a ConnectionMultiplexer is being created a lot, and not around for a long-lifetime (as is the intended design). Doing this will open a socket each time, so you hit ephemeral port exhaustion due to sockets in this state.

Ultimately, I'd look at where/how you're creating multiplexers, e.g. per request instead of per application or something to that effect.

NickCraver commented 5 months ago

Closing out to tidy up - advice above on next steps :)