Safari intermittently hangs when loading FCGI request

As you can see in attached debug log there is ±20 second delay before
returning the page to Safari 5.0.2. Profiling PHP-FPM and PHP script
itself show that they render under 0.03 seconds. The connection stall is
not happening in Firefox 3.6.10

These are the response headers in Safari:
Connection:close
Content-Type:text/html
Date:Mon, 18 Oct 2010 20:56:23 GMT
Server:nginx/0.8.52
Transfer-Encoding:Identity

These are the response headers in Firefox:
Server: nginx/0.8.52
Date: Mon, 18 Oct 2010 20:56:02 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: close

I tested Nginx 0.8.52 with gzip off, keepalive_timeout 0,
fastcgi_max_temp_file_size 0 but no difference.

nginx version: nginx/0.8.52
TLS SNI support enabled
configure arguments: --conf-path=/etc/nginx/nginx.conf
–error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid
–lock-path=/var/lock/nginx.lock
–http-log-path=/var/log/nginx/access.log
–http-client-body-temp-path=/var/lib/nginx/body
–http-proxy-temp-path=/var/lib/nginx/proxy
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi
–http-uwsgi-temp-path=/var/lib/nginx/uwsgi
–http-scgi-temp-path=/var/lib/nginx/scgi --with-debug
–with-http_stub_status_module --with-http_flv_module
–with-http_ssl_module --with-http_gzip_static_module
–with-http_realip_module --with-ipv6 --without-mail_pop3_module
–without-mail_imap_module --without-mail_smtp_module --with-file-aio
–add-module=/build/buildd/nginx-0.8.52/contrib/nginx-upload-progress-module

Hello!

On Mon, Oct 18, 2010 at 11:08:13PM +0200, Sen Haerens wrote:

Transfer-Encoding:Identity

–http-scgi-temp-path=/var/lib/nginx/scgi --with-debug
–with-http_stub_status_module --with-http_flv_module
–with-http_ssl_module --with-http_gzip_static_module
–with-http_realip_module --with-ipv6 --without-mail_pop3_module
–without-mail_imap_module --without-mail_smtp_module --with-file-aio
–add-module=/build/buildd/nginx-0.8.52/contrib/nginx-upload-progress-module

Attachments:
http://www.ruby-forum.com/attachment/5218/safari.connection.normal.log
http://www.ruby-forum.com/attachment/5219/safari.connection.slow.log
http://www.ruby-forum.com/attachment/5220/safari.connection.slow2.log

These logs doesn’t contain full logs for any single request. On
the other hand, each file contains parts of two different
connection logs. E.g. in slow2.log:

2010/10/18 23:02:48 [debug] 26728#0: *146 http finalize request: 0,
“/index.php?/jobs/” a:1, c:1
2010/10/18 23:03:19 [debug] 26728#0: *151 http finalize request: 0,
“/index.php?/estimates/” a:1, c:1

These are two distinct connections, *146 and *151. Each
connection itself doesn’t seem to be problematic.

Maxim D.

It did some further testing and Safari with User-Agent Firefox is
working correctly. Only difference I could notice is that in this case
Keep-Alive connections are enabled.

As a final solution I removed the else condition in
/src/http/ngx_http_core_module.c (line 806) that disables keep-alive
connections for Safari by default. What’s the reason this is hardcoded
by default in Nginx source?

Maybe add an option to make this user configurable in the future? Even
apple.com is sending Keep-Alive headers. I suppose they know what they
are doing. :wink:

On Tue, Oct 19, 2010 at 03:40:49PM +0200, Sen Haerens wrote:

It did some further testing and Safari with User-Agent Firefox is
working correctly. Only difference I could notice is that in this case
Keep-Alive connections are enabled.

As a final solution I removed the else condition in
/src/http/ngx_http_core_module.c (line 806) that disables keep-alive
connections for Safari by default. What’s the reason this is hardcoded
by default in Nginx source?

https://bugs.webkit.org/show_bug.cgi?id=5760


Igor S.
http://sysoev.ru/en/

Igor S. wrote in post #955427:

https://bugs.webkit.org/show_bug.cgi?id=5760

I understand but why is Keep-Alive not only disabled for POST requests
then?

On Tue, Oct 19, 2010 at 04:00:59PM +0200, Sen Haerens wrote:

Igor S. wrote in post #955427:

https://bugs.webkit.org/show_bug.cgi?id=5760

I understand but why is Keep-Alive not only disabled for POST requests
then?

POST may go on keep-alive connection after GET.


Igor S.
http://sysoev.ru/en/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs