Forum: NGINX Requests being blocked client-side

2974d09ac2541e892966b762aad84943?d=identicon&s=25 justink101 (Guest)
on 2014-04-11 18:45
(Received via mailing list)
I am seeing super strange behavior and I am absolutely stumped. If I
open up
two tabs in Google Chrome (34), and in the first refresh our application
(foo.ourapp.com), which makes an ajax requests (via jQuery) that takes
20 or
so seconds to complete. Then in the other new tab hit refresh on
(foo.ourapp.com), the second tab blocks waiting until the ajax request
on
the first tab finishes. Inspecting Chrome developer tools shows:

http://cl.ly/image/1s3V353o1v2c

However, if I open up Firefox and load up (foo.ourapp.com) while the
long
running ajax request is firing in Chrome, it loads fine. Thus, I have
determined that the client (Chrome) is blocking requests client-side.
However, according to  http://www.browserscope.org/?category=network it
says
Chrome supports 6 connections per hostname, which should be fine, as I
am
only making two requests.

Any ideas on this? Pretty standard nginx config, with the following
notable
exceptions:

     listen 443 deferred ssl spdy;

     add_header Strict-Transport-Security max-age=31556926;
     add_header X-XSS-Protection "1; mode=block";
     add_header Access-Control-Allow-Origin
$scheme://$account.myapp.com;
     add_header X-Frame-Options DENY;
     add_header X-Content-Type-Options nosniff;

Running nginx/1.5.12 with SPDY 3.1.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249233,249233#msg-249233
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2014-04-11 20:41
(Received via mailing list)
Hello!

On Fri, Apr 11, 2014 at 12:45:17PM -0400, justink101 wrote:

> running ajax request is firing in Chrome, it loads fine. Thus, I have
>      add_header Strict-Transport-Security max-age=31556926;
>      add_header X-XSS-Protection "1; mode=block";
>      add_header Access-Control-Allow-Origin $scheme://$account.myapp.com;
>      add_header X-Frame-Options DENY;
>      add_header X-Content-Type-Options nosniff;
>
> Running nginx/1.5.12 with SPDY 3.1.

The "6 connections per hostname" is for normal http, not spdy - as
spdy specification requires no more than 1 connection per server
(as spdy allows to multiplex multiple requests within a single
connection).  An obvious thing to check is if the problem goes
away if you switch off spdy.

--
Maxim Dounin
http://nginx.org/
2974d09ac2541e892966b762aad84943?d=identicon&s=25 justink101 (Guest)
on 2014-04-16 10:58
(Received via mailing list)
Maxim.

Even after disabling SPDY and restarting nginx, still seeing the same
behavior with requests blocking if another single request is outstanding
in
another tab.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249233,249324#msg-249324
001e9bda984b528032b2fb7e5e7e3614?d=identicon&s=25 Lee Valentine (Guest)
on 2014-04-16 11:02
(Received via mailing list)
Hi


On 16 April 2014 09:58, justink101 <nginx-forum@nginx.us> wrote:

> Maxim.
>
> Even after disabling SPDY and restarting nginx, still seeing the same
> behavior with requests blocking if another single request is outstanding in
> another tab.


Are you using php by any chance?  I had a problem showing these exact
same
symptoms last week.  By default, php writes to files for sessions.  When
a
session is started, the file is locked by the current process and is
only
released at the end of the request or if session_write_close() is
called.
 This will cause any requests in the same session to hang until the
first
completes.  The process in this instance that is blocking is php and not
nginx.

We got around this by storing the session in Redis instead of files.

Cheers,
Lee
2974d09ac2541e892966b762aad84943?d=identicon&s=25 justink101 (Guest)
on 2014-04-17 00:59
(Received via mailing list)
Hi Lee.

Yes using PHP. Could we simply just call session_write_close()
immediately
after we open and verify the session details? I'd like to avoid adding
another piece of infrastructure (redis) on every web server.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249233,249352#msg-249352
2974d09ac2541e892966b762aad84943?d=identicon&s=25 justink101 (Guest)
on 2014-04-17 04:25
(Received via mailing list)
Lee we switched to using memcached for sessions and this helped, but
still
seeing blocking, though less time.

If we open two tabs, in the first page fire an ajax request that takes
20+
seconds to run, then in the second tab refresh, the page blocks loading
in
the second tab, but now instead of waiting the entire 20+ seconds for
the
first tab (ajax request) to finish, it only blocks around 8 seconds. See
screenshot:

http://i.imgur.com/wcpKae4.png

It seems to be consistent, nearly 8 seconds of block every time. Any
idea on
this? What other fileio could be blocking?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249233,249353#msg-249353
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.