From 7d20c5004c50e401a53ecfb009d2ed21d2748dfd Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Tue, 17 May 2016 08:03:32 +0000 Subject: [PATCH] mod_http2: fixing c->current_thread on slave connections, addresses PR 59542 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1744203 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/http2/h2_ngn_shed.c | 6 ++++++ modules/http2/h2_task.c | 3 ++- modules/http2/h2_task.h | 2 +- modules/http2/h2_worker.c | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index f69bdfb326..d2cf7279fd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_http2: tracking conn_rec->current_thread on slave connections, so + that mod_lua finds the correct one. Fixes PR 59542. [Stefan Eissing] + *) mod_proxy, mod_ssl: Handle SSLProxy* directives in sections, allowing per backend TLS configuration. [Yann Ylavic] diff --git a/modules/http2/h2_ngn_shed.c b/modules/http2/h2_ngn_shed.c index ed3459f0c8..805c7d9704 100644 --- a/modules/http2/h2_ngn_shed.c +++ b/modules/http2/h2_ngn_shed.c @@ -274,6 +274,12 @@ apr_status_t h2_ngn_shed_pull_task(h2_ngn_shed *shed, ngn->no_live++; *ptask = entry->task; entry->task->assigned = ngn; + /* task will now run in ngn's own thread. Modules like lua + * seem to require the correct thread set in the conn_rec. + * See PR 59542. */ + if (entry->task->c && ngn->c) { + entry->task->c->current_thread = ngn->c->current_thread; + } return APR_SUCCESS; } diff --git a/modules/http2/h2_task.c b/modules/http2/h2_task.c index 92029d894d..36073f772c 100644 --- a/modules/http2/h2_task.c +++ b/modules/http2/h2_task.c @@ -625,7 +625,7 @@ void h2_task_set_io_blocking(h2_task *task, int blocking) task->blocking = blocking; } -apr_status_t h2_task_do(h2_task *task) +apr_status_t h2_task_do(h2_task *task, apr_thread_t *thread) { AP_DEBUG_ASSERT(task); @@ -659,6 +659,7 @@ apr_status_t h2_task_do(h2_task *task) ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, task->c, "h2_task(%s): process connection", task->id); + task->c->current_thread = thread; ap_run_process_connection(task->c); if (task->frozen) { diff --git a/modules/http2/h2_task.h b/modules/http2/h2_task.h index 454bc376fe..c928038833 100644 --- a/modules/http2/h2_task.h +++ b/modules/http2/h2_task.h @@ -101,7 +101,7 @@ h2_task *h2_task_create(conn_rec *c, const struct h2_request *req, void h2_task_destroy(h2_task *task); -apr_status_t h2_task_do(h2_task *task); +apr_status_t h2_task_do(h2_task *task, apr_thread_t *thread); void h2_task_set_response(h2_task *task, struct h2_response *response); diff --git a/modules/http2/h2_worker.c b/modules/http2/h2_worker.c index e394298e7d..44feac14ed 100644 --- a/modules/http2/h2_worker.c +++ b/modules/http2/h2_worker.c @@ -43,7 +43,7 @@ static void* APR_THREAD_FUNC execute(apr_thread_t *thread, void *wctx) worker->get_next(worker, worker->ctx, &task, &sticky); while (task) { - h2_task_do(task); + h2_task_do(task, thread); /* report the task done and maybe get another one from the same * mplx (= master connection), if we can be sticky. */ -- 2.50.1