socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

client keeps disconnecting on adding the second server instance (behind traffic manager)

Open ggrav opened this issue 12 years ago • 1 comments

I have written a chat server using socket.IO 1.1 . The server is behind a traffic manager and things work fine when I have a single server instance(1 core) deployed. The moment I deploy 2 servers (each having 1 core), I am seeing that the client keeps disconnecting the socket with "transport error" and then creates a new socket and the process keeps repeating arbitrary number of times. I am using azure websites which supports sticky connection for every connection made. I have uploaded the debug logs of both the server instances and the client @ https://gist.github.com/ggrav/cc81d190f41d721f4d38 server1.txt , server2.txt are the logs from the first and second server instance . clientLogs is the client log

copying the error snippet from the client logs

engine.io-client:polling-xhr xhr open GET: http://bubbleme.azurewebsites.net/s ocket.io/?EIO=3&transport=polling&t=1413647274795-3&b64=1&sid=d5KHKGduMabEasSmAA AX +2ms engine.io-client:polling-xhr xhr data null +4ms engine.io-client:socket probe transport "websocket" pong +28ms engine.io-client:socket pausing current transport "polling" +2ms engine.io-client:polling we are currently polling - waiting to pause +19ms engine.io-client:polling we are currently writing - waiting to pause +3ms engine.io-client:socket socket error {"description":400} +261ms socket.io-client:manager error +305ms { [Error: xhr post error] description: 4 00 } engine.io-client:socket socket close with reason: "transport error" +6ms socket.io-client:manager close +6ms socket.io-client:socket close (transport error) +1s disconnecing :null reason:transport error socket.io-client:manager will wait 1000ms before reconnect attempt +3ms engine.io-client:socket probe transport "websocket" failed because of error: s ocket closed +6ms

I can reproduce the problem by running the below client code:

var io = require("socket.io-client");

var socket = io.connect('http://bubbleme.azurewebsites.net/', , { 'force new connection' : true });

socket.on('connect', function () { socket.emit('updateLocation', 105 , '37.7873' ,'-122.4082','blah', 'ab','blah','ab', 'ab', 'ab', 'ab', 'ab', 'ab', 'blah', 'Male', 'ab', 'blah'); });

var io = require("socket.io-client");

var socket = io.connect(http://bubbleme.azurewebsites.net/, { 'force new connection' : true });

socket.on('connect', function () { console.log('socketId :' + socket.io.engine.id); socket.emit('updateLocation', num1 , '37.7873' ,'-122.4082','United States', 'ab','CA','ab', 'ab', 'ab', 'ab', 'ab', 'ab', 'CA', 'Male', 'ab', 'v1'); });

socket.on('disconnect', function (reason) { console.log("disconnecing :" + socket.io.engine.id + " reason:" + reason); });

Any ideas on whats going on?

Thanks

ggrav avatar Oct 19 '14 18:10 ggrav

That issue was closed automatically. Please check if your issue is fixed with the latest release, and reopen if needed (with a fiddle reproducing the issue if possible).

darrachequesne avatar Jan 12 '17 15:01 darrachequesne