You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2016/06/22 12:57:40 UTC

svn commit: r1749676 - in /httpd/httpd/trunk/modules/http2: h2_ngn_shed.c h2_proxy_session.c mod_proxy_http2.c

Author: icing
Date: Wed Jun 22 12:57:40 2016
New Revision: 1749676

URL: http://svn.apache.org/viewvc?rev=1749676&view=rev
Log:
mod_proxy_http2: fixed retry behaviour when proxy engine needs to retry its base request on a new connection


Modified:
    httpd/httpd/trunk/modules/http2/h2_ngn_shed.c
    httpd/httpd/trunk/modules/http2/h2_proxy_session.c
    httpd/httpd/trunk/modules/http2/mod_proxy_http2.c

Modified: httpd/httpd/trunk/modules/http2/h2_ngn_shed.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_ngn_shed.c?rev=1749676&r1=1749675&r2=1749676&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_ngn_shed.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_ngn_shed.c Wed Jun 22 12:57:40 2016
@@ -139,6 +139,8 @@ h2_ngn_shed *h2_ngn_shed_get_shed(h2_req
 
 void h2_ngn_shed_abort(h2_ngn_shed *shed)
 {
+    ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, shed->c,
+                  "h2_ngn_shed(%ld): abort", shed->c->id);
     shed->aborted = 1;
 }
 
@@ -249,7 +251,7 @@ apr_status_t h2_ngn_shed_pull_task(h2_ng
                   "h2_ngn_shed(%ld): pull task for engine %s, shutdown=%d", 
                   shed->c->id, ngn->id, want_shutdown);
     if (shed->aborted) {
-        ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, shed->c,
+        ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, shed->c,
                       "h2_ngn_shed(%ld): abort while pulling requests %s", 
                       shed->c->id, ngn->id);
         ngn->shutdown = 1;
@@ -280,6 +282,12 @@ apr_status_t h2_ngn_shed_pull_task(h2_ng
         if (entry->task->c && ngn->c) {
             entry->task->c->current_thread = ngn->c->current_thread;
         }
+        if (entry->task->engine == ngn) {
+            /* If an engine pushes its own base task, and then pulls
+             * it back to itself again, it needs to be thawed.
+             */
+            h2_task_thaw(entry->task);
+        }
         return APR_SUCCESS;
     }
     

Modified: httpd/httpd/trunk/modules/http2/h2_proxy_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_proxy_session.c?rev=1749676&r1=1749675&r2=1749676&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_proxy_session.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_proxy_session.c Wed Jun 22 12:57:40 2016
@@ -160,14 +160,6 @@ static int on_frame_recv(nghttp2_session
              * that it has started processing. */
             session->last_stream_id = frame->goaway.last_stream_id;
             dispatch_event(session, H2_PROXYS_EV_REMOTE_GOAWAY, 0, NULL);
-            if (APLOGcinfo(session->c)) {
-                char buffer[256];
-                
-                h2_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0]));
-                ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03342)
-                              "h2_proxy_session(%s): recv FRAME[%s]",
-                              session->id, buffer);
-            }
             break;
         default:
             break;
@@ -1055,11 +1047,15 @@ static void ev_stream_done(h2_proxy_sess
     
     stream = nghttp2_session_get_stream_user_data(session->ngh2, stream_id);
     if (stream) {
+        int touched = (stream->data_sent || 
+                       stream_id <= session->last_stream_id);
+        int complete = (stream->error_code == 0);
         ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03364)
-                      "h2_proxy_sesssion(%s): stream(%d) closed", 
-                      session->id, stream_id);
+                      "h2_proxy_sesssion(%s): stream(%d) closed "
+                      "(complete=%d, touched=%d)", 
+                      session->id, stream_id, complete, touched);
         
-        if (!stream->data_received) {
+        if (complete && !stream->data_received) {
             apr_bucket *b;
             /* if the response had no body, this is the time to flush
              * an empty brigade which will also "write" the resonse
@@ -1077,9 +1073,6 @@ static void ev_stream_done(h2_proxy_sess
         h2_ihash_remove(session->streams, stream_id);
         h2_iq_remove(session->suspended, stream_id);
         if (session->done) {
-            int touched = (stream->data_sent || 
-                           stream_id <= session->last_stream_id);
-            int complete = (stream->error_code == 0);
             session->done(session, stream->r, complete, touched);
         }
     }

Modified: httpd/httpd/trunk/modules/http2/mod_proxy_http2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/mod_proxy_http2.c?rev=1749676&r1=1749675&r2=1749676&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/mod_proxy_http2.c (original)
+++ httpd/httpd/trunk/modules/http2/mod_proxy_http2.c Wed Jun 22 12:57:40 2016
@@ -324,8 +324,9 @@ static apr_status_t next_request(h2_prox
                                  APR_BLOCK_READ: APR_NONBLOCK_READ, 
                                  ctx->capacity, &ctx->next);
         ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, ctx->owner, 
-                      "h2_proxy_engine(%s): pulled request %s", 
+                      "h2_proxy_engine(%s): pulled request (%s) %s", 
                       ctx->engine_id, 
+                      before_leave? "before leave" : "regular", 
                       (ctx->next? ctx->next->the_request : "NULL"));
         return APR_STATUS_IS_EAGAIN(status)? APR_SUCCESS : status;
     }
@@ -384,8 +385,8 @@ static apr_status_t proxy_engine_run(h2_
         else {
             /* end of processing, maybe error */
             ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, ctx->owner, 
-                          APLOGNO(03375) "eng(%s): end of session run", 
-                          ctx->engine_id);
+                          APLOGNO(03375) "eng(%s): end of session %s", 
+                          ctx->engine_id, ctx->session->id);
             /*
              * Any open stream of that session needs to
              * a) be reopened on the new session iff safe to do so