-
Notifications
You must be signed in to change notification settings - Fork 7.3k
websocket was disconnect when [email protected] #5557
Comments
Ahoy. This is an issue with the WebSocket parser used by socket.io. |
/cc @3rd-Eden |
This could be a bug in a specific parser of ws. |
Fails for me when I use node-spdy like the original poster, works with http. |
@Zurgy Sweet, thanks. |
Oh, node 0.10.5 works fine. If I get a chance later I will try and investigate further. |
Seems socket.io 0.9.14 actually uses its own parser (there's an unrelated 0.9 branch for.. confusion?) |
Hmm, just enabled node-spdy in my dev environment and it works with node-0.10.8, socket.io 0-9.14, connect 2.7.10, spdy 1.5.0. Now need to figure out why it fails in my production environment with the same versions of these packages but does work in my prod env with node 0.10.5. |
Node-0.10.7 works in my production environment where socket.io which fails with node-0.10.8. |
Okay, reproduced. Test case: https://gist.github.com/5652741 |
I also managed to trigger |
It doesn't actually seem to be necessary to use SPDY. I disabled SPDY in the browser in the test case, and it's still reproducible. |
@nathan7 - can you elaborate at all on "All the ws tests pass except for the SSL-related ones (due to unrelated changes in SSL cert strictness)"? |
oortcloud/meteorite#135 shows that HTTPS is the causative factor. SPDY is not necessary to reproduce. |
So SSL is unrelated, and perhaps is just triggering the bug because it requires larger chunks? We are just using ws in a very straightforward way, no "specific parser" I don't think. |
It is (unrelated) and it's fixed in joyent/libuv@b38c9c1. |
This seems to go away if I make socket.io use streams2 for feeding data to the parser. |
I have the same problem on ubuntu with ssl - it will forever throw "reserved fields must be empty" on a ssl connection with v0.10.8. I don't use SPDY, just https. |
Just a note: I had a problem running my node server under root privileges (so I could access the ssl certificates). When I instead copied them somewhere accessible and ran the node server without root privileges, it worked again. |
I suspect this is something odd with streams2 compatibility. I haven't yet got a repro outside socket.io, I'll try to make my test case use ws today. |
When I read indutny/node-spdy source code, I get comment '.unshift() emits readable event#195'. Hmm...? I think that it has some relation. |
In some cases, the http CONNECT/Upgrade API is unshifting an empty bodyHead buffer onto the socket. Normally, stream.unshift(chunk) does not set state.reading=false. However, this check was not being done for the case when the chunk was empty (either `''` or `Buffer(0)`), and as a result, it was causing the socket to think that a read had completed, and to stop providing data. This bug is not limited to http or web sockets, but rather would affect any parser that unshifts data back onto the source stream without being very careful to never unshift an empty chunk. Since the intent of unshift is to *not* change the state.reading property, this is a bug. Fixes nodejs#5557 Fixes socketio/socket.io#1242
It fixed and work with 0.10.10! I close this issue. Thank you for your support! |
When I update from 0.10.7 to 0.10.8, websocket disconnect with warning on upgrade.
My system use socket.io 0.9.14, express, node-spdy, ubuntu 13.04.
I change (revert) http.js#1959-1960 to use bodyHead instead of emptyBuffer, get not disconnect.
Both emptyBuffer and bodyHead is Buffer length = 0, Hmm... scope?
Please give me some advice.
The text was updated successfully, but these errors were encountered: