abourget/gevent-socketio — pull request #162 by juhal (2013-10-02 16:53:09+00:00)
Title: Prevent leaking of namespace processes when a socket is closed by a sock...

...et process.

Socket.disconnect() is expected to cleanup all namespaces attached to the socket. However if the method is called by a process that is attached to the socket, the last namespace is not properly cleaned because the process is killed during the call to remove_namespace and it never gets to call kill_local_jobs. Processes spawned by the namespace are leaked unless they monitor the socket state and exit on disconnect. This happens e.g. when send_into_ws process (in WebsocketTransport) calls socket.disconnect after it fails to send data to the client. Also _heartbeat_timeout process triggers the bug if it times out.