On Mon, May 27, 2024 at 1:04 PM <ic...@apache.org> wrote:
>
> Author: icing
> Date: Mon May 27 11:04:52 2024
> New Revision: 1918003
>
> URL: http://svn.apache.org/viewvc?rev=1918003&view=rev
> Log:
>  *) mod_http2: sync with module's github.
>     - on newer HTTPD versions, return connection monitoring
>       to the event MPM when block on client updates.
>       2.4.x versions still treat connections in the event
>       MPM as KeepAlive and purge them on load in the middle
>       of response processing.
>     - spelling fixes
>     - support for yield calls in c2 "network" filter
[]
>
> --- httpd/httpd/trunk/modules/http2/h2_c1.c (original)
> +++ httpd/httpd/trunk/modules/http2/h2_c1.c Mon May 27 11:04:52 2024
> @@ -116,7 +116,7 @@ cleanup:
>  apr_status_t h2_c1_run(conn_rec *c)
>  {
>      apr_status_t status;
> -    int mpm_state = 0;
> +    int mpm_state = 0, keepalive = 0;
>      h2_conn_ctx_t *conn_ctx = h2_conn_ctx_get(c);
>
>      ap_assert(conn_ctx);
> @@ -127,7 +127,7 @@ apr_status_t h2_c1_run(conn_rec *c)
>              c->cs->state = CONN_STATE_HANDLER;
>          }
>
> -        status = h2_session_process(conn_ctx->session, async_mpm);
> +        status = h2_session_process(conn_ctx->session, async_mpm, 
> &keepalive);
>
>          if (APR_STATUS_IS_EOF(status)) {
>              ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, c,
> @@ -153,7 +153,7 @@ apr_status_t h2_c1_run(conn_rec *c)
>              case H2_SESSION_ST_BUSY:
>              case H2_SESSION_ST_WAIT:
>                  c->cs->state = CONN_STATE_WRITE_COMPLETION;
> -                if (c->cs && !conn_ctx->session->remote.emitted_count) {
> +                if (!keepalive) {
>                      /* let the MPM know that we are not done and want
>                       * the Timeout behaviour instead of a KeepAliveTimeout
>                       * See PR 63534.

Per our discussion the other day, if you want to avoid c1 connections
to be killed by mpm_event on high load in this case, I think you can
do this here:

Index: modules/http2/h2_c1.c
===================================================================
--- modules/http2/h2_c1.c    (revision 1918003)
+++ modules/http2/h2_c1.c    (working copy)
@@ -147,6 +147,7 @@ apr_status_t h2_c1_run(conn_rec *c)
              && mpm_state != AP_MPMQ_STOPPING);

     if (c->cs) {
+        c->clogging_input_filters = 0;
         switch (conn_ctx->session->state) {
             case H2_SESSION_ST_INIT:
             case H2_SESSION_ST_IDLE:
@@ -159,6 +160,7 @@ apr_status_t h2_c1_run(conn_rec *c)
                      * See PR 63534.
                      */
                     c->cs->sense = CONN_SENSE_WANT_READ;
+                    c->clogging_input_filters = 1;
                 }
                 break;
             case H2_SESSION_ST_CLEANUP:
--

c->clogging_input_filters = 1 will tell the MPM to always call
process_connection() hooks after the WRITE_COMPLETION state did the
poll(), rather than entering the (killable) keepalive state.

Looks like the correct workaround with current mpm_event..


Regards;
Yann.

Reply via email to