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

unexplained disconnect 'transport end' after upgrading

Open runvnc opened this issue 14 years ago • 76 comments

After adding a dependency to my package.json today I removed my node_modules and ran npm_install. I didn't specify any version number for socket.io so I guess it picked up the latest.

After I did that I noticed that within ? a minute or so of starting up my application, my socket would be disconnected and I see a 'transport end' info message in the node.js console output. I having socket.io set for websockets only. I am on Chrome 13 on Linux.

I went into package.json and set it at 0.8.7, ran npm install again, and now I am not seeing disconnects anymore.

Hopefully I wasn't just confused about something. I did go back and repeat the steps and had the same result. Sorry I don't have more specific information.

runvnc avatar Mar 03 '12 03:03 runvnc

0.9.1 could have introduced a bug with heartbeats triggering premature disconnects. I'm looking into it and might have a 0.9.2 tomorrow

rauchg avatar Mar 03 '12 03:03 rauchg

Ditto. Seeing repeated disconnects/reconnects in Chrome & FF on Mac, client & server on same machine. Easily seen from socket.io examples in the readme, default settings untouched.

mokesmokes avatar Mar 03 '12 16:03 mokesmokes

Having the same issue...I also noticed that immediately after the socket disconnected a new socket was instantiated.

Workaround for me was manually setting the close timeout:

io.configure( function() {
    io.set('close timeout', 60*60*24); // 24h time out
});

steffenwt avatar Mar 04 '12 17:03 steffenwt

I was having this problem too. Thanks steffenwt for the workaround.

Josh1billion avatar Mar 06 '12 00:03 Josh1billion

Yep, I have this error too. I started learning socket.io a few days ago and I first thought I was doing something wrong.

matzipan avatar Mar 06 '12 06:03 matzipan

Downgrading to 0.9.0 works.

Not sure if relevant, but the socket gets closed on every other heartbeat. So it goes like this

connect 
heartbeat2 gets sent and recieved all fine
heartbeat3 gets sens but never gets recieved
disconnect

Log here:

   debug - emitting heartbeat for client 18615332192056708826
   debug - websocket writing 2::
   debug - set heartbeat timeout for client 18615332192056708826
   info  - transport end
   debug - set close timeout for client 18615332192056708826
   debug - cleared close timeout for client 18615332192056708826
   debug - cleared heartbeat timeout for client 18615332192056708826
   debug - discarding transport

matzipan avatar Mar 06 '12 06:03 matzipan

I has the problem too.

I use 0.91-1 .

I try it ,but has this problem.

io.configure( function() { io.set('close timeout', 60_60_24); // 24h time out });

untosil avatar Mar 06 '12 07:03 untosil

same problem here

asuth avatar Mar 06 '12 23:03 asuth

Did you downgrade to 0.9.0 ? I now marked it as latest on NPM

rauchg avatar Mar 06 '12 23:03 rauchg

same issue here for 0.9.1-1, juste downgraded to 0.9.0, and the problem is gone.

gitawego avatar Mar 07 '12 16:03 gitawego

as a workaround you can send some keep-alives from client, for say 20 secs and immediately answer those from server:

client: setInterval(function() { socket.emit("keep-alive", null) },20*1000); server: socket.on('keep-alive', function (data) { socket.emit('keep-alive', null); });

dervsh avatar Mar 07 '12 19:03 dervsh

FWIW: If you are serving the client from a different server, and your client code is not downgraded to 0.9.0 then you'll still see the problem.

I downgraded 'socket.io' to 0.9.0 and I still saw the problem. Then I downgraded socket.io-client to 0.9.0 and I don't get the disconnect.

Also, the transports I've tried that fail are web sockets and xhr-polling.

rcadena avatar Mar 07 '12 22:03 rcadena

This issue should get closed, right?

konklone avatar Nov 24 '12 05:11 konklone

I have the same problem. But I noticed that it is because I have haproxy.

My problem is here:

frontend all 0.0.0.0:80
    default_backend www_backend
    acl is_websocket path_beg /socket.io
    acl is_websocket hdr(Upgrade) -i WebSocket
    acl is_websocket hdr_beg(Host) -i ws
    timeout client 1000

Right in the line "timeout client 1000" (I changed it to 1 second to see if it was the problem, and it was...).

So now I'm searching if there is a way to change it only for the websocket backends.

I hope this help someone :+1:

citosid avatar Apr 09 '13 21:04 citosid

FYI, I'm still seeing this issue, too, with xhr-polling and 0.9.14. There's a forced disconnect every 25 seconds. Log is identical to above.

jimwebb avatar May 16 '13 16:05 jimwebb

I can also verify that this is happening with 0.9.14 server and 0.9 client. Although it doesn't disconnect every 25 seconds, it does disconnect intermittently. I traced it to a call stream.emit('end'); in node.js' _stream_readable.js. I think it is a result of reading EOF in the buffer.

BoarK avatar May 16 '13 17:05 BoarK

@citosid why would haproxy client timeout cause this?

samsonradu avatar Sep 05 '13 07:09 samsonradu

Happening with 0.9.16. Same thing as for BoarK

lytespark avatar Dec 28 '13 15:12 lytespark

Is socket.io support dead?

joefaron avatar Jan 17 '14 02:01 joefaron

@joefaron There has to be support before it can die. So no, Socket.IO support isn't dead, it just never existed.

radicans avatar Jan 17 '14 07:01 radicans