Checkout Tools
  • last updated 2 hours ago
Constraints: committers
Constraints: files
Constraints: dates
The Event MPM is no longer experimental; move it out of that ghetto.

Yank the few bits that implement the concept of an experimental MPM.

  1. … 5 more files in changeset.
prefork, worker, event:

restore expected accept mutex mechanism and allocator limit support

(the related AP_MPM_WANT_foo defines no longer exist)

  1. … 2 more files in changeset.
remove leader, perchild, and threadpool MPMs (other than non-English bits in common parts of the manual)

  1. … 26 more files in changeset.
resurrect the old (pre-r757867) compiled-in MPM_NAME value, but via a hook for dynamically

linked MPMs

  1. … 6 more files in changeset.
The rewrite-args hook isn't available to MPM DSOs. Piggy-back on the

linked-in mod_unixd.c to handle that.

(The set of MPMs modified is the same set for which mod_unixd is enabled,

which is approximately equivalent to the set of Unix MPMs which anybody has

tried to maintain in recent memory.)

  1. … 4 more files in changeset.
prefork, worker, and event MPMs: use retained-data API to maintain

information across reconfigs, to allow these MPMs to work as DSOs

  1. … 2 more files in changeset.
Introduce a new set of APIs to allow MPMs to be proper modules instead

of integral parts which share global variables, functions, and macros

with the rest of httpd.

Converted now:

prefork, worker, event, simple, WinNT*

*WinNT hasn't been built or tested, and relies on a hack to include the

WinNT mpm.h to disable Unixy MPM support routines in mpm_common.c

  1. … 25 more files in changeset.
Add conn_rec::current_thread.

  1. … 6 more files in changeset.
Fix mixed declarations and code.

Silence compiler warnings in the same manner as for the

worker MPM; see r726113.

* Remove unused variable

API Cleanup in preperation for 2.4.x, make sure all exported functions or variables contain an ap_ prefix.

  1. … 21 more files in changeset.
Fix MaxRequestsPerChild on the Event MPM. It hasn't worked for 4 years.

* server/mpm/experimental/event/event.c

(process_socket): Be consistent about our return value, returning 0

means this connection is done, and that we can decrement requests_this_child.

Further unixd hacks to remove duplication between old-unixd and mod_unixd,

and get it working with old MPMS[1] + mod_unixd. It's still an uneasy

split, as some modules (mod_cgid, suexec)[2] also use unixd.

More thinking+hacking due.

[1] Should be prefork/worker/event, but only worker is tested.

[2] cgid is OK, suexec is untested.

  1. … 5 more files in changeset.
Switch all unix MPMs to use drop_privileges hook (mod_unixd) for startup

and add a flag to prevent running without any module taking responsibility

for managing system privileges!

  1. … 9 more files in changeset.
Add dummy ap_mpm_register_timed_callback for other MPMs besides Event.

  1. … 1 more file in changeset.
Introduce Suspendable Requests to the Event MPM.

Using this basic framework, you can return SUSPENDED from an HTTP Handler,

and then register a callback that is invoked by the MPM at a later time.

This initial version only supports _timers_ as callbacks, but in the future I

would like to add things like wait for socket activity, on a socket specified by

the handler.

Once in a callback, It is then the responsibility of the callback fucntion

to finish the HTTP Request handling, but this alows you to do cool things like

a fully async proxy, COMET support, or even rate limiting.

To prove I'm not insane, I've inlcuded an example module, mod_dialup.

You can configure it like this:

<Location "/docs">

ModemStandard "V.32"


And for static files inside that path, you will be rate limited to V.32 speeds,

aka 9.6 kilobits/second.

Does anyone besides Rüdiger read commit emails :-) ?

I know there are likely huge problems with this, but I would like to see how far

we can push the Event MPM, figure out what to do better, if there is anything,

and then really dive into the 3.0 development before ApacheCon.

* server/mpm/experimental/event/fdqueue.h:

(timer_event_t): New structure to hold timer events and callback functions.

* server/mpm/experimental/event/fdqueue.c

(ap_queue_empty): Modify to also look at Timer Ring.

(ap_queue_init): Initialize Timer Ring.

(ap_queue_push_timer): New function, pushes a timer event into the queue.

(ap_queue_pop_something): Renamed function, returns a timer event or

a socket/pool for a worker thread to run.

* server/mpm/experimental/event/event.c

(process_socket): If the connection is in SUSPENDED state, don't force it

into linger mode yet, the callback will have to take care of that.

(push_timer2worker): New shortcut function, pushes timer event into queue

for a worker to run.

(timer_free_ring): New global data structure to recycle memory used by

timer events.

(timer_ring): New global data structure to hold active timer events.

(g_timer_ring_mtx): Thread mutex to protect timer event data structures.

(ap_mpm_register_timed_callback): New Function, registers a callback to be

invoked by the MPM at a later time.

(listener_thread): Calculate our wakeup time based on the upcoming Event

Queue, and after pollset_poll runs, push any Timers that have passed

onto worker threads to run.

(worker_thread): Call new queue pop method, and if the Timer Event is

non-null, invoke the callback. Once the callback is done, push the

structure onto the timer_free_ring, to be recycled.

(child_main): Initialize new mutex and ring structures.

* server/config.c

(ap_invoke_handler): Allow SUSPENDED aa valid return code from handlers.

* modules/http/http_core.c

(ap_process_http_async_connection): Don't close the connection when in


* modules/http/http_request.c

(ap_process_request_after_handler): New function, body pulled from the old,

ap_process_async_request. Split to let handlers invoke this so they

don't need to know all of the details of finishing a request.

(ap_process_async_request): If the handler returns SUSPENDED, don't do

anything but return.

* include/ap_mmn.h: Bump MMN.

* include/ap_mpm.h

(ap_mpm_register_timed_callback): New function.

* include/httpd.h:

(SUSPENDED): New return code for handlers.

(request_rec::invoke_mtx): New mutex to protect callback invokcations

from being run before the original handler finishes running.

(conn_state_e): Add a suspended state.

* include/http_request.h

(ap_process_request_after_handler): New function to make it easier for

handlers to finish the HTTP Request.

* modules/test/config.m4: Add mod_dialup to build.

* modules/test/mod_dialup.c: New rate limiting module, requires the Event MPM

to work.

  1. … 9 more files in changeset.
worker/event MPMs: graceful-stop doesn't work if the listener thread is

waiting for an available worker thread. PR 43081

Reported by: Paul Querna

Debugged by: Takashi Sato [takashi lans-tv.com]

  1. … 1 more file in changeset.
get the Event MPM to compile again

Remove all references to CORE_PRIVATE.

  1. … 64 more files in changeset.
Remove ap_graceful_stop_signalled from all MPMs.

  1. … 7 more files in changeset.
* Add hint to PR in comment. No functional change.

  1. … 1 more file in changeset.
* Second part of fix for PR 44402:

- Fix the same race condition in event MPM.

- Slightly optimize code in worker MPM by removing the need for an additional

dereference operation.

- Do some word smithing on the CHANGES entry.

PR: 44402

Submitted by: Basant Kumar Kukreja <basant.kukreja sun.com>

Reviewed by: rpluem

  1. … 2 more files in changeset.
Don't call into get_worker while holding the timeout_list mutex.

PR: 42031

Rework locking on timeout_mutex. We now drop (and reaquire) the lock inside the while loops. This is the least line of code changes to stop a dead lock between the queue in push2worker (a blocking function) and the timeout_mutex. These two timeout list iterations should be rewritten with better locking rules, but for now this should fix the bug, without rewriting the entire function.

PR: 41712

Use APR_STATUS_IS_NOTFOUND() rather than comparing against NOTFOUND directly.

Add comments that make it clear that we are using

the 32bit add/inc atomics in an "unsure" method (although

I would assume if they were NOT working, then the various

testing and usage of event for trunk and 2.2.x would have shown

this by now).

These atomics expect apr_uint32_t *... The expectation, of course,

is that the add/inc still works "as expected" even though we

are using signed values.

Aha! This explains some of the weird things I was seeing.

Pull down and fold in patch from r109510 for event.c

Multiple trivial fixes from Christophe JAILLET

PR 38699, 39518, 42005, 42006, 42007, 42008, 42009

The patches are all his, and are sufficiently trivial to review

at a glance.

  1. … 14 more files in changeset.