[PATCH] SPDY: send PING reply frame right away.

Valentin V. Bartenev vbart at nginx.com
Sat Jan 11 01:26:41 UTC 2014


On Friday 10 January 2014 02:09:32 Piotr Sikora wrote:
> # HG changeset patch
> # User Piotr Sikora <piotr at cloudflare.com>
> # Date 1389316088 -3600
> #      Fri Jan 10 02:08:08 2014 +0100
> # Node ID c26d5f5e8d74dc9ab71476688074717857df5216
> # Parent  4aa64f6950313311e0d322a2af1788edeb7f036c
> SPDY: send PING reply frame right away.
> 
> Previously, PING reply frame was queued right away, but it was send
> along subsequent response, which means that in case of long running
> request PING reply could have been delayed by more than 10 seconds,
> which is the time some browsers are waiting for a PING reply.
> 
> Those browsers would then correctly consider such connection broken
> and would resend exactly the same request over a new connection,
> which isn't safe in case of non-idempotent HTTP methods.
[..]

Thank you for the patch.  But, there is also no much sense in trying
to send queue as soon as the PING frame was added (i.e. parsed from
input buffer).

The same is true as well for your next patch for the SETTINGS frame.

I am going to fix the problem by this change:

diff -r bbf87b408b92 src/http/ngx_http_spdy.c
--- a/src/http/ngx_http_spdy.c  Fri Jan 10 02:08:12 2014 +0400
+++ b/src/http/ngx_http_spdy.c  Sat Jan 11 05:20:50 2014 +0400
@@ -378,6 +378,15 @@ ngx_http_spdy_read_handler(ngx_event_t *
         return;
     }
 
+    if (sc->last_out) {
+        if (ngx_http_spdy_send_output_queue(sc) == NGX_ERROR) {
+            ngx_http_spdy_finalize_connection(sc,
+                                    c->error ? NGX_HTTP_CLIENT_CLOSED_REQUEST
+                                             : NGX_HTTP_INTERNAL_SERVER_ERROR);
+            return;
+        }
+    }
+
     sc->blocked = 0;
 
     if (sc->processing) {

Any objections?

  wbr, Valentin V. Bartenev



More information about the nginx-devel mailing list