Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

error! xhr poll error #1

Open
ReidandKat opened this issue Feb 9, 2015 · 25 comments
Open

error! xhr poll error #1

ReidandKat opened this issue Feb 9, 2015 · 25 comments

Comments

@ReidandKat
Copy link

I am receiving the following error over and over:

connected!
authenticated!
error! xhr poll error
connected!
authenticated!
error! xhr poll error
connected!
authenticated!
error! xhr poll error
connected!
authenticated!
error! xhr poll error
connected!
authenticated!
error! xhr poll error
connected!
authenticated!
error! xhr poll error
connected!
authenticated!
error! xhr poll error

The code I am using is directly copied from the example.

@MattMcNam
Copy link
Owner

Hey, sorry for the long delay in getting to this.

This seems to be caused when Streamtip's server has a lot of connections, and their own code just ignores the error and tries to reconnect, so that's all I'm going to do.

You may still see multiple connected/authenticated events, but xhr ... won't throw an error now.
I don't think this is a big problem since newTip is the main event to be watching anyway.

@MattMcNam
Copy link
Owner

This still causes problems actually and I don't like just ignoring it as a 'solution', reopening.

@MattMcNam MattMcNam reopened this Apr 3, 2015
@night
Copy link
Contributor

night commented Apr 4, 2015

I made some modifications to our nginx upstream configuration, as I believe some 0 content length responses on socket.io are causing nginx to think an upstream is encountering issues when it isn't. Please let me know if this helps (it appears to have on my end).

@night
Copy link
Contributor

night commented Apr 4, 2015

I cannot reproduce that, unfortunately. I've tested this locally with node 0.12.0. I also tested this on a BuyVM VPS running Debian 7 with node 0.10.38, and did not encounter this issue. I think there's something funky going on with your connection. Can you "curl -vvv https://streamtip.com" and see what's going on? It sounds like you're unable to connect, which I've encountered before when setting the VPS' main IP to be one of their DDoS protected IPs (although in that instance I was having trouble connecting to api.twitch.tv).

@night
Copy link
Contributor

night commented Apr 4, 2015

Is your BuyVM IP 198.98.50.142? If so, nginx is logging your requests as the following:

2015/04/03 22:34:15 [error] 14915#0: *191866 upstream prematurely closed connection while reading response header from upstream, client: 198.98.50.142, server: streamtip.com, request: "GET /socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=j2QNJM8k_ra_3GCaAALW HTTP/1.1", upstream: "http://unix:/var/run/streamtip/streamtip_2.sock:/socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=j2QNJM8k_ra_3GCaAALW", host: "streamtip.com"
2015/04/03 22:34:15 [error] 14915#0: *191866 upstream prematurely closed connection while reading response header from upstream, client: 198.98.50.142, server: streamtip.com, request: "GET /socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=j2QNJM8k_ra_3GCaAALW HTTP/1.1", upstream: "http://unix:/var/run/streamtip/streamtip_3.sock:/socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=j2QNJM8k_ra_3GCaAALW", host: "streamtip.com"
2015/04/03 22:34:15 [error] 14915#0: *191866 upstream prematurely closed connection while reading response header from upstream, client: 198.98.50.142, server: streamtip.com, request: "GET /socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=j2QNJM8k_ra_3GCaAALW HTTP/1.1", upstream: "http://unix:/var/run/streamtip/streamtip_1.sock:/socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=j2QNJM8k_ra_3GCaAALW", host: "streamtip.com"
2015/04/03 22:34:15 [error] 14915#0: *191866 upstream prematurely closed connection while reading response header from upstream, client: 198.98.50.142, server: streamtip.com, request: "GET /socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=j2QNJM8k_ra_3GCaAALW HTTP/1.1", upstream: "http://unix:/var/run/streamtip/streamtip_4.sock:/socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=j2QNJM8k_ra_3GCaAALW", host: "streamtip.com"
2015/04/03 22:34:16 [error] 14918#0: *191922 upstream prematurely closed connection while reading response header from upstream, client: 198.98.50.142, server: streamtip.com, request: "GET /socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=v9075e4pIYSlDLEcAALX HTTP/1.1", upstream: "http://unix:/var/run/streamtip/streamtip_2.sock:/socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=v9075e4pIYSlDLEcAALX", host: "streamtip.com"
2015/04/03 22:34:16 [error] 14918#0: *191922 upstream prematurely closed connection while reading response header from upstream, client: 198.98.50.142, server: streamtip.com, request: "GET /socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=v9075e4pIYSlDLEcAALX HTTP/1.1", upstream: "http://unix:/var/run/streamtip/streamtip_3.sock:/socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=v9075e4pIYSlDLEcAALX", host: "streamtip.com"
2015/04/03 22:34:16 [error] 14918#0: *191922 upstream prematurely closed connection while reading response header from upstream, client: 198.98.50.142, server: streamtip.com, request: "GET /socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=v9075e4pIYSlDLEcAALX HTTP/1.1", upstream: "http://unix:/var/run/streamtip/streamtip_1.sock:/socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=v9075e4pIYSlDLEcAALX", host: "streamtip.com"
2015/04/03 22:34:16 [error] 14918#0: *191922 upstream prematurely closed connection while reading response header from upstream, client: 198.98.50.142, server: streamtip.com, request: "GET /socket.io/?client_id=[redacted]&access_token=[redacted]&EIO=3&transport=websocket&sid=v9075e

I'm not sure why your requests are resulting in this error, so it will probably require more debugging.

@night
Copy link
Contributor

night commented Apr 4, 2015

I'm curious if there is a misconfiguration on your end, since every failing request is only websockets. Is there something on your end blocking websockets? Websockets require HTTP 1.1, so if your client or something in between doesn't support that, it could be why it's failing.

@night
Copy link
Contributor

night commented Apr 4, 2015

What changes if you enable multiplexing and modify your transports like the following:

        transports: [
            'xhr-polling', 
            'jsonp-polling', 
            'polling'
        ],

@night
Copy link
Contributor

night commented Apr 4, 2015

If you're only testing in an environment with nodecg running, perhaps you should isolate with just this package.

Additionally, client logs would be helpful. Debug instructions are here: http://socket.io/docs/logging-and-debugging/

You can debug like:

DEBUG=* node testing.js

@night
Copy link
Contributor

night commented Apr 4, 2015

Are you sure the correct version of socket.io is being loaded? Sometimes if you have a package in ~/node_modules node will prefer that over the node_modules in the app dir.

@night
Copy link
Contributor

night commented Apr 4, 2015

The socket.io in use by Streamtip is lower, 1.2.1

@night
Copy link
Contributor

night commented Apr 4, 2015

It's unfortunate, but I couldn't tell you why you're having issues connecting. Maybe try downgrading from node 0.12.x to 0.10.x, or trying a different server completely. I've tried your client id and access token, and haven't been able to reproduce any issues over at BuyVM or locally.

@MattMcNam
Copy link
Owner

I've seen the error a handful of times locally and once on my vps (81.4.106.145 if it helps, all subsequent tests connected first try), but it's usually just shown once, socket reconnects, everything's fine, not continued errors.

@night
Copy link
Contributor

night commented Apr 4, 2015

@MattMcNam Those dropped connections should be what I resolved earlier, as nginx was failing over an upstream if it returned a 5xx error (by default max_fails is set to 1 apparently). Please let me know if you are still seeing this issue often. Seeing it once in a while is normal, as sometimes updates are pushed or an uncaught error occurs (like in net calls in PayPal's sdk, for example) and requires node instances to restart.

@lange I still have a good belief there's something funky going on with the connection, somewhere. Either the protocol isn't being sent properly or for some reason a websocket cannot be established. I read over the source code that returns a "transport error," and seems to only happen when there's a socket error. Maybe you can try experimenting with what you connect to.

Change "https://streamtip.com" to the following:

http://streamtip.com
http://107.161.180.203
http://198.251.81.112
http://172.16.16.98 (BuyVM internal IP in NJ)

@night
Copy link
Contributor

night commented Apr 5, 2015

This definitely seems like a configuration issue somewhere, as the IP addresses provided point to the two nodes Streamtip uses. I'm curious if there's some sort of reverse proxy (or something similar) empoyed that doesn't support the websocket connection and is causing it to be blocked. You might also check that the DNS is resolving properly to the listed IPs. There's definitely something wrong, but I don't believe it's an issue on Streamtip's end (as I can't seem to reproduce this).

@night
Copy link
Contributor

night commented Apr 9, 2015

Since this seems like a socket.io-client library issue, I'm not sure working around a bug is a good idea. Perhaps if you can reproduce the conditions needed to make this occur, then it could potentially be traced and fixed. Were you able to reproduce this on DigitalOcean? What about another virtual machine (or the same reinstalled) at BuyVM?

This appears to be the same issue: socketio/socket.io#1942

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@MattMcNam @ReidandKat @night and others