34 Commits

Author SHA1 Message Date
3b7cc4481c *) mod_watchdog: add assertions to cleanup code
*) 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
2022-02-25 13:18:51 +00:00
27e5fe3770 *) mod_watchdog: do not call a watchdog instance for
AP_WATCHDOG_STATE_STOPPING outside its thread, as
     watchdog instances are not prepared to be invoked
     concurrently.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898376 13f79535-47bb-0310-9956-ffa450edef68
2022-02-24 13:20:19 +00:00
338daf4719 *) mod_watchdog: use the child_stopping and child_stopped hooks
to shutdown workers before pool destruction releases global
     resources and libraries.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898370 13f79535-47bb-0310-9956-ffa450edef68
2022-02-24 11:56:01 +00:00
6c7a308b20 *) mod_watchdog: replace the new volatile with atomic access.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898343 13f79535-47bb-0310-9956-ffa450edef68
2022-02-23 09:55:34 +00:00
112acd9e2a *) mod_watchdog: use hook 'child_stopping' to signal watchdogs
that they should end processing.
     


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898318 13f79535-47bb-0310-9956-ffa450edef68
2022-02-22 12:19:59 +00:00
6044859057 core: Efficient ap_thread_current() when apr_thread_local() is missing.
#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
2022-01-25 17:34:57 +00:00
8f5905c058 mod_watchdog: use a single "wd_running" pool in wd_worker() thread.
Clear the pool where appropriate instead of multiple create/destroy.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876675 13f79535-47bb-0310-9956-ffa450edef68
2020-04-17 17:15:51 +00:00
9e6be73065 * modules/core/mod_watchdog.c (wd_worker): Fix crashes snuck into
r1876599 where a destroyed pool was reused.  Rename the "ctx"
  variable to reflect its purpose.  Also tweak the pool tags.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876619 13f79535-47bb-0310-9956-ffa450edef68
2020-04-16 17:55:48 +00:00
f461bcf12c Add missing pool tags to help debugging.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876599 13f79535-47bb-0310-9956-ffa450edef68
2020-04-16 12:32:33 +00:00
452ae9a3c2 * modules/core/mod_watchdog.c: Switch to simpler logic to avoid the
thread cleanup running before the thread has started, avoiding
  mutex operations which both have undefined behaviour:

  a) double-locking an UNNESTED (non-recursive) mutex twice in the parent
  b) unlocking a mutex in the spawned thread which was locked by the parent

  (wd_startup, wd_worker_cleanup, wd_worker): Use a boolean to ensure
  the cleanup does nothing if the thread wasn't started, drop the mutex.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876511 13f79535-47bb-0310-9956-ffa450edef68
2020-04-14 12:37:17 +00:00
85760859ca Fix spelling errors found by codespell. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873985 13f79535-47bb-0310-9956-ffa450edef68
2020-02-13 18:15:57 +00:00
304fb8e689 mod_watchdog: Correct some log messages and fix
compiler warning
"'rv' may be used uninitialized in this function".

Follow up to r1722154.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1815004 13f79535-47bb-0310-9956-ffa450edef68
2017-11-12 11:44:37 +00:00
09dc3b73d8 Allow WatchdogInterval to be sub 1 second
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1799435 13f79535-47bb-0310-9956-ffa450edef68
2017-06-21 12:49:54 +00:00
f3a8efb9d0 Not an error... last one is honored
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1799431 13f79535-47bb-0310-9956-ffa450edef68
2017-06-21 12:34:25 +00:00
18e99a8f19 name changes re: suggestion
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1778331 13f79535-47bb-0310-9956-ffa450edef68
2017-01-11 18:05:13 +00:00
4e8baf18d2 Use pconf as parent pool so mutexes get cleaned on restarts/reloads
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1778319 13f79535-47bb-0310-9956-ffa450edef68
2017-01-11 16:00:37 +00:00
494d8d8d9a Fix sparse warnings introduced in r1722154 (inconsistent indenting)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1722701 13f79535-47bb-0310-9956-ffa450edef68
2016-01-03 07:11:58 +00:00
cdb2aea61f Update w/ better logging
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1722154 13f79535-47bb-0310-9956-ffa450edef68
2015-12-29 15:38:29 +00:00
f63c145039 fix spelling error in comment
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1571368 13f79535-47bb-0310-9956-ffa450edef68
2014-02-24 17:50:16 +00:00
8238529b71 No need for process.h system include since we don't use getpid() any more
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1210447 13f79535-47bb-0310-9956-ffa450edef68
2011-12-05 13:09:54 +00:00
f63c6e73bc Axe check for second post config call. New ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG API call does exactly that, so we were actually expecting 4 calls ending up with NULL config in child hook
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1210445 13f79535-47bb-0310-9956-ffa450edef68
2011-12-05 13:07:47 +00:00
92e366007c Add lots of unique tags to error log messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
2011-12-02 23:02:04 +00:00
4554d337cc Remove some getpid() logging, this is now also included in the error log
format.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1208835 13f79535-47bb-0310-9956-ffa450edef68
2011-11-30 22:15:55 +00:00
20c036f9f5 s/WATCHODG/WATCHDOG/
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1203331 13f79535-47bb-0310-9956-ffa450edef68
2011-11-17 19:07:08 +00:00
e8da0ffbc0 solve getpid() process.h function order
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1129914 13f79535-47bb-0310-9956-ffa450edef68
2011-05-31 20:55:02 +00:00
d2b73e5730 Fix two bugs introduced by r1070153
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1070317 13f79535-47bb-0310-9956-ffa450edef68
2011-02-13 22:34:02 +00:00
385da96d50 Use ap_state_query() to fix many modules that were not correctly initializing
if they were not active during server startup but got enabled later during a
graceful restart (in which case they need to do all work during a single
config run).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1070153 13f79535-47bb-0310-9956-ffa450edef68
2011-02-12 21:23:56 +00:00
e137b779d7 OS/2 build fix:
Remove use of non-portable apr_get_os_error() and just return APR_ENOMEM if
apr_pcalloc() returns NULL.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@956860 13f79535-47bb-0310-9956-ffa450edef68
2010-06-22 12:23:13 +00:00
ebb62867fb Use the new APLOG_USE_MODULE/AP_DECLARE_MODULE macros everywhere to take
advantage of per-module loglevels


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951895 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 16:59:50 +00:00
01d300298f Catch up with ap_[proc|global]_mutex_create api change
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@940981 13f79535-47bb-0310-9956-ffa450edef68
2010-05-04 17:40:43 +00:00
0644e027f4 tweaks to r883540:
watchdog: use better mutex type name
  ldap/digest: use same FOO_mutex_type variable name as other modules
    for easier searching


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@883708 13f79535-47bb-0310-9956-ffa450edef68
2009-11-24 14:47:55 +00:00
2e9668a33d Replace AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex,
and WatchdogMutexPath with a single Mutex directive.  Add APIs to
simplify setup and user customization of APR proc and global mutexes.  
(See util_mutex.h.)  Build-time setting DEFAULT_LOCKFILE is no longer
respected; set DEFAULT_REL_RUNTIMEDIR instead.

Some existing modules, such as mod_ldap and mod_auth_digest gain 
configurability for their mutexes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@883540 13f79535-47bb-0310-9956-ffa450edef68
2009-11-23 23:17:51 +00:00
e054fa7183 change the callable functions in the mod_watchdog API
to optional hooks to avoid module ordering or other symbol
resolution issues; affected:

  ap_watchdog_get_instance
  ap_watchdog_register_callback
  ap_watchdog_set_callback_interval


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@820427 13f79535-47bb-0310-9956-ffa450edef68
2009-09-30 20:00:37 +00:00
bc8cdc7896 Here's the simpler solution to the two groups of mappers/ modules...
The mod_so and mod_watchdog are truly not mappers/ at all.  Very open
to better names than modules/core/ but these are clearly API's which
are to be consumed by the httpd core, or generically, any module.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@772848 13f79535-47bb-0310-9956-ffa450edef68
2009-05-08 05:46:28 +00:00