You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Yann Ylavic <yl...@gmail.com> on 2024/05/27 12:08:31 UTC
Re: svn commit: r1918003 - in /httpd/httpd/trunk/modules/http2: h2_c1.c h2_c2.c h2_mplx.c h2_mplx.h h2_session.c h2_session.h h2_version.h
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.
Re: svn commit: r1918003 - in /httpd/httpd/trunk/modules/http2: h2_c1.c h2_c2.c h2_mplx.c h2_mplx.h h2_session.c h2_session.h h2_version.h
Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, May 28, 2024 at 4:06 PM Stefan Eissing via dev
<de...@httpd.apache.org> wrote:
>
>
>
> > Am 28.05.2024 um 15:45 schrieb Yann Ylavic <yl...@gmail.com>:
> >
> > On Tue, May 28, 2024 at 12:47 PM Stefan Eissing via dev
> > <de...@httpd.apache.org> wrote:
> >>
> >>> Am 27.05.2024 um 14:08 schrieb Yann Ylavic <yl...@gmail.com>:
> >>>
> >>> 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;
> >>> 03465}
> >>> 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..
> >>
> >> Just so I get this right. It will return to processing after the
> >> write is done or after a POLLIN happened? In the first case, it
> >> will not have really a positive effect on worker allocations,
> >> seems to me.
> >
> > Yes, it will return to processing after POLLIN happens thanks to
> > CONN_SENSE_WANT_READ, even if there are pending output data.
> > But it's a really convoluted handling of POLLIN/POLLOUT in mpm_event,
> > with the need of that obscure c->clogging_input_filters..
> > So I just created https://github.com/apache/httpd/pull/448 to do that
> > better (and it includes the changes to h2_c1_run() too).
> > The plan could be to merge that to trunk and include it in your
> > backport proposal (if it works for you)?
> >
>
> Great!
Backport PR in https://github.com/apache/httpd/pull/449 ;)
Regards;
Yann.
Re: svn commit: r1918003 - in /httpd/httpd/trunk/modules/http2: h2_c1.c h2_c2.c h2_mplx.c h2_mplx.h h2_session.c h2_session.h h2_version.h
Posted by Stefan Eissing via dev <de...@httpd.apache.org>.
> Am 28.05.2024 um 15:45 schrieb Yann Ylavic <yl...@gmail.com>:
>
> On Tue, May 28, 2024 at 12:47 PM Stefan Eissing via dev
> <de...@httpd.apache.org> wrote:
>>
>>> Am 27.05.2024 um 14:08 schrieb Yann Ylavic <yl...@gmail.com>:
>>>
>>> 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;
>>> 03465}
>>> 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..
>>
>> Just so I get this right. It will return to processing after the
>> write is done or after a POLLIN happened? In the first case, it
>> will not have really a positive effect on worker allocations,
>> seems to me.
>
> Yes, it will return to processing after POLLIN happens thanks to
> CONN_SENSE_WANT_READ, even if there are pending output data.
> But it's a really convoluted handling of POLLIN/POLLOUT in mpm_event,
> with the need of that obscure c->clogging_input_filters..
> So I just created https://github.com/apache/httpd/pull/448 to do that
> better (and it includes the changes to h2_c1_run() too).
> The plan could be to merge that to trunk and include it in your
> backport proposal (if it works for you)?
>
Great!
>
> Regards;
> Yann.
Re: svn commit: r1918003 - in /httpd/httpd/trunk/modules/http2: h2_c1.c h2_c2.c h2_mplx.c h2_mplx.h h2_session.c h2_session.h h2_version.h
Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, May 28, 2024 at 12:47 PM Stefan Eissing via dev
<de...@httpd.apache.org> wrote:
>
> > Am 27.05.2024 um 14:08 schrieb Yann Ylavic <yl...@gmail.com>:
> >
> > 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;
> > 03465}
> > 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..
>
> Just so I get this right. It will return to processing after the
> write is done or after a POLLIN happened? In the first case, it
> will not have really a positive effect on worker allocations,
> seems to me.
Yes, it will return to processing after POLLIN happens thanks to
CONN_SENSE_WANT_READ, even if there are pending output data.
But it's a really convoluted handling of POLLIN/POLLOUT in mpm_event,
with the need of that obscure c->clogging_input_filters..
So I just created https://github.com/apache/httpd/pull/448 to do that
better (and it includes the changes to h2_c1_run() too).
The plan could be to merge that to trunk and include it in your
backport proposal (if it works for you)?
Regards;
Yann.
Re: svn commit: r1918003 - in /httpd/httpd/trunk/modules/http2: h2_c1.c h2_c2.c h2_mplx.c h2_mplx.h h2_session.c h2_session.h h2_version.h
Posted by Stefan Eissing via dev <de...@httpd.apache.org>.
> Am 27.05.2024 um 14:08 schrieb Yann Ylavic <yl...@gmail.com>:
>
> 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..
Just so I get this right. It will return to processing after the
write is done or after a POLLIN happened? In the first case, it
will not have really a positive effect on worker allocations,
seems to me.
Cheers,
Stefan
>
>
> Regards;
> Yann.