summaryrefslogtreecommitdiff
path: root/server
Commit message (Collapse)AuthorAgeFilesLines
...
* mpm_event: Follow up to r1899858: Avoid explicit sleep.Yann Ylavic2022-04-141-12/+11
| | | | | | | | | | Instead, we can simply go to ap_wait_or_timeout() again. While at it, improve the comment about killed processes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899865 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Handle children killed pathologically.Yann Ylavic2022-04-141-3/+24
| | | | | | | | | | | | | If children processes get killed (SIGSEGV/SIGABRT/..) early after starting or frequently enough then we never enter perform_idle_server_maintenance() to try something. Below three successive children killed restart them immediately, above three let's sleep the usual 1s (to avoid fork()s flood) and do the idle maintenance. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899858 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Follow up to r1899777: Fix max_daemon_used.Yann Ylavic2022-04-131-9/+7
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899812 13f79535-47bb-0310-9956-ffa450edef68
* Merge PR 311:Stefan Eissing2022-04-131-418/+257
| | | | | | | | | | | | | | | | *) core/mod_http: use REQUEST meta buckets and a new HTTP/1.x specific input filter to separate the handling for HTTP requests from the handling of HTTP/1.x request parsing and checks. A new HTTP1_REQUEST_IN filter installs itself on http/1.1 connections before a request is being read. It generates either a REQUEST meta bucket on success or an ERROR bucket with the proposed response status. The core connection processing, relying on ap_read_request(), now expects a REQUEST or ERROR bucket from the input filters and is agnostic to specific HTTP versions and how they bring requests into the server. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899799 13f79535-47bb-0310-9956-ffa450edef68
* Remove libsystemd dependency from main httpd binaryJoe Orton2022-04-121-36/+26
| | | | | | | | | | | | | | | Until this change httpd was linking libsystemd to the main httpd binary. If you want to run lightweight version of httpd in container, sometimes you just want to install httpd binary with as little dependencies as possible to make container small in size and do not pull uncencessary dependencies and libraries. This change will move all systemd library calls from listen.c to mod_systemd module and remove systemd linking from the main httpd bin. Fixed mixed declaration and wrongly declared variable. Submitted by: Luboš Uhliarik <luhliari redhat.com> Github: closes #312 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899784 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Fix accounting of active/total processes on ungraceful restart.Yann Ylavic2022-04-121-52/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Children processes terminated by ap_{reclaim,relieve}_child_processes() were were not un-accounted for total_daemons and active_daemons, which was done in server_main_loop() only. This led to perform_idle_server_maintenance() thinking it was over the limit of children processes and never create new ones. Have this accounting right in event_note_child_{started,stopped}() which is called both at runtime and reload time. * server/mpm/event/event.c(struct event_retained_data): Rename field max_daemons_limit to max_daemon_used to better describe what it's about and to align with AP_MPMQ_MAX_DAEMON_USED. * server/mpm/event/event.c(event_note_child_stopped): Renamed from event_note_child_killed() to clarify that it's not only called when a child is killed (i.e. on restart) but whenever a child has stopped. * server/mpm/event/event.c(event_note_child_stopped): Move decrementing {active,total}_daemons and marking child's threads as SERVER_DEAD from server_main_loop() so that it's done both at runtime and reload time. Log the current number/state of daemons at APLOG_DEBUG level for each child stopped. * server/mpm/event/event.c(event_note_child_started): Move incrementing {active,total}_daemons from make_child() for symmetry, given that make_child() calls event_note_child_started(). Log the current number/state of daemons at APLOG_DEBUG level for each child started. * server/mpm/event/event.c(perform_idle_server_maintenance): Fix possible miscounting of retained->max_daemon_used accross the multiple calls to perform_idle_server_maintenance() if ListenCoresBucketsRatio > 0. Pass an int *max_daemon_used which starts at zero and is bumped consistently for all the buckets, while retained->max_daemon_used is updated only after all the buckets have been maintained. * server/mpm/event/event.c(perform_idle_server_maintenance): Use event_note_child_stopped() to handle exited children processes. Fixes: BZ 66004 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899777 13f79535-47bb-0310-9956-ffa450edef68
* *) core/mod_http: use RESPONSE meta buckets and a new HTTP/1.x specificStefan Eissing2022-04-071-39/+19
| | | | | | | | | | | | | | filter to send responses through the output filter chain. Specifically: the HTTP_HEADER output filter and ap_send_interim_response() create a RESPONSE bucket and no longer are concerned with HTTP/1.x serialization. A new HTTP1_RESPONSE_OUT transcode filter writes the proper HTTP/1.x bytes when dealing with a RESPONSE bucket. That filter installs itself on the pre_read_request hook when the connection has protocol 'http/1.1'. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899648 13f79535-47bb-0310-9956-ffa450edef68
* *) core: make ap_escape_quotes() work correctly on stringsStefan Eissing2022-04-061-5/+8
| | | | | | | | | with more than MAX_INT/2 characters, counting quotes double. Credit to <generalbugs@zippenhop.com> for finding this. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899609 13f79535-47bb-0310-9956-ffa450edef68
* *) core/mod_http/mod_http2:Stefan Eissing2022-04-043-1/+323
| | | | | | | | | | | | | | | | | | | - adds new meta bucket types REQUEST, RESPONSE and HEADERS to the API. - adds a new method for setting standard response headers Date and Server - adds helper methods for formatting parts of HTTP/1.x, like headers and end chunks for use in non-core parts of the server, e.g. mod_proxy - splits the HTTP_IN filter into a "generic HTTP" and "specific HTTP/1.x" filter. The latter one named HTTP1_BODY_IN. - Uses HTTP1_BODY_IN only for requests with HTTP version <= 1.1 - Removes the chunked input simulation from mod_http2 - adds body_indeterminate flag to request_rec that indicates that a request body may be present and needs to be read/discarded. This replaces logic that thinks without Content-Length and Transfer-Encoding, no request body can exist. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899547 13f79535-47bb-0310-9956-ffa450edef68
* *) core: adding a new hook and method to the API:Stefan Eissing2022-03-182-0/+68
| | | | | | | | | | | | | | | | | create_secondary_connection and ap_create_secondary_connection() to setup connections related to a "master" one, as used in the HTTP/2 protocol implementation. *) mod_http2: using the new API calls to get rid of knowledge about how the core handles conn_rec specifics. Improvements in pollset stream handling to use less sets. Using atomic read/writes instead of volatiles now. Keeping a reserve of "transit" pools and bucket_allocs for use on secondary connections to avoid repeated setup/teardowns. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899032 13f79535-47bb-0310-9956-ffa450edef68
* core: Make sure and check that LimitXMLRequestBody fits in system memory.Yann Ylavic2022-03-073-3/+16
| | | | | | | | | | | | LimitXMLRequestBody can not exceed the size needed to ap_escape_html2() the body without failing to allocate memory, so enforce this at load time based on APR_SIZE_MAX, and make sure that ap_escape_html2() is within the bounds. Document the limits for LimitXMLRequestBody in our docs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898686 13f79535-47bb-0310-9956-ffa450edef68
* core: Simpler connection close logic if discarding the request body fails.Yann Ylavic2022-03-071-20/+8
| | | | | | | | | If ap_discard_request_body() sets AP_CONN_CLOSE by itself it simplifies and allows to consolidate end_output_stream() and error_output_stream(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898683 13f79535-47bb-0310-9956-ffa450edef68
* *) mod_watchdog: add assertions to cleanup codeStefan Eissing2022-02-251-6/+13
| | | | | | | | | | *) core/mpm_preform: do not invoke the fancy new child_stopping/stopped hooks when invoked from a signal handler. This is a stopgap to some strange behaviour in need of some deeper insight. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898418 13f79535-47bb-0310-9956-ffa450edef68
* *) core/prefork: run new hook `child_stopped` only on clean exit.Stefan Eissing2022-02-241-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898381 13f79535-47bb-0310-9956-ffa450edef68
* * core/mpm: add hook 'child_stopped` that gets called when the MPM hasStefan Eissing2022-02-245-1/+10
| | | | | | | | | | stopped all processing in a child process. This is when all running threads shall be stopped and joined. [Stefan Eissing] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898369 13f79535-47bb-0310-9956-ffa450edef68
* *) mpm/winnt: add running the 'child_stopping' hook.Stefan Eissing2022-02-221-0/+7
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898317 13f79535-47bb-0310-9956-ffa450edef68
* There is no point in calling ap_varbuf_grow() here, it is alreadyChristophe Jaillet2022-02-211-2/+1
| | | | | | | | | called from within ap_varbuf_strmemcat(). Moreover, 2nd parameter should be the minimum total new length, not the amount of the growth. So this call is likely to be a no-op. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898286 13f79535-47bb-0310-9956-ffa450edef68
* *) core/mod_ssl/mpm_event: reverting changes to nonblocing SSL handshakesStefan Eissing2022-02-041-91/+15
| | | | | | | | | | to stabilize CI tests again. Previous revision of trunk has been copied to branches/trunk-ssl-handshake-unblocking to make those into a PR where changes can be discussed and tested separately. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897760 13f79535-47bb-0310-9956-ffa450edef68
* core: Follow up to r1897240: Provide/export ap_thread_current_create()Yann Ylavic2022-02-021-3/+3
| | | | | | | | For completness, and possibly to ease backport to 2.4.x for MPM winnt. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897691 13f79535-47bb-0310-9956-ffa450edef68
* core: Follow up to r1897240: Opt-out for AP_HAS_THREAD_LOCAL and/or pcre's ↵Yann Ylavic2022-02-022-6/+6
| | | | | | | | | | | | | | usage. If the compiler's thread_local is not efficient enough on some platforms, or not desired, have a way to disable its usage in httpd (at compile time). Handle -DAP_NO_THREAD_LOCAL and/or -DAPREG_NO_THREAD_LOCAL as build opt-out for thread_local usage in httpd gobally and/or in ap_regex only (respectively). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897689 13f79535-47bb-0310-9956-ffa450edef68
* main: Follow up to r1897240: Fix bad log copypasta.Yann Ylavic2022-02-021-3/+3
| | | | | | | | | Don't stderr printf the "stat" and "failed" results from the previous apr_app_initialize() call for an error in ap_thread_main_create(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897680 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: Follow up to r1897240: Fetch the ovector _after_ the match.Yann Ylavic2022-02-011-18/+6
| | | | | | | | | Possibly(?) pcre2_match() can modifiy the given pcre2_match_data and invalidate the old ovector, be safe and fetch it after. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897651 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Use APR_POLLEXCL when available to prevent thundering hurd.Yann Ylavic2022-01-271-0/+9
| | | | | | | | | | | | If APR_POLLEXCL is available, use it to prevent the thundering herd issue. The listening sockets are potentially polled by all the children at the same time, when new connections arrive this avoids all of them to be woken up while most would get EAGAIN on accept(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897551 13f79535-47bb-0310-9956-ffa450edef68
* core: Follow up to r1897460: Provide ap_thread_main_create().Yann Ylavic2022-01-275-101/+59
| | | | | | | | | | | | | Replace ap_thread_current_create() by ap_thread_main_create() which is how it's used by httpd. The former is now a local helper only to implement the latter. This allows to consolidate/factorize common code in the main() of httpd and the unix MPMs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897543 13f79535-47bb-0310-9956-ffa450edef68
* core: Follow up to r1897460: Implement and use ap_thread_current_after_fork().Yann Ylavic2022-01-255-32/+23
| | | | | | | | | | | | | | | | | | | | | | | | | thread_local variables are not (always?) reset on fork(), so we need a way to set the current_thread to NULL in the child process. Implement and use ap_thread_current_after_fork() for that. * include/httpd.h: Define ap_thread_current_after_fork(). * server/util.c: Implement ap_thread_current_after_fork(). * server/mpm/event/event.c, server/mpm/prefork/prefork.c, server/mpm/worker/worker.c: Use ap_thread_current_after_fork(). * server/mpm/winnt/child.c: Windows processes are not fork()ed and each child runs the main(), so ap_thread_current_create() was already called there. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897472 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1897460: !APR_HAS_THREAD implies no ap_thread_* either.Yann Ylavic2022-01-251-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897462 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1897460: APLOGNOs.Yann Ylavic2022-01-254-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897461 13f79535-47bb-0310-9956-ffa450edef68
* core: Efficient ap_thread_current() when apr_thread_local() is missing.Yann Ylavic2022-01-257-73/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #define ap_thread_create, ap_thread_current_create and ap_thread_current to their apr-1.8+ equivalent if available, or implement them using the compiler's thread_local mechanism if available, or finally provide stubs otherwise. #define AP_HAS_THREAD_LOCAL to 1 in the two former case or 0 otherwise, while AP_THREAD_LOCAL is defined to the compiler's keyword iff AP_HAS_THREAD_LOCAL. Replace all apr_thread_create() calls with ap_thread_create() so that httpd threads can use ap_thread_current()'s pool data as Thread Local Storage. Bump MMN minor. * include/httpd.h(): Define AP_HAS_THREAD_LOCAL, AP_THREAD_LOCAL (eventually), ap_thread_create(), ap_thread_current_create() and ap_thread_current(). * server/util.c: Implement ap_thread_create(), ap_thread_current_create() and ap_thread_current() when APR < 1.8. * modules/core/mod_watchdog.c, modules/http2/h2_workers.c, modules/ssl/mod_ssl_ct.c: Use ap_thread_create() instead of apr_thread_create. * server/main.c: Use AP_HAS_THREAD_LOCAL and ap_thread_current_create instead of APR's. * server/util_pcre.c: Use AP_HAS_THREAD_LOCAL and ap_thread_current instead of APR's. * server/mpm/event/event.c, server/mpm/worker/worker.c, server/mpm/prefork/prefork.c: Use ap_thread_create() instead of apr_thread_create. Create an apr_thread_t/ap_thread_current() for the main chaild thread usable at child_init(). * server/mpm/winnt/child.c: Use ap_thread_create() instead of CreateThread(). Create an apr_thread_t/ap_thread_current() for the main chaild thread usable git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897460 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: Follow up to r1897240: #if APR_HAS_THREAD_LOCAL, not #ifdef.Yann Ylavic2022-01-252-6/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897459 13f79535-47bb-0310-9956-ffa450edef68
* Begone, foul tabs.Graham Leggett2022-01-241-5/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897424 13f79535-47bb-0310-9956-ffa450edef68
* event: Add AP_MPM_CAN_AGAIN and AGAIN to signal to the MPM thatGraham Leggett2022-01-241-3/+8
| | | | | | | non blocking behaviour is requested. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897423 13f79535-47bb-0310-9956-ffa450edef68
* Add missing log message tag.Graham Leggett2022-01-231-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897388 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: Follow up to r1897240: cleanup PCRE2 match data on exit.Yann Ylavic2022-01-231-4/+19
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897386 13f79535-47bb-0310-9956-ffa450edef68
* event: Allow the MPM to explicitly handle CONN_SENSE_WANT_WRITE insteadGraham Leggett2022-01-231-8/+13
| | | | | | | | of support being implicit. Pass the desired sense depending on the state, no longer default to write. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897385 13f79535-47bb-0310-9956-ffa450edef68
* Shutdown immediately on read timeout.Graham Leggett2022-01-221-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897351 13f79535-47bb-0310-9956-ffa450edef68
* event: Add support for non blocking behaviour in theGraham Leggett2022-01-211-8/+74
| | | | | | | | | CONN_STATE_READ_REQUEST_LINE phase, in addition to the existing CONN_STATE_WRITE_COMPLETION phase. Update mod_ssl to perform non blocking TLS handshakes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897281 13f79535-47bb-0310-9956-ffa450edef68
* Revert 1897156.Graham Leggett2022-01-201-35/+16
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897273 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: Follow up to r1897240: cleanups.Yann Ylavic2022-01-201-21/+15
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897263 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: Follow up to r1897240: no ap_thread_current() yet.Yann Ylavic2022-01-201-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897261 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: Follow up to r1897240: runtime fallback to alloc/free.Yann Ylavic2022-01-201-49/+69
| | | | | | | | | | Even though APR_HAS_THREAD_LOCAL is compiled in, ap_regexec() might still be called by non a apr_thread_t thread, let's fall back to alloc/free in this case too. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897260 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: Follow up to r1897240: Fix issues spotted by Rüdiger (thanks!).Yann Ylavic2022-01-202-4/+6
| | | | | | | | | | #include "apr_thread_proc.h" is enough/needed by util_pcre.c and main.c. Fix compilation (vector => ovector) for !HAVE_PCRE2 && APR_HAS_THREAD_LOCAL. Check pcre2_match_data_create() return value for HAVE_PCRE2 && !APR_HAS_THREAD_LOCAL. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897250 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: Follow up to r1897244: Fix pmatch overflow and returned value at ↵Yann Ylavic2022-01-201-4/+2
| | | | | | | | | | | limits. Don't write to pmatch[nlimit:] when ncaps > nlimit, rc should not exceed nmatch either as before r1897244. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897248 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: PCRE needs buffers sized against the number of captures only.Yann Ylavic2022-01-201-10/+10
| | | | | | | | | | | | | | No more (useless), no less (or PCRE will allocate a new buffer by itself to satisfy the needs), so we should base our buffer size solely on the number of captures in the regex (determined at compile time from the pattern). The nmatch provided by the user is used to fill in pmatch only (up to that), but "our" buffers are sized exactly as needed to avoid oversized allocations or PCRE allocating by itself. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897244 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1897240: APR_HAS_THREAD_LOCAL wants #ifdef instead of #if.Yann Ylavic2022-01-202-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897241 13f79535-47bb-0310-9956-ffa450edef68
* ap_regex: Use Thread Local Storage (if efficient) to avoid allocations.Yann Ylavic2022-01-202-47/+174
| | | | | | | | | | | | | | | | PCRE2 wants an opaque context by providing the API to allocate and free it, so to minimize these calls we maintain one opaque context per thread (in Thread Local Storage, TLS) grown as needed, and while at it we do the same for PCRE1 ints vectors. Note that this requires a fast TLS mechanism to be worth it, which is the case of apr_thread_data_get/set() from/to apr_thread_current() when APR_HAS_THREAD_LOCAL; otherwise we'll do the allocation and freeing for each ap_regexec(). The small stack vector is used for PCRE1 && !APR_HAS_THREAD_LOCAL only now. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897240 13f79535-47bb-0310-9956-ffa450edef68
* core: Allow an optional expression to be specified for an effectiveGraham Leggett2022-01-171-16/+35
| | | | | | | | | path in the DirectoryMatch and LocationMatch directives. This allows modules like mod_dav to map URLs to URL spaces or to directories on the filesystem. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897156 13f79535-47bb-0310-9956-ffa450edef68
* util: Follow up to r1897101 and r1897105: Yet better ap_cstr_casecmp[n]().Yann Ylavic2022-01-161-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | Now with a shorter epilogue. Dump of assembler code for function ap_cstr_casecmp: 0x0000000000049fd0 <+0>: xor %edx,%edx 0x0000000000049fd2 <+2>: lea 0x3d567(%rip),%r8 # 0x87540 <ucharmap> 0x0000000000049fd9 <+9>: nopl 0x0(%rax) 0x0000000000049fe0 <+16>: movzbl (%rsi,%rdx,1),%eax 0x0000000000049fe4 <+20>: movzbl (%r8,%rax,1),%ecx 0x0000000000049fe9 <+25>: movzbl (%rdi,%rdx,1),%eax 0x0000000000049fed <+29>: add $0x1,%rdx 0x0000000000049ff1 <+33>: movzbl (%r8,%rax,1),%eax 0x0000000000049ff6 <+38>: sub %ecx,%eax 0x0000000000049ff8 <+40>: jne 0x49ffe <ap_cstr_casecmp+46> 0x0000000000049ffa <+42>: test %ecx,%ecx 0x0000000000049ffc <+44>: jne 0x49fe0 <ap_cstr_casecmp+16> 0x0000000000049ffe <+46>: ret End of assembler dump. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897106 13f79535-47bb-0310-9956-ffa450edef68
* util: Follow up to r1897101: Yet better ap_cstr_casecmp[n]().Yann Ylavic2022-01-161-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | This ones have a shorter prologue (-O2 still). Dump of assembler code for function ap_cstr_casecmp: 0x0000000000049fd0 <+0>: xor %edx,%edx 0x0000000000049fd2 <+2>: lea 0x3d567(%rip),%r8 # 0x87540 <ucharmap> 0x0000000000049fd9 <+9>: nopl 0x0(%rax) 0x0000000000049fe0 <+16>: movzbl (%rdi,%rdx,1),%eax 0x0000000000049fe4 <+20>: movzbl (%rsi,%rdx,1),%ecx 0x0000000000049fe8 <+24>: add $0x1,%rdx 0x0000000000049fec <+28>: movzbl (%r8,%rax,1),%eax 0x0000000000049ff1 <+33>: movzbl (%r8,%rcx,1),%ecx 0x0000000000049ff6 <+38>: cmp %ecx,%eax 0x0000000000049ff8 <+40>: jne 0x49ffe <ap_cstr_casecmp+46> 0x0000000000049ffa <+42>: test %eax,%eax 0x0000000000049ffc <+44>: jne 0x49fe0 <ap_cstr_casecmp+16> 0x0000000000049ffe <+46>: sub %ecx,%eax 0x000000000004a000 <+48>: ret End of assembler dump. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897105 13f79535-47bb-0310-9956-ffa450edef68
* util: Improve ap_cstr_casecmp() and ap_cstr_casecmpn() performances.Yann Ylavic2022-01-151-26/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new versions [1] compile to a shorter/faster assembly than the previous ones [2], no functionnal change. [1] ap_cstr_casecmp() after this commit: Dump of assembler code for function ap_cstr_casecmp: 0x0000000000049fc0 <+0>: movzbl (%rdi),%eax 0x0000000000049fc3 <+3>: movzbl (%rsi),%edx 0x0000000000049fc6 <+6>: lea 0x3d573(%rip),%r8 # 0x87540 <ucharmap> 0x0000000000049fcd <+13>: movzbl (%r8,%rax,1),%eax 0x0000000000049fd2 <+18>: movzbl (%r8,%rdx,1),%ecx 0x0000000000049fd7 <+23>: cmp %ecx,%eax 0x0000000000049fd9 <+25>: jne 0x49ffe <ap_cstr_casecmp+62> 0x0000000000049fdb <+27>: xor %edx,%edx 0x0000000000049fdd <+29>: jmp 0x49ffa <ap_cstr_casecmp+58> 0x0000000000049fdf <+31>: nop 0x0000000000049fe0 <+32>: add $0x1,%rdx 0x0000000000049fe4 <+36>: movzbl (%rdi,%rdx,1),%eax 0x0000000000049fe8 <+40>: movzbl (%rsi,%rdx,1),%ecx 0x0000000000049fec <+44>: movzbl (%r8,%rax,1),%eax 0x0000000000049ff1 <+49>: movzbl (%r8,%rcx,1),%ecx 0x0000000000049ff6 <+54>: cmp %ecx,%eax 0x0000000000049ff8 <+56>: jne 0x49ffe <ap_cstr_casecmp+62> 0x0000000000049ffa <+58>: test %eax,%eax 0x0000000000049ffc <+60>: jne 0x49fe0 <ap_cstr_casecmp+32> 0x0000000000049ffe <+62>: sub %ecx,%eax 0x000000000004a000 <+64>: ret End of assembler dump. [2] ap_cstr_casecmp() before this commit: Dump of assembler code for function ap_cstr_casecmp: 0x000000000004a000 <+0>: movzbl (%rdi),%eax 0x000000000004a003 <+3>: movzbl (%rsi),%edx 0x000000000004a006 <+6>: lea 0x3d533(%rip),%r8 # 0x87540 <ucharmap> 0x000000000004a00d <+13>: mov %rdi,%r9 0x000000000004a010 <+16>: mov %rax,%rcx 0x000000000004a013 <+19>: movswl (%r8,%rdx,2),%edx 0x000000000004a018 <+24>: movswl (%r8,%rax,2),%eax 0x000000000004a01d <+29>: sub %edx,%eax 0x000000000004a01f <+31>: jne 0x4a052 <ap_cstr_casecmp+82> 0x000000000004a021 <+33>: mov $0x1,%edx 0x000000000004a026 <+38>: test %ecx,%ecx 0x000000000004a028 <+40>: je 0x4a052 <ap_cstr_casecmp+82> 0x000000000004a02a <+42>: nopw 0x0(%rax,%rax,1) 0x000000000004a030 <+48>: movzbl (%r9,%rdx,1),%eax 0x000000000004a035 <+53>: movzbl (%rsi,%rdx,1),%ecx 0x000000000004a039 <+57>: add $0x1,%rdx 0x000000000004a03d <+61>: mov %rax,%rdi 0x000000000004a040 <+64>: movswl (%r8,%rcx,2),%ecx 0x000000000004a045 <+69>: movswl (%r8,%rax,2),%eax 0x000000000004a04a <+74>: sub %ecx,%eax 0x000000000004a04c <+76>: jne 0x4a052 <ap_cstr_casecmp+82> 0x000000000004a04e <+78>: test %edi,%edi 0x000000000004a050 <+80>: jne 0x4a030 <ap_cstr_casecmp+48> 0x000000000004a052 <+82>: ret End of assembler dump. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897101 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Fix a possible listener deadlock. PR 65769.Yann Ylavic2021-12-291-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the listener starts accepting more connections than the number of workers already started (due to scheduling), the listening sockets gets disabled (per AH03269) but nothing was re-enabling them before the end of the connections, despite the creation of more idle/available workers in the meantime. In the wost case there is no idle worker when the listener accepts the first connection thus nothing to wake up the listener blocked in poll() with no socket, hence a deadlock. Fix this by waking up the listener when a worker becomes idle and this unblocks connections_above_limit(). This is also worthwhile when all the workers are started (fully initialized runtime) since the number of idle workers is a condition for connections_above_limit() anyway so the sooner the listeners are re-enabled the better (the other condition is the number of connections which is unblocked appropriately by decrement_connection_count() already). Also when a child exists with ps->quiescing == 1 and it's caught by server_main_loop() before perform_idle_server_maintenance(), active_daemons was not decrement as needed (including accross restarts), leading to an invalid active_daemons accounting. * server/mpm/event/event.c(should_enable_listensocks): New helper that returns whether listenning sockets can be poll()ed again. * server/mpm/event/event.c(decrement_connection_count, listener_thread): Use should_enable_listensocks() where previously open-coded. * server/mpm/event/event.c(worker_thread): Wake up the listener when is_idle => 1 and should_enable_listensocks(). Have a single point of exit when workers_may_exit to make sure that the wake always occurs (even when exiting). * server/mpm/event/event.c(server_main_loop): Decrement active_daemons not only when !ps->quiescing but also when ps->quiescing == 1, i.e. all the cases not handled by perform_idle_server_maintenance() already. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1896505 13f79535-47bb-0310-9956-ffa450edef68