Longpoll to SG causes time out

connections
#1

Hey all, we just popped open the logs on our servers and noticed this issue in the Nginx error logs:

upstream timed out (110: Connection timed out) while reading upstream, client: xx.213.229.86, server: , request: "GET /sync/_changes?feed=longpoll&limit=50&heartbeat=300000&style=all_docs&since=959135 HTTP/1.1", upstream: "http://10.0.1.139:80/sync/_changes?feed=longpoll&limit=50&heartbeat=300000&style=all_docs&since=959135", host: "app.example.com"

I think this correlates with this in the SG logs (not this specific one, but this type of command):

GET /db/_changes?feed=longpoll&limit=50&heartbeat=300000&style=all_docs&since=961835%3A%3A963400 (as 7PjxZnKDRkieFYFjrYbeRA)

There is no returned response…

We get the nginx error log about once per second.

Has anyone else run into this?

Thanks!
-SJ

#2

Are you using any load balancers? They could be cutting the connection due to lack of activity. Long polls are designed to be kept open for long periods of time with a heartbeat every X milliseconds (In the case of your URL 300,000 ms or 5 minutes). Load balancers often cut connections after periods of inactivity, though 1 second seems a bit extreme.

#3

Hey @borrrden, thanks for the reply!

Yes, we are using a load balancer in front, but I didn’t think it was responsible for the timeout (just for clarification, there is A timeout every second, not saying it’s the SAME timeout - we have many concurrent users).

I will take a look at my LB config and see if there is anything obviously wrong - any suggestions?

Thanks!
-SJ