wandenberg / redis_nginx_adapter

Adapter to use hiredis with async connections inside a nginx module
MIT License
27 stars 12 forks source link

not close socket connection cause closed connections grows #8

Open cqbupter opened 4 years ago

cqbupter commented 4 years ago

https://github.com/wandenberg/redis_nginx_adapter/blob/f3f3cbd47b2c63d72cc315d3d2acf8ae6bfb2c99/redis_nginx_adapter.c#L232

if redis server close connection after connected (such as unauthorized), the nginx will not close socket forever, we will see a growth in tcp connections with closed state and cause net socket exhausted.

wandenberg commented 4 years ago

Hi @cqbupter are you able to create an environment to reproduce the error? (docker / vagrant + curl requests for example) As the comment before the mentioned line says, this condition is a corner case and the socket should be closed by the other context. But if you can help me to reproduce, I will be happy to investigate if the correct fix is to change the above line or something else.

cqbupter commented 4 years ago

sorry for see message late. In my environment, redis server actually is a proxy developed by other teams . If a client's ip is not in allowlist, proxy will close connection immediately after connection established. I have to seek another open source redis product with similar function to reproduce , it may need a little time, thank you!