From: Stefan Eissing Date: Wed, 22 Jun 2016 12:57:40 +0000 (+0000) Subject: mod_proxy_http2: fixed retry behaviour when proxy engine needs to retry its base... X-Git-Tag: 2.5.0-alpha~1484 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9444fc4cfa8f800fd7b2980182af8c3c7c1d9097;p=thirdparty%2Fapache%2Fhttpd.git mod_proxy_http2: fixed retry behaviour when proxy engine needs to retry its base request on a new connection git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1749676 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_ngn_shed.c b/modules/http2/h2_ngn_shed.c index 805c7d97042..a8dd0042770 100644 --- a/modules/http2/h2_ngn_shed.c +++ b/modules/http2/h2_ngn_shed.c @@ -139,6 +139,8 @@ h2_ngn_shed *h2_ngn_shed_get_shed(h2_req_engine *ngn) 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_ngn_shed *shed, "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_ngn_shed *shed, 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; } diff --git a/modules/http2/h2_proxy_session.c b/modules/http2/h2_proxy_session.c index 0cb5b1c342c..79a2e82e82d 100644 --- a/modules/http2/h2_proxy_session.c +++ b/modules/http2/h2_proxy_session.c @@ -160,14 +160,6 @@ static int on_frame_recv(nghttp2_session *ngh2, const nghttp2_frame *frame, * 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_session *session, int stream_id, 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_session *session, int stream_id, 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); } } diff --git a/modules/http2/mod_proxy_http2.c b/modules/http2/mod_proxy_http2.c index 8c8873059f6..74b3dfcd8d6 100644 --- a/modules/http2/mod_proxy_http2.c +++ b/modules/http2/mod_proxy_http2.c @@ -324,8 +324,9 @@ static apr_status_t next_request(h2_proxy_ctx *ctx, int before_leave) 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_proxy_ctx *ctx) { 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