[Apache-SVN] / httpd / httpd / branches / 2.2.x / server / mpm / worker / worker.c Repository:
ViewVC logotype

Log of /httpd/httpd/branches/2.2.x/server/mpm/worker/worker.c

Parent Directory Parent Directory


Links to HEAD: (view) (download) (annotate)
Sticky Revision:

Revision 556936 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 17 14:48:25 2007 UTC (13 months, 2 weeks ago) by jorton
File length: 81596 byte(s)
Diff to previous 446606 (colored)
Merge r551843, r551889 from trunk:

Add alternative fixes for CVE-2007-3304:

* configure.in: Check for getpgid.

* include/mpm_common.h (ap_mpm_safe_kill): New prototype.

* server/mpm_common.c (reclaim_one_pid): Ensure pid validity before
calling apr_proc_wait().
(ap_mpm_safe_kill): New function.

* server/mpm/prefork/prefork.c, server/mpm/worker/worker.c,
server/mpm/experimental/event/event.c: Use ap_mpm_safe_kill() on pids
from the scoreboard, throughout.

* include/ap_mmn.h: Minor bump.

* server/mpm_common.c: getpgid() returns a pid_t

Submitted by: jorton, jim
Reviewed by: jorton, jim, rpluem

Revision 446606 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 15 13:19:25 2006 UTC (23 months, 3 weeks ago) by trawick
File length: 81673 byte(s)
Diff to previous 424876 (colored)
merge from trunk (but preserve ap_get_server_version()):

  *) The full server version information is now included in the error log at
     startup as well as server status reports, irrespective of the setting
     of the ServerTokens directive.  ap_get_server_version() is now 
     deprecated, and is replaced by ap_get_server_banner() and 
     ap_get_server_description().

Reviewed by: rpluem, jim


Revision 424876 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 24 01:43:24 2006 UTC (2 years, 1 month ago) by trawick
File length: 81669 byte(s)
Diff to previous 424874 (colored)
merge from trunk:

  Worker MPM: On graceless shutdown or restart, send signals to
  each worker thread to wake them up if they're polling on a
  Keep-Alive connection.  PR 38737.  [Chris Darroch]

PR: 38737
Reviewed by: chrisd, trawick, niq


Revision 424874 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 24 01:34:58 2006 UTC (2 years, 1 month ago) by trawick
File length: 80659 byte(s)
Diff to previous 421103 (colored)
merge from trunk:

  worker and event MPMs: fix excessive forking if fork() or child_init
  take a long time.

PR: 39275
Reviewed by: trawick, gregames, pquerna

Revision 421103 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jul 12 03:38:44 2006 UTC (2 years, 1 month ago) by fielding
File length: 80683 byte(s)
Diff to previous 410935 (colored)
update license header text

Revision 410935 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 1 20:12:51 2006 UTC (2 years, 3 months ago) by rpluem
File length: 80536 byte(s)
Diff to previous 396056 (colored)
Merge r377291 from trunk:

Make the worker and event MPMs support GracefulShutdownTimeout just like
the prefork MPM does.

Submitted by: Chris Darroch <chrisd pearsoncmg.com>
Ported to event MPM by: rooneg
Issue number: 38621

* server/mpm/worker/worker.c
  (ap_mpm_run): Make the graceful shutdown log message refer to the right
   signal, and respect the graceful shutdown timeout if there is one.

* server/mpm/experimental/event/event.c
  (ap_mpm_run): Ditto.

* CHANGES: Note change.

Submitted by: chrisd, rooneg
Reviewed by: chrisd, rpluem, trawick
PR: 38621

Revision 396056 - (view) (download) (annotate) - [select for diffs]
Modified Sat Apr 22 01:53:06 2006 UTC (2 years, 4 months ago) by pquerna
File length: 80313 byte(s)
Diff to previous 395231 (colored)
Revert r395231 from the 2.2.x branch.  This gets us back to the old place with regard to the copyright statements.

Revision 395231 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 19 12:33:16 2006 UTC (2 years, 4 months ago) by colm
File length: 80313 byte(s)
Diff to previous 332309 (colored)
Update the last year of copyright for the 2.2.x branch

Revision 332309 - (view) (download) (annotate) - [select for diffs]
Modified Thu Nov 10 15:20:05 2005 UTC (2 years, 9 months ago) by jim
File length: 80313 byte(s)
Diff to previous 332307 (colored)
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

Revision 332307 - (view) (download) (annotate) - [select for diffs]
Modified Thu Nov 10 15:15:41 2005 UTC (2 years, 9 months ago) by jim
File length: 80666 byte(s)
Diff to previous 307222 (colored)
No functional change: detab all indenting to be consistent
with our formatting standards.

Revision 307222 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 8 00:11:36 2005 UTC (2 years, 10 months ago) by trawick
File length: 80589 byte(s)
Diff to previous 293164 (colored)
use Greg's cleaner fix for CAN-2005-2970

Revision 293164 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 2 20:56:56 2005 UTC (2 years, 11 months ago) by colm
File length: 80658 byte(s)
Diff to previous 292949 (colored)
Merge r265518-9 from trunk; explicit assignment of some global variables
to zero. These should not be neccessary, but help us get around a gcc
(on ia64 at least) optimisation bug. They are harmless anyway.

Revision 292949 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 1 11:02:10 2005 UTC (2 years, 11 months ago) by trawick
File length: 80650 byte(s)
Diff to previous 290189 (colored)
merge from trunk:

*) SECURITY: CAN-2005-2970 (cve.mitre.org)
     worker MPM: Fix a memory leak which can occur after an aborted
     connection in some limited circumstances.  [Greg Ames, Jeff Trawick]


Revision 290189 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 19 15:51:22 2005 UTC (2 years, 11 months ago) by colm
File length: 80495 byte(s)
Diff to previous 290179 (colored)
Backport graceful-stop to the 2.2.x branch.


Revision 290179 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 19 14:57:07 2005 UTC (2 years, 11 months ago) by colm
File length: 77968 byte(s)
Diff to previous 234103 (colored)
Backport r239710, r239711, r239732, r239740 and r241815 to the 2.2.x branch;
Fix PR 28167, which means we stop listening on ports when we do a
graceful-restart.


Revision 234103 - (view) (download) (annotate) - [select for diffs]
Modified Sat Aug 20 18:21:45 2005 UTC (3 years ago) by pquerna
File length: 77942 byte(s)
Diff to previous 179317 (colored)
Recreate 2.2.x branch from trunk.

Revision 179317 - (view) (download) (annotate) - [select for diffs]
Modified Tue May 31 23:57:41 2005 UTC (3 years, 3 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 77942 byte(s)
Diff to previous 170896 (colored)
downgrade the log level of a proc_mutex_unlock error message
when it occurs during restart; it isn't at all uncommon then
when SysV semaphores are used for the accept mutex

same logic already in place for two other mutex calls

Revision 170896 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 19 09:01:22 2005 UTC (3 years, 3 months ago) by jorton
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 77657 byte(s)
Diff to previous 168649 (colored)
* server/mpm/worker/worker.c (listener_thread): Create ptrans pool as
a child of pconf, to fix APR pool lifetime checks in apr_tables.c.

Submitted by: Joe Schaefer

Revision 168649 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 6 20:37:05 2005 UTC (3 years, 4 months ago) by gregames
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 77656 byte(s)
Diff to previous 168182 (colored)
missed a couple.  

Revision 168182 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 4 20:00:23 2005 UTC (3 years, 4 months ago) by gregames
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 77820 byte(s)
Diff to previous 160211 (colored)
worker and event mpms: transient thread creation errors shouldn't take down
the whole server.

Revision 160211 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 5 19:45:32 2005 UTC (3 years, 5 months ago) by gregames
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 77148 byte(s)
Diff to previous 156274 (colored)
the style police have been sleeping

Revision 156274 - (view) (download) (annotate) - [select for diffs]
Modified Sat Mar 5 20:06:55 2005 UTC (3 years, 6 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 77144 byte(s)
Diff to previous 151408 (colored)
worker MPM/mod_status: Support per-worker tracking of pid and
generation in the scoreboard so that mod_status can accurately
represent workers in processes which are gracefully terminating.

New child processes with worker MPM can take over slots of
individual threads within gracefully terminating processes.
Sometimes this is a problem (too many of these gracefully
terminating processes), so it is helpful to have mod_status
provide the information required to recognize these processes.

Revision 151408 - (view) (download) (annotate) - [select for diffs]
Modified Fri Feb 4 20:28:49 2005 UTC (3 years, 7 months ago) by jerenkrantz
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76976 byte(s)
Diff to previous 109510 (colored)
Update copyright year to 2005 and standardize on current copyright owner line.

Revision 109510 - (view) (download) (annotate) - [select for diffs]
Modified Thu Dec 2 17:39:22 2004 UTC (3 years, 9 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76940 byte(s)
Diff to previous 106103 (colored)
worker MPM: Fix a problem which could cause httpd processes to
remain active after shutdown.

The problem occurred when a scoreboard entry currently
in use by an exiting child process was used for a new child
process.  At that point, the MPM forgot about the exiting
child process, so ap_reclaim_child_processes() wouldn't be
able to forceably terminate it.

(An exiting child process may *never* exit due to a stuck
or long-running request being handled on one of the threads.)

Revision 106103 - (view) (download) (annotate) - [select for diffs]
Modified Sun Nov 21 18:50:36 2004 UTC (3 years, 9 months ago) by nd
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76010 byte(s)
Diff to previous 102975 (colored)
general property cleanup

Revision 102975 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 15 23:08:41 2004 UTC (4 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76010 byte(s)
Diff to previous 102931 (colored)
use existing directive name ThreadStackSize instead of
WorkerStackSize

as made obvious by: Brad Nicholes

Revision 102931 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 11 03:57:50 2004 UTC (4 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76010 byte(s)
Diff to previous 102619 (colored)
Threaded MPMs for Unix and Win32: Add WorkerStackSize directive
to override default thread stack size for threads which handle
client connections.  Required for some third-party modules on
platforms with small default thread stack size.

This is also useful for trimming back the stack size on
platforms with relatively large default stack size in order to
conserve address space for supporting more threads per child.

Revision 102619 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 9 20:40:53 2004 UTC (4 years, 6 months ago) by nd
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 75891 byte(s)
Diff to previous 102587 (colored)
fix name of The Apache Software Foundation

Revision 102587 - (view) (download) (annotate) - [select for diffs]
Modified Sun Feb 8 13:52:12 2004 UTC (4 years, 6 months ago) by nd
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 75887 byte(s)
Diff to previous 102525 (colored)
fix copyright dates according to the first checkin

Revision 102525 - (view) (download) (annotate) - [select for diffs]
Modified Fri Feb 6 22:58:42 2004 UTC (4 years, 6 months ago) by nd
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 75887 byte(s)
Diff to previous 102425 (colored)
apply Apache License, Version 2.0

Revision 102425 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 28 15:31:02 2004 UTC (4 years, 7 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78106 byte(s)
Diff to previous 102419 (colored)
worker MPM: fix stack overlay bug that could cause the parent
process to crash.

Revision 102419 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 27 15:19:58 2004 UTC (4 years, 7 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78059 byte(s)
Diff to previous 102135 (colored)
Unix MPMs: Stop dropping connections when the file descriptor
is at least FD_SETSIZE.

That isn't a problem for most users (since poll() is widespread).
On old boxes where select() must be used by APR, APR needs to fail
operations that don't work with such fds.

Revision 102135 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 1 13:26:26 2004 UTC (4 years, 8 months ago) by nd
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78425 byte(s)
Diff to previous 102047 (colored)
update license to 2004.

Revision 102047 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 13 19:43:40 2003 UTC (4 years, 8 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78425 byte(s)
Diff to previous 102045 (colored)
remove inadvertent commit of clumsy gdb workaround (sorry!)

Revision 102045 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 13 19:00:56 2003 UTC (4 years, 8 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78493 byte(s)
Diff to previous 101858 (colored)
update leader, threadpool, and worker MPMs to return MPM state
from ap_mpm_query()

Revision 101858 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 24 01:34:04 2003 UTC (4 years, 9 months ago) by brianp
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 77565 byte(s)
Diff to previous 101801 (colored)
remove calls to the apr_proc_other_child_read function that no longer exists

Revision 101801 - (view) (download) (annotate) - [select for diffs]
Modified Sun Nov 16 23:47:07 2003 UTC (4 years, 9 months ago) by gstein
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 77495 byte(s)
Diff to previous 101165 (colored)
Switch over to the new pollset API.

* server/mpm/worker/worker.c:
  (listener_thread): create and add sockets to the pollset using the new
    APIs. rearrange the round-robin a little bit to work with the new
    pollset return values.
    cleaning: get rid of an extraneous status variable. get rid of
      obsoleted round-robin code.

Revision 101165 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 5 19:36:26 2003 UTC (5 years ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76558 byte(s)
Diff to previous 101160 (colored)
Lower the severity of the "listener thread didn't exit" message
to debug, as it is of interest only to developers.

PR:                9011

Revision 101160 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 5 16:50:22 2003 UTC (5 years ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76557 byte(s)
Diff to previous 101122 (colored)
Fix a misleading message from the some of the threaded MPMs when
MaxClients has to be lowered due to the setting of ServerLimit.

Revision 101122 - (view) (download) (annotate) - [select for diffs]
Modified Thu Aug 28 05:54:44 2003 UTC (5 years ago) by jwoolley
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76534 byte(s)
Diff to previous 101117 (colored)
Updated the various MPM's to use the new bucket_alloc_create_ex API
when necessary.  Which is to say that it's necessary in all cases except
for prefork, where the change to apr-util to have it use the allocator
from the pool passed in is already sufficient.

Reviewed by:	Jean-Jacques Clar, Sander Striker, Brad Nicholes

Revision 101117 - (view) (download) (annotate) - [select for diffs]
Modified Wed Aug 27 22:33:12 2003 UTC (5 years ago) by bnicholes
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76594 byte(s)
Diff to previous 99312 (colored)
Make sure that the global ap_max_mem_free is initialized along with the
other MPM globals whenever HTTPD is started or restarted.

Revision 99312 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 9 16:58:30 2003 UTC (5 years, 4 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76498 byte(s)
Diff to previous 98573 (colored)
consolidate code related to sig_coredump

a note on perchild:
  perchild exception handling was busted before this and is still busted
  the problem I noticed was that a client that exposes a segfault never
  gets its connection dropped and the parent never notices that the
  child process that segfaulted hasexited

Revision 98573 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 3 17:53:28 2003 UTC (5 years, 7 months ago) by nd
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 79019 byte(s)
Diff to previous 96558 (colored)
finished that boring job:
update license to 2003.

Happy New Year! ;-))

Revision 96558 - (view) (download) (annotate) - [select for diffs]
Modified Wed Aug 28 18:48:07 2002 UTC (6 years ago) by jim
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 79019 byte(s)
Diff to previous 96463 (colored)
Adjust the descriptions of these directives, avoid the child/process/thread
confusion.
PR:
Obtained from:
Submitted by:
Reviewed by:

Revision 96463 - (view) (download) (annotate) - [select for diffs]
Modified Wed Aug 21 13:32:16 2002 UTC (6 years ago) by jim
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78966 byte(s)
Diff to previous 96005 (colored)
Minor error log typo

Revision 96005 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 11 05:42:20 2002 UTC (6 years, 1 month ago) by rbb
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78972 byte(s)
Diff to previous 95959 (colored)
Bring Apache in line with APR's new poll implementation.  This isn't
optimal, because it still uses the compatibility functions to make it
work, but it does work.  The next step will be to take the memory for
the pollsets under Apache's control.

Revision 95959 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 4 22:41:48 2002 UTC (6 years, 2 months ago) by brianp
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78933 byte(s)
Diff to previous 95954 (colored)
replaced APR_USEC_PER_SEC division with the new time macros

Revision 95954 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 4 15:20:54 2002 UTC (6 years, 2 months ago) by striker
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78929 byte(s)
Diff to previous 95568 (colored)
Add a new directive: MaxMemFree.  MaxMemFree makes it possible
to configure the maximum amount of memory the allocators will
hold on to for reuse.  Anything over the MaxMemFree threshold
will be free()d.  This directive is usefull when uncommon large
peaks occur in memory usage.  It should _not_ be used to mask
defective modules' memory use.

Revision 95568 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 7 14:08:05 2002 UTC (6 years, 3 months ago) by jim
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78857 byte(s)
Diff to previous 95373 (colored)
Now that we have the functionality in apr, we can now have 2.0's
startup message regarding AcceptMutex (what we are using and what
the default is) "fully" match what is present in 1.3.
PR:
Obtained from:
Submitted by:
Reviewed by:

Revision 95373 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 30 00:21:27 2002 UTC (6 years, 3 months ago) by striker
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78808 byte(s)
Diff to previous 95270 (colored)
Catch up with the apr_allocator_set_owner -> apr_allocator_owner_set renames
in APR.

Revision 95270 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 24 19:50:58 2002 UTC (6 years, 3 months ago) by brianp
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78808 byte(s)
Diff to previous 95237 (colored)
Fix for the worker deadlock problem

Revision 95237 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 23 12:58:37 2002 UTC (6 years, 3 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78419 byte(s)
Diff to previous 95149 (colored)
Add "-k start|startssl|restart|graceful|stop" support to httpd
for the Unix MPMs.  These have semantics very similar to the
old apachectl commands of the same name.

The use of stderr/stdout and exit status for error conditions
needs to be revisited.  For now it matches apachectl behavior.

Justin Erenkrantz got the ball rolling with this feature.  Some
of his support code was used unchanged.  Other code was shuffled
around and modified or rewritten.

Revision 95149 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 17 11:11:39 2002 UTC (6 years, 3 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78419 byte(s)
Diff to previous 94892 (colored)
stop using APLOG_NOERRNO in calls to ap_log_?error()

Revision 94892 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 1 16:05:59 2002 UTC (6 years, 4 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 79015 byte(s)
Diff to previous 94889 (colored)
wait for worker threads to exit even in graceless termination
(we already have code to make them exit sooner now)

Revision 94889 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 1 15:06:44 2002 UTC (6 years, 4 months ago) by stoddard
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 79090 byte(s)
Diff to previous 94886 (colored)
Defer starting the listener until we have at least tried to start all the worker
threads.  We want to get the workers in the pool of available threads ASAP
to keep perform_idle_server_maintenance from thrashing and starting too
many processes prematurely.  The code before this patch would dribble workers
into the worker pool over an extended period of time and this prevented
perform_idle_server_maintenance from accurately deciding when new processes
were needed.

Revision 94886 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 1 07:15:39 2002 UTC (6 years, 4 months ago) by jerenkrantz
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 79131 byte(s)
Diff to previous 94840 (colored)
Close sockets on worker MPM when doing a graceless restart.  This should
resolve some segfaults see when doing such restarts.

(Justin tweaked the palloc/memset in favor of calloc.)

Submitted by:	Aaron Bannert
Reviewed by:	Greg Ames, Sander Striker, Justin Erenkrantz

Revision 94840 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 28 22:13:32 2002 UTC (6 years, 4 months ago) by aaron
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78429 byte(s)
Diff to previous 94830 (colored)
Detect APR_EINTR from ap_queue_pop() and avoid calling
ap_queue_info_set_idle() more than once at a time per worker thread.
This fixes an assert coredump.

Submitted by:	Aaron Bannert
Reviewed by:	Brian Pane

Revision 94830 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 28 05:28:18 2002 UTC (6 years, 4 months ago) by brianp
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78224 byte(s)
Diff to previous 94824 (colored)
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.

Revision 94824 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 28 01:45:00 2002 UTC (6 years, 4 months ago) by aaron
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 78165 byte(s)
Diff to previous 94700 (colored)
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.

Revision 94700 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 18 17:46:20 2002 UTC (6 years, 4 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76871 byte(s)
Diff to previous 94679 (colored)
back out ill-conceived attempt to fix a segfault during
graceless termination

Revision 94679 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 17 15:45:27 2002 UTC (6 years, 4 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 77321 byte(s)
Diff to previous 94625 (colored)
use an independent pool for threads so that when we abandon them
during graceless termination the cleanups on pchild won't mess with
stuff they are still referencing

Revision 94625 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 12 19:58:52 2002 UTC (6 years, 4 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76871 byte(s)
Diff to previous 94541 (colored)
worker MPM: Fix a situation where a child exited without releasing
the accept mutex.  Depending on the OS and mutex mechanism this
could result in a hang.

Revision 94541 - (view) (download) (annotate) - [select for diffs]
Modified Mon Apr 8 16:57:06 2002 UTC (6 years, 4 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76945 byte(s)
Diff to previous 94443 (colored)
Remind the admin about the User and Group directives when we are
unable to set permissions on a semaphore.

PR:    7812

Revision 94443 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 5 02:23:02 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76884 byte(s)
Diff to previous 94441 (colored)
quiet a bogus gcc warning that crops up with -O2

Revision 94441 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 5 00:18:14 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76861 byte(s)
Diff to previous 94420 (colored)
worker MPM:  add -DFOREGROUND option to use when you want
             the parent process to run in the foreground

             (NO_DETACH is a special mode for running under
             programs like daemontools)

             the existing flag -DDEBUG turns on FOREGROUND
             now instead of NO_DETACH

Revision 94420 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 3 15:47:59 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76773 byte(s)
Diff to previous 94417 (colored)
worker MPM:

Don't create a listener thread until we have a worker thread.  Otherwise,
in situations where we'll have to wait a while to take over scoreboard
slots from a previous generation, we'll be accepting connections we can't
process yet.

Don't let the listener thread clobber the scoreboard entry of the first
worker thread.

Revision 94417 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 3 13:10:56 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76563 byte(s)
Diff to previous 94306 (colored)
Allow worker MPM to build on systems without pthread_kill().

Submitted by:  Pier Fumagalli (and mangled by Jeff)

Revision 94306 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 29 14:33:50 2002 UTC (6 years, 5 months ago) by jim
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76366 byte(s)
Diff to previous 94304 (colored)
The old, legacy (and unused) code in which the scoreboard was totally
and completely contained in a file (SCOREBOARD_FILE) has been
removed. This does not affect scoreboards which are *mapped* to
files using named-shared-memory at all. This implies that scoreboards
must be based, at some level, on native shared memory (mmap, shm_open,
shmget, whatever), but the code has assumed that for quite awhile
now. Having the scoreboard be *based* on a file makes no sense today.

PR:
Obtained from:
Submitted by:
Reviewed by:

Revision 94304 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 29 08:17:26 2002 UTC (6 years, 5 months ago) by jwoolley
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76466 byte(s)
Diff to previous 94232 (colored)
BUCKET FREELISTS

Add an allocator-passing mechanism throughout the bucket brigades API.

From Apache's standpoint, the apr_bucket_alloc_t* used throughout a given
connection is stored in the conn_rec by the create_connection hook.  That
means it's the MPM's job to optimize recycling of apr_bucket_alloc_t's --
the MPM must ensure that no two threads can ever use the same one at the
same time, for instance.

Revision 94232 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 27 20:37:32 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 76205 byte(s)
Diff to previous 94117 (colored)
worker MPM:

get MaxRequestsPerChild to work again by allowing the main thread of
a child to be interrupted by one of the other threads in the process

this should get graceful termination to work after encountering one of
the various possible error conditions in the listener and worker threads

Revision 94117 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 22 03:43:22 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 75881 byte(s)
Diff to previous 94112 (colored)
document yet another worker MPM glitch

Revision 94112 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 22 01:12:49 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 75483 byte(s)
Diff to previous 94106 (colored)
remove some unnecessary, commented-out code; add a comment
about a use of signals

Revision 94106 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 21 19:12:54 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 75424 byte(s)
Diff to previous 94095 (colored)
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.

Revision 94095 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 21 16:31:39 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 74794 byte(s)
Diff to previous 94094 (colored)
graceful shutdown (no dropped connections) requires that the listener
go away before the workers...  introduce separate XXX_may_exit flags
for our different categories of threads so that a future fix for
graceful shutdown can terminate them in the right order

rename signal_workers() to signal_threads() and give it a parameter
so it knows whether or not termination should be graceful

this commit doesn't change the behavior in any noticeable way;  the
flags used to tell threads to go away are still set at about the same
time

Revision 94094 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 21 16:18:11 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 74254 byte(s)
Diff to previous 94091 (colored)
document a glitch that prevents complete graceful termination of the
process when one of the threads encounters a critical error

Revision 94091 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 21 16:06:51 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 73876 byte(s)
Diff to previous 94068 (colored)
make the comment for the call to apr_signal_thread() a little more
correct about what it is going to do

Revision 94068 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 21 03:40:23 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 73876 byte(s)
Diff to previous 94067 (colored)
don't log a failure of ap_queue_pop() at termination; it is
expected

Revision 94067 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 20 23:29:13 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 73102 byte(s)
Diff to previous 94062 (colored)
in a worker thread, don't dare try to process a connection if
ap_queue_pop() failed...  csd is not cleared by ap_queue_pop()
so checking csd is not helpful

Revision 94062 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 20 22:19:11 2002 UTC (6 years, 5 months ago) by jim
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 72904 byte(s)
Diff to previous 94061 (colored)
Fold the compiled-in knowledge of the allowable AcceptMutex settings into
its help entry. Requires the use of a extern string rather than a function
call for the initialization to be valid in the macro (Thx to Jeff!).
In the meantime, bump down the error logging until we deal with true
default and configured setting information ala 1.3.

PR:
Obtained from:
Submitted by:
Reviewed by:

Revision 94061 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 20 20:38:52 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 72907 byte(s)
Diff to previous 94059 (colored)
no need to kill the scoreboard cleanup anymore on graceful
restart; the scoreboard is longer-lived
PR:
Obtained from:
Submitted by:
Reviewed by:

Revision 94059 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 20 19:53:18 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 73003 byte(s)
Diff to previous 94055 (colored)
write a debug message to the log when we're stuck in the sicko state
of trying to take over scoreboard slots that aren't going to be released
(we could also be stalled while taking over slots if a thread in child
gracefully terminating is serving a long-running request)

update a comment describing the sicko state to remove any information
I'm not absolutely sure of

Revision 94055 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 20 16:44:13 2002 UTC (6 years, 5 months ago) by jim
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 72630 byte(s)
Diff to previous 94039 (colored)
Bring 2.0 up to parity, a bit, with how much info we provide to
the admin regarding valid values for AcceptMutex. Should also
tell 'em what "default" actually maps to, but that can wait.

PR:
Obtained from:
Submitted by:
Reviewed by:

Revision 94039 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 20 05:58:21 2002 UTC (6 years, 5 months ago) by wrowe
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 72453 byte(s)
Diff to previous 94031 (colored)
  The pre_mpm hook creates server-lifetime objects (or at least, for the
  generations across graceful restarts.)  They should use the process pool.

Revision 94031 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 20 03:54:25 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 72442 byte(s)
Diff to previous 94030 (colored)
Make the listener thread stop accepting new connections and exit
cleanly at graceful restart time.  This is a basic requirement of
reliable graceful restarts (the kind that won't drop connections).
This allows a future fix to make worker threads hang around until
they service all connections previously accepted by the listener
thread.

The old mechanism of doing a dummy connection to wake up the
listener thread in each old child process didn't work.  It didn't
guarantee that (in the main thread) the byte was read from the pod
and global variables were set before the listener thread grabbed
the connection.  It didn't guarantee that a child process in the
new generation didn't get some of the dummy connections.

Rather than burn extra syscalls adding a unique socket or pipe
to the poll set (and breaking single listen unserialized accept
in the same change), this uses a signal sent from the main thread
to the listener thread to break it out of the poll or accept.
(We don't worry about breaking it out of the optional mutex because
the child process holding the mutex will break out of poll/accept
and release the mutex, allowing a child blocked in the mutex to
get it.  Eventually all children blocked in the mutex will come
out.)

Since the listener thread now exits reliably, the main thread
joins it.

PR:
Obtained from:
Submitted by:
Reviewed by:

Revision 94030 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 20 03:38:07 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 69519 byte(s)
Diff to previous 94025 (colored)
get the start thread to exit when we have reached termination but
it is still trying to create worker threads

previously, after a non-graceful restart followed by a terminate
you could see a bunch of log messages showing the parent repeatedly
sending SIGTERM and finally SIGKILL to one or more children...
with this change, the sequence of messages should stop very soon

add a comment to start_threads() describing a current problem

Revision 94025 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 19 22:09:26 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 68897 byte(s)
Diff to previous 94024 (colored)
be a little more specific in a thread-create error message

it is helpful to distinguish between a failure creating the
first thread (listener) vs. a failure creating one of n
worker threads

Revision 94024 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 19 21:31:04 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 68895 byte(s)
Diff to previous 94017 (colored)
"apachectl stop" shouldn't send the gracefully-terminate char down
the pod...  the child processes need to know that it isn't a graceful
termination and they shouldn't wait for old connections to finish

Revision 94017 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 19 17:56:57 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 68746 byte(s)
Diff to previous 93998 (colored)
get rid of unnecessary code to track the number of worker threads

Revision 93998 - (view) (download) (annotate) - [select for diffs]
Modified Mon Mar 18 18:12:43 2002 UTC (6 years, 5 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 69321 byte(s)
Diff to previous 93969 (colored)
prefork and worker:

after allocating a new scoreboard, make sure the right generation
is stored in the global score

Revision 93969 - (view) (download) (annotate) - [select for diffs]
Modified Sat Mar 16 18:42:46 2002 UTC (6 years, 5 months ago) by wrowe
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 69090 byte(s)
Diff to previous 93943 (colored)
  Simplify s/APR_OS_PROC_T_FMT/APR_PID_T_FMT/, apr_os_foo entities aren't
  for external consumption.

Revision 93943 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 15 00:50:31 2002 UTC (6 years, 5 months ago) by striker
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 69094 byte(s)
Diff to previous 93918 (colored)
Update the mpms to call the new allocator/pools API

Revision 93918 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 13 20:48:07 2002 UTC (6 years, 5 months ago) by fielding
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 68953 byte(s)
Diff to previous 93720 (colored)
Update our copyright for this year.

Revision 93720 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 5 21:18:07 2002 UTC (6 years, 6 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 68953 byte(s)
Diff to previous 93719 (colored)
failures on the accept mutex are common at restart time, so be smart
about the log level and use APLOG_DEBUG if we're restarting

Revision 93719 - (view) (download) (annotate) - [select for diffs]
Modified Tue Mar 5 21:01:24 2002 UTC (6 years, 6 months ago) by trawick
Original Path: httpd/httpd/trunk/server/mpm/worker/worker.c
File length: 68403 byte(s)
Diff to previous 93718 (colored)
fix a typo in a log message...  the m