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

Fix DoS socket/memory leak for not connected clients #185

Merged
merged 1 commit into from Nov 7, 2016

Conversation

spaceone
Copy link
Contributor

@spaceone spaceone commented Nov 6, 2016

If a client disconnects sock.close() is currently never called because one cannot shutdown a not connected client:

Traceback (most recent call last):
  File "circuits/net/sockets.py", line 460, in _close
    sock.shutdown(2)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 107] Transport endpoint is not connected

This leads to still opened file descriptors/sockets in the procees:
python 20195 spaceone 10u sock 0,6 0t0 11410688 can't identify protocol

If the server component runs for a longer time somehwen the open file descriptor limits is reached and your server is not able to react to any connection anymore:
Errno 105: No buffer space available

If a client disconnects sock.close() is currently never called because one cannot shutdown a not connected client:

Traceback (most recent call last):
  File "circuits/net/sockets.py", line 460, in _close
    sock.shutdown(2)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 107] Transport endpoint is not connected

This leads to still opened file descriptors/sockets in the procees:
python  20195 spaceone   10u  sock      0,6      0t0 11410688 can't identify protocol

If the server component runs for a longer time somehwen the open file descriptor limits is reached and your server is not able to react to any connection anymore:
Errno 105: No buffer space available
@prologic prologic merged commit dd604e3 into circuits:master Nov 7, 2016
spaceone added a commit to spaceone/circuits that referenced this pull request Jan 8, 2017
If a client disconnects sock.close() is currently never called because one cannot shutdown a not connected client:

Traceback (most recent call last):
  File "circuits/net/sockets.py", line 460, in _close
    sock.shutdown(2)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 107] Transport endpoint is not connected

This leads to still opened file descriptors/sockets in the procees:
python  20195 spaceone   10u  sock      0,6      0t0 11410688 can't identify protocol

If the server component runs for a longer time somehwen the open file descriptor limits is reached and your server is not able to react to any connection anymore:
Errno 105: No buffer space available
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

Successfully merging this pull request may close these issues.

None yet

2 participants