--- /dev/null
+ * mod_http2: when a server is restarted gracefully, any idle h2 worker
+ threads are shut down immediately. [Stefan Eissing]
+
+
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);
*/
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,
break;
default:
h2_session_shutdown_notice(session);
+#if !AP_MODULE_MAGIC_AT_LEAST(20120211, 110)
h2_workers_graceful_shutdown(session->workers);
+#endif
break;
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <assert.h>
#include <stddef.h>
* 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>
* @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
* 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 */
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);
}
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;
#include <http_protocol.h>
#include <http_request.h>
#include <http_log.h>
+#include <mpm_common.h>
#include "mod_http2.h"
/* 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();