mod_h2: Idle H2 threads don't terminate on "graceful" Apache restart (mpm_event)
Vanilla Apache with “mpm_event” functions in the following way after a “graceful” restart:
- Old child processes which serve no requests are terminated immediately.
- Old child processes which have threads busy with existing requests are left alive. The busy threads continue to work until the requests are completed. The idle threads are terminated immediately.
This is an efficient way to handle “graceful” restarts because we can increase the ServerLimit
a lot, in order to accommodate lots of old child processes (finishing a few old connections), and have a couple of up-to-date active child processes (with lots of threads waiting to serve new clients).
The old child processes allocate very few memory resources because most of their threads are terminated.
Unfortunately, mod_http2 doesn’t honor the “graceful” restart. None of the following settings made any difference during my tests:
H2MinWorkers 1
(additionally, I figured out that this isn’t honored at all because a lot of H2 threads are always created, even for an idle Apache server which just started)H2MaxWorkerIdleSeconds 5
(the idle H2 thread live forever regardless of this setting combined withH2MinWorkers 1
)
The old Apache child processes keep all their H2 threads active forever, regardless of the fact that most of those H2 threads are idle. I will appreciate it if you can look into this.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 64 (34 by maintainers)
Commits related to this issue
- * when ongoing sessions detect that the process shuts down (for example due to a graceful restart), they now cause idle h2 workers to terminate early. This hopefully addresses #212. — committed to icing/mod_h2 by deleted user 3 years ago
- * A regression in v1.15.24 was fixed that could lead to httpd child processes not being terminated on a graceful reload or when reaching MaxConnectionsPerChild. When unprocessed h2 requests wer... — committed to icing/mod_h2 by deleted user 3 years ago
- * A regression in v1.15.24 was fixed that could lead to httpd child processes not being terminated on a graceful reload or when reaching MaxConnectionsPerChild. When unprocessed h2 requests wer... — committed to icing/mod_h2 by deleted user 3 years ago
- * mod_http2: a regression in v1.15.24 of the modules was fixed that could lead to httpd child processes not being terminated on a graceful reload or when reaching MaxConnectionsPerChild. ... — committed to apache/httpd by icing 3 years ago
- * mod_http2: a regression in v1.15.24 of the modules was fixed that could lead to httpd child processes not being terminated on a graceful reload or when reaching MaxConnectionsPerChild. ... — committed to icing/httpd by icing 3 years ago
- *) mod_http2: fixes 2 regressions in server limit handling. 1. When reaching server limits, such as MaxRequestsPerChild, the HTTP/2 connection send a GOAWAY frame much too early on new ... — committed to icing/httpd by deleted user 3 years ago
- Backport: *) mod_http2: fixes PR65731 and https://github.com/icing/mod_h2/issues/212 trunk patch: na, fixed on 2.4.x source base backport PR: https://github.com/apache/httpd/pull/281 ... — committed to apache/httpd by minfrin 3 years ago
- apache24: updated to 2.4.52 Changes with Apache 2.4.52 *) SECURITY: CVE-2021-44790: Possible buffer overflow when parsing multipart content in mod_lua of Apache HTTP Server 2.4.51 and earlier ... — committed to NetBSD/pkgsrc by deleted user 3 years ago
- apache2: upgrade 2.4.51 -> 2.4.52 Changelog: ========== *) SECURITY: CVE-2021-44790: Possible buffer overflow when parsing multipart content in mod_lua of Apache HTTP Server 2.4.51 and ear... — committed to YoeDistro/meta-openembedded by wangmingyu84 3 years ago
- apache2: upgrade 2.4.51 -> 2.4.52 Changelog: ========== *) SECURITY: CVE-2021-44790: Possible buffer overflow when parsing multipart content in mod_lua of Apache HTTP Server 2.4.51 and ear... — committed to openembedded/meta-openembedded by wangmingyu84 3 years ago
- apache2: upgrade 2.4.51 -> 2.4.52 Changelog: ========== *) SECURITY: CVE-2021-44790: Possible buffer overflow when parsing multipart content in mod_lua of Apache HTTP Server 2.4.51 and ear... — committed to openembedded/meta-openembedded by wangmingyu84 3 years ago
- apache2: upgrade 2.4.51 -> 2.4.52 Changelog: ========== *) SECURITY: CVE-2021-44790: Possible buffer overflow when parsing multipart content in mod_lua of Apache HTTP Server 2.4.51 and ear... — committed to openembedded/meta-openembedded by wangmingyu84 3 years ago
- apache2: upgrade 2.4.51 -> 2.4.52 Source: meta-openembedded MR: 114119, 114125, 115838 Type: Security Fix Disposition: Merged from meta-openembedded ChangeID: 4735d66eae043bb7e0a416d90b159838206bf7ce... — committed to MontaVista-OpenSourceTechnology/meta-openembedded by wangmingyu84 3 years ago
- apache2: upgrade 2.4.51 -> 2.4.52 Changelog: ========== *) SECURITY: CVE-2021-44790: Possible buffer overflow when parsing multipart content in mod_lua of Apache HTTP Server 2.4.51 and ear... — committed to ni/meta-openembedded by wangmingyu84 3 years ago
I think OP may see similar result, with less logging, from MaxRequestsPerChild/MaxConnectionsPerChild nonzero or MaxSpareThreads < MaxClients too.