Skip to content

Potential socket leak #1

@trick77

Description

@trick77

Hi,

Thanks for sharing this awesome piece of code (and the funny story around it).

It looks like there's a potential connection leak if the socket (for whatever reason) is gone.

    clientSocket.on('data', function (data) {
        try {
            socket.write(data);
        } catch (error) {
            try {
                clientSocket.end();
            } catch (error) {}
            emitter.emit('error', error, 'httpsSocketData');
        }
    });

If socket.write throws an exception like "This socket is closed", the socket will show up as ESTABLISHED or FIN_WAIT2 until Node.js is being restarted. I've been unable to get rid of the socket, even socket.destroy() won't help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions