Skip to content

WebSocket Stream write lock #117

@chorvus

Description

@chorvus

My server is crashing on:

this.connection.addListener('data', function(data){
                  ^
TypeError: Cannot call method 'addListener' of null

@transports/websocket.js:101

I traced the error and I found out that this.connection is set to null because of an error in WebSocket.prototype._write:

Error: Stream is not writable
    at Stream._writeOut (net:687:11)
    at Stream.write (net:673:17)
    at [object Object]._write (/usr/local/lib/node/.npm/socket.io/0.6.3/package/lib/socket.io/transports/websocket.js:168:21)
    at [object Object]._payload (/usr/local/lib/node/.npm/socket.io/0.6.3/package/lib/socket.io/client.js:102:28)
    at [object Object]._onConnect (/usr/local/lib/node/.npm/socket.io/0.6.3/package/lib/socket.io/transports/websocket.js:96:8)

My temporary fix to stop the crashes is to add
if ( !this.connection ) return;

just before

this.connection.addListener('data', function(data){

@transports/websocket.js:101

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