Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket fds are leaked upon connection failure #95

Open
orishoshan opened this issue Mar 14, 2017 · 1 comment
Open

Socket fds are leaked upon connection failure #95

orishoshan opened this issue Mar 14, 2017 · 1 comment

Comments

@orishoshan
Copy link

orishoshan commented Mar 14, 2017

python 1084 3041 root 268u sock 0,7 0t0 21240 can't identify protocol
python 1084 3041 root 269u sock 0,7 0t0 21253 can't identify protocol
python 1084 3041 root 270u sock 0,7 0t0 23762 can't identify protocol

... and so on. In my case, a service was attempting to reconnect to RabbitMQ periodically after the connection was severed, and kept failing for a long time. This eventually exhausted the fd limit, making the service unable to function.

This happens when SocketTransport.connect fails to connect (specificallt, when a socket.error is closed), and the loop continues to the next iteration. In that case, the socket is never closed, and the connection is left half-closed.

These connections do not show up in netstat (on Linux). You can detect them with lsof, where they appear as "can't identify protocol".

Fixed in PR #96.

@orishoshan orishoshan changed the title Socket fds are leaked when failing to connect Socket fds are leaked upon connection failure Mar 14, 2017
orishoshan pushed a commit to orishoshan/haigha that referenced this issue Mar 14, 2017
@vitaly-krugl
Copy link

good catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants