Skip to content

WebSocket CLOSE_WAIT on disconnect #83

Closed
@rbranson

Description

@rbranson

If I open a bunch of WebSocket connections and then drop them, they stay in the CLOSE_WAIT state, which uses up a file descriptor until a timeout (a few minutes). This means you can pretty quickly hit max file descriptors (typically set to 1024 or 4096) if you've got a lot of people connecting and disconnecting. One can use lsof or netstat to see all the open file descriptors in CLOSE_WAIT state. A fix in the websocket.js code is to destroy the connection after receiving the end event:

this.connection.addListener('end', function(){
            self.connection.destroy();
    self._onClose();
});

This seems to solve the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions