Please, help to solve HTTP keep-alive problem. Basically, I have amazon-ami linux (v2012.09) on EC2 running nginx (v1.2.6).

Chrome (v25.0.1364.99) accesses HTTP page normally, then after about 30 seconds connection dropped (unknown why) as monitored on server by netstat. After that, if chrome requests something from server, it can't receive anything and timeouts for about a minute waiting for something on apparently broken connection. After timeout subsequent requests works ok.

Nginx configured with keepalive_timeout 70s 60s;

cat /proc/sys/net/ipv4/tcp_keepalive_time shows 7200

It might be something easy, but googling revealed a lot of similar problems, but not exactly. (https://code.google.com/p/chromium/issues/detail?id=27400 read about here http://blog.fastmail.fm/2011/06/28/http-keep-alive-connection-timeouts/).

What answers would be helpful:

  • How to alter configuration of server to avoid excessive waiting on dropped connection from Chrome

  • What product might content bug or what workaround may be available

Disable keep alive for chrome is kind of last resort solutions: as it defeats the purpose as I want to reduce response latency and have long HTTP connection keep-alive time, at least a minute. Thanks

  • If you run a packet capture on the linux host, do you see the rst being sent at 30 seconds? If not, I would suspect a load balancer or firewall timeout. – Greg Askew Feb 24 '13 at 15:13
  • It might not even be your firewall, it could be the client's firewall. – DerfK Feb 24 '13 at 15:26
  • @DerfK might be, but for this specific case I tend to exclude problem somewhere before EC2 as was reproduced under different networks – Ievgen Lukash Feb 24 '13 at 18:41
  • Do a tcpdump. Which side closes the connection? Is an HTTP proxy being used? Does it happen with HTTPS? Does it happen without HTTPS on a different port? Does it happen with different browsers? Does it happen with Chrome on a different machine or OS? – mgorven Feb 28 '13 at 0:33
  • @mgorven will use your comment as action plan, currently I'm in process of setting up an HTTPS so will get some answers. Thanks! – Ievgen Lukash Feb 28 '13 at 9:25

In such environment, an HTTPS connection doesn't not get sneakily closed after 30s, so when I put a site completely under HTTPS (which was actually planned), Chrome Keep=Alive problem no longer manifest itself with Keep-Alive for a minute, which is acceptable.

Unfortunately, I had no resources to invest into TCP debugging. So puzzle is not solved completely, per se.

Many thanks for suggestions!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.