Parent Directory
|
Revision Log
| Links to HEAD: | (view) (annotate) |
| Sticky Revision: |
Merge r702867 from trunk: * Recheck again if idle workers are still available when we are signaled that they are. This is needed since it can happen that we are signaled by a worker thread that went idle but received a context switch before it could tell us. If it does signal us later once it is on CPU again there might be no idle worker left. See https://issues.apache.org/bugzilla/show_bug.cgi?id=45605#c4 PR: 45605 Submitted by: Denis Ustimenko <denusk gmail.com> Reviewed by: rpluem, jim, gregames
add comment from event MPM's fdqueue ap_pop_pool() regarding ABA problem and avoidance because only caller is single listener thread
Merge r630335, r630348, r630350 from trunk:
Worker MPM: fix race condition
PR44402: reported and fixed by Basant Kumar Kukreja
* 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
* Add hint to PR in comment. No functional change.
Reviewed by: jim
Backport trivial cleanups
update license header text
Revert r395231 from the 2.2.x branch. This gets us back to the old place with regard to the copyright statements.
Update the last year of copyright for the 2.2.x branch
No functional change: remove trailing whitespace. This also means that "blank" lines, which had consisted of just spaces and/or tabs are now truly blank lines
Recreate 2.2.x branch from trunk.
Update copyright year to 2005 and standardize on current copyright owner line.
ap_queue_push: update comment to reflect reality pointed out by: Ron Park (ronp cnet.com)
general property cleanup
fix name of The Apache Software Foundation
fix copyright dates according to the first checkin
apply Apache License, Version 2.0
update license to 2004.
Switch to the new 32-bit APR atomic API for better portability (the old code assumed that apr_atomic_t and apr_uint32_t were interchangeable). Also, add more detailed comments on how one of the synchronization functions works.
Add casts to apr_atomic_casptr arguments to avoid compiler warnings
Minor cleanups: * fdqueue.c (ap_queue_info_term, ap_queue_interrupt_all): Remove redundant conditionals.
finished that boring job: update license to 2003. Happy New Year! ;-))
fix the type of the idlers field to match what apr_atomic_cas() expects this fixes the compile when using the native compiler for AIX (and likely other non-gcc compilers)
Replace most of the mutex locking in the worker MPM's "queue info" object with atomic compare-and-swap loops.
typo
Removed some code from the mutex-protected block in ap_queue_pop(). If the worker thread synchronization is working properly, it's not necessary to set these fields to NULL after removing an element from the queue, and it's IMO more important to have a shorter code path leading up to the mutex_unlock. I left in support for NULLing the fields when debugging, though.
Removed the "not_full" condition variable and associated conditional logic from the file descriptor queue, now that we can rely on the idle worker reference count to keep the listener from trying to push connections into a full queue Reviewed by: Aaron Bannert (concept)
Moved the recycled pool list from the queue to the queue_info structure. The advantage of doing this is that it enables us to guarantee that the number of ptrans pools in existence at once is no greater than the number of worker threads, and that we'll never have to delete ptrans pools.
Added a missing pool deletion case and simplified the conditionals for the error-case return (thanks to Justin for suggesting the latter)
Move a potentially expensive pool cleanup operation outside the mutex-protected critical path of ap_queue_pop()
Preserve the original error, or if the unlock fails then use that error instead. Obtained from: Justin Erenkrantz Submitted by: Aaron Bannert
Add a "queue_info" structure to the worker MPM. This is used to prevent the listener thread from accept()ing more connections than there are available workers. This prevents long-running requests from starving connections that have been accepted but not yet processed. The queue_info is a simple counter, mutex, and condition variable. Only the listener thread blocks on the condition, and only when there are no idle workers. In the fast path there is a mutex lock, integer decrement, and and unlock (among a few conditionals). The worker threads each notify the queue_info when they are about to block on the normal worker_queue waiting for some connection to process, which wakes up any sleeping listener thread to go perform another accept() in parallel.
Convert the worker MPM's fdqueue from a LIFO back into a FIFO. Since elements in the queue represent accept()ed connections, we want them to be processed in the order that they were received. (I erroneously converted it to a LIFO quite awhile ago in the hopes that it would improve cache efficiency.) Remember to perform a make clean in the worker directory after this patch, since this patch changes the size of the fd_queue_t object (which is allocated in worker.c).
Don't drop connections during graceful restart. Previously, worker threads could exit even though there were connections waiting in the queue. Now, for a graceful restart the worker threads won't exit until they are told that the queue has been drained and no more connections will ever be added.
fix a comment
Update our copyright for this year.
Convert the ap_queue_foo routines to return apr_status_t as appropriate.
Performance optimization: updated the worker MPM to recycle per-transaction pools instead of destroying them. Based on Ian's benchmark testing, this reduces CPU utilization by about 1% on Solaris.
Fully convert worker's fdqueue to the new APR lock API: - Mutexes and Condition Variables from APR are now used instead of direct (non-portable) calls to pthread. Still need to fully APRize these routines, particularly the return values. In many cases a failed lock or cond var call will simply return FD_QUEUE_FAILURE. This should obviously instead return the appropriate APR error code.
clean up the fdqueue a bit more, by implementing Greg's suggestions to getting rid of redundant variables, as well as converting the simple ap_queue_full/ap_queue_empty tests into macros. This also reinstates the "not_full" condition, which turned out to be useful afterall in cases where we wanted to prevent the listener thread from accepting further connections until the worker queue has room for more. Submitted by: [Aaron Bannert <aaron@clove.org>]
Turn the worker MPM's queue into a LIFO. This may improve cache-hit performance under some conditions. Submitted by: Aaron Bannert <aaron@clove.org>
Cleanup the worker MPM. We no longer re-use transaction pools. This incurs less overhead than shuffling the pools around so that they can be re-used. Remove one of the queue's condition variables. We just redefined the API to state that you can't try to add more stuff than you allocated segments for. Submitted by: Aaron Bannert <aaron@clove.org>
Remove an obsolete function from fdqueue. The worker MPM now uses the fdqueue functions in a different way. Submitted by: Aaron Bannert <aaron@clove.org>
Make the worker MPM shutdown and restart cleanly. This also cleans up some race conditions, and gets the worker using pools more cleanly. Submitted by: [Aaron Bannert <aaron@clove.org>]
Get the worker MPM working again. This should fix the serialization problems, and it makes up initialize the queue only once.
It helps if we broadcast to the workers that we are trying to shutdown.
Add the worker MPM. The name is probably horrible, but I couldn't come up with anything better. This is a multiple-worker/single listener MPM. This MPM is definately not complete, but it is a first step in the right direction.
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.
| apache@apache.org | ViewVC Help |
| Powered by ViewVC 1.1.2 |