Sitelet https://github.com/sockjs/sockjs-node/pull/179
Skip to content

Fix possible race condition in websocket heartbeat callback - #179

Merged
brycekahle merged 1 commit into
sockjs:masterfrom
dordille:master
Apr 29, 2016
Merged

brycekahle merged 1 commit into
sockjs:masterfrom
dordille:master

Conversation

@dordille

@dordille dordille commented Jun 2, 2015

Copy link
Copy Markdown

Under load I was seeing cases where heartbeat_timeout was being called when the session had already been set to null.

@brycekahle

Copy link
Copy Markdown
Contributor

I appreciate the PR. I'd like to find out the source of race condition instead of just treating the symptom. Do you have any more information on when you were seeing the error?

@Slayer95

Slayer95 commented Dec 5, 2015

Copy link
Copy Markdown

I suppose this happens if the session is closed in the 10 second window for receiving client's ping.

I'd expect calling clearTimeout when unregistering the session to fix the issue cleanly.

@JADurham909

JADurham909 commented Apr 18, 2016 •

Copy link
Copy Markdown

We are seeing this too when running webpack-dev-server. I will try to get more information.

TypeError: Cannot read property 'close' of null     at WebSocketReceiver.heartbeat_timeout (/Users/james/.npm-packages/lib/node_modules/webpack-dev-server/node_modules/sockjs/lib/trans-websocket.js:157:26)     at null._onTimeout (/Users/james/.npm-packages/lib/node_modules/webpack-dev-server/node_modules/sockjs/lib/trans-websocket.js:75:24)     at Timer.listOnTimeout (timers.js:92:15)

@tmds

tmds commented Apr 19, 2016

Copy link
Copy Markdown

ref #185

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.

5 participants