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 2021/09/10 08:14:48 UTC
svn commit: r1893214 - in /httpd/httpd/trunk: changes-entries/ modules/http2/
Author: icing
Date: Fri Sep 10 08:14:48 2021
New Revision: 1893214
URL: http://svn.apache.org/viewvc?rev=1893214&view=rev
Log:
* mod_http2: when a server is restarted gracefully, any idle h2 worker
threads are shut down immediately. [Stefan Eissing]
Added:
httpd/httpd/trunk/changes-entries/http2_graceful.txt
Modified:
httpd/httpd/trunk/modules/http2/h2_conn.c
httpd/httpd/trunk/modules/http2/h2_conn.h
httpd/httpd/trunk/modules/http2/h2_session.c
httpd/httpd/trunk/modules/http2/h2_task.c
httpd/httpd/trunk/modules/http2/h2_util.c
httpd/httpd/trunk/modules/http2/h2_version.h
httpd/httpd/trunk/modules/http2/h2_workers.c
httpd/httpd/trunk/modules/http2/h2_workers.h
httpd/httpd/trunk/modules/http2/mod_http2.c
Added: httpd/httpd/trunk/changes-entries/http2_graceful.txt
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/changes-entries/http2_graceful.txt?rev=1893214&view=auto
==============================================================================
--- httpd/httpd/trunk/changes-entries/http2_graceful.txt (added)
+++ httpd/httpd/trunk/changes-entries/http2_graceful.txt Fri Sep 10 08:14:48 2021
@@ -0,0 +1,4 @@
+ * mod_http2: when a server is restarted gracefully, any idle h2 worker
+ threads are shut down immediately. [Stefan Eissing]
+
+
Modified: httpd/httpd/trunk/modules/http2/h2_conn.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn.c?rev=1893214&r1=1893213&r2=1893214&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn.c Fri Sep 10 08:14:48 2021
@@ -148,6 +148,13 @@ apr_status_t h2_conn_child_init(apr_pool
return status;
}
+void h2_conn_child_stopping(apr_pool_t *pool, int graceful)
+{
+ if (workers && graceful) {
+ h2_workers_graceful_shutdown(workers);
+ }
+}
+
h2_mpm_type_t h2_conn_mpm_type(void)
{
check_modules(0);
Modified: httpd/httpd/trunk/modules/http2/h2_conn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn.h?rev=1893214&r1=1893213&r2=1893214&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn.h Fri Sep 10 08:14:48 2021
@@ -45,12 +45,17 @@ apr_status_t h2_conn_run(conn_rec *c);
*/
apr_status_t h2_conn_pre_close(struct h2_ctx *ctx, conn_rec *c);
-/* Initialize this child process for h2 connection work,
+/**
+ * Initialize this child process for h2 connection work,
* to be called once during child init before multi processing
* starts.
*/
apr_status_t h2_conn_child_init(apr_pool_t *pool, server_rec *s);
+/**
+ * Child is about to be stopped, release unused resources
+ */
+void h2_conn_child_stopping(apr_pool_t *pool, int graceful);
typedef enum {
H2_MPM_UNKNOWN,
Modified: httpd/httpd/trunk/modules/http2/h2_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_session.c?rev=1893214&r1=1893213&r2=1893214&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_session.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_session.c Fri Sep 10 08:14:48 2021
@@ -1912,7 +1912,9 @@ static void h2_session_ev_mpm_stopping(h
break;
default:
h2_session_shutdown_notice(session);
+#if !AP_MODULE_MAGIC_AT_LEAST(20120211, 110)
h2_workers_graceful_shutdown(session->workers);
+#endif
break;
}
}
Modified: httpd/httpd/trunk/modules/http2/h2_task.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_task.c?rev=1893214&r1=1893213&r2=1893214&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_task.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_task.c Fri Sep 10 08:14:48 2021
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <assert.h>
#include <stddef.h>
Modified: httpd/httpd/trunk/modules/http2/h2_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_util.c?rev=1893214&r1=1893213&r2=1893214&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_util.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_util.c Fri Sep 10 08:14:48 2021
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <assert.h>
#include <apr_strings.h>
#include <apr_thread_mutex.h>
Modified: httpd/httpd/trunk/modules/http2/h2_version.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_version.h?rev=1893214&r1=1893213&r2=1893214&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_version.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_version.h Fri Sep 10 08:14:48 2021
@@ -27,7 +27,7 @@
* @macro
* Version number of the http2 module as c string
*/
-#define MOD_HTTP2_VERSION "1.15.22"
+#define MOD_HTTP2_VERSION "1.15.23"
/**
* @macro
@@ -35,7 +35,7 @@
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
-#define MOD_HTTP2_VERSION_NUM 0x010f16
+#define MOD_HTTP2_VERSION_NUM 0x010f17
#endif /* mod_h2_h2_version_h */
Modified: httpd/httpd/trunk/modules/http2/h2_workers.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_workers.c?rev=1893214&r1=1893213&r2=1893214&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_workers.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_workers.c Fri Sep 10 08:14:48 2021
@@ -480,6 +480,8 @@ apr_status_t h2_workers_unregister(h2_wo
void h2_workers_graceful_shutdown(h2_workers *workers)
{
workers->shutdown = 1;
+ workers->min_workers = 1;
+ workers->max_idle_duration = apr_time_from_sec(1);
h2_fifo_term(workers->mplxs);
wake_non_essential_workers(workers);
}
Modified: httpd/httpd/trunk/modules/http2/h2_workers.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_workers.h?rev=1893214&r1=1893213&r2=1893214&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_workers.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_workers.h Fri Sep 10 08:14:48 2021
@@ -38,9 +38,9 @@ struct h2_workers {
apr_pool_t *pool;
int next_worker_id;
- apr_uint32_t min_workers;
apr_uint32_t max_workers;
- apr_interval_time_t max_idle_duration;
+ volatile apr_uint32_t min_workers; /* is changed during graceful shutdown */
+ volatile apr_interval_time_t max_idle_duration; /* is changed during graceful shutdown */
volatile int aborted;
volatile int shutdown;
Modified: httpd/httpd/trunk/modules/http2/mod_http2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/mod_http2.c?rev=1893214&r1=1893213&r2=1893214&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/mod_http2.c (original)
+++ httpd/httpd/trunk/modules/http2/mod_http2.c Fri Sep 10 08:14:48 2021
@@ -24,6 +24,7 @@
#include <http_protocol.h>
#include <http_request.h>
#include <http_log.h>
+#include <mpm_common.h>
#include "mod_http2.h"
@@ -228,7 +229,9 @@ static void h2_hooks(apr_pool_t *pool)
/* Run once after a child process has been created.
*/
ap_hook_child_init(h2_child_init, NULL, NULL, APR_HOOK_MIDDLE);
-
+#if AP_MODULE_MAGIC_AT_LEAST(20120211, 110)
+ ap_hook_child_stopping(h2_conn_child_stopping, NULL, NULL, APR_HOOK_MIDDLE);
+#endif
h2_h2_register_hooks();
h2_switch_register_hooks();
h2_task_register_hooks();