1
0
mirror of https://github.com/apache/httpd.git synced 2026-01-13 21:42:17 +03:00
Commit Graph

1823 Commits

Author SHA1 Message Date
Eric Covener
48d36db55b r1651088 for eventopt
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1651089 13f79535-47bb-0310-9956-ffa450edef68
2015-01-12 13:45:30 +00:00
Eric Covener
8197971bce Update conn_rec.id when a new thread begins working on a connection, because
the old thread may work on a new connection and assign the same ID in parallel.


Submitted By:  Michael Thorpe
Committed By: covener


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1651088 13f79535-47bb-0310-9956-ffa450edef68
2015-01-12 13:42:31 +00:00
Yann Ylavic
e6d70ea7bc mpm_event(opt): zero is immutable.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1643284 13f79535-47bb-0310-9956-ffa450edef68
2014-12-05 14:00:37 +00:00
Yann Ylavic
62da621f82 mpm_worker: replace apr_atomic_cas32(+1) loop with the more performant
apr_atomic_inc32().
Also declare fd_queue_info_t's idlers member as volatile since it is
used outside atomic functions (or it could be optimized out by the
compiler).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1643282 13f79535-47bb-0310-9956-ffa450edef68
2014-12-05 13:54:30 +00:00
Yann Ylavic
abb1b803d6 mpm_event(opt): avoid casts/comparisons from unsigned to signed (atomics).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1643279 13f79535-47bb-0310-9956-ffa450edef68
2014-12-05 13:41:38 +00:00
Yann Ylavic
8fb0b6f980 mpm_{prefork,worker}: follow up to r1635521.
Don't crash when there is no accept mutex (one listener => apr_proc_mutex_name(NULL)).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1643179 13f79535-47bb-0310-9956-ffa450edef68
2014-12-05 07:57:57 +00:00
Yann Ylavic
7791f925d3 mpm_event: follow up to r1639614 (trunk) and r1642858 (2.4.x).
Notify suspend in any case when starting lingering close (blocking),
and outside the lingering queue's critical section.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1642868 13f79535-47bb-0310-9956-ffa450edef68
2014-12-02 13:41:14 +00:00
Yann Ylavic
4669bc745b mpm_event(opt), mpm_worker, mpm_prefork: follow up to r1635521, r1640161.
Retain num_buckets and max_buckets accross restarts so that we can determine
whether new buckets were allocated and set their idle_spawn_rate at the same
level as the existing ones (max).

Also, adjust ap_daemons_limit and ap_daemons_to_start lower bounds at mpm_run()
time, once num_buckets is available for the current generation (previously done
at check_config time, hence before num_buckets is computed, and then with the
previous generation's value).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640763 13f79535-47bb-0310-9956-ffa450edef68
2014-11-20 16:26:04 +00:00
Yann Ylavic
fe1189c22f mpm_prefork: follow up to r1635521.
Avoid oddity on bucket_make_child_record overflow.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640184 13f79535-47bb-0310-9956-ffa450edef68
2014-11-17 16:31:06 +00:00
Yann Ylavic
9d670bcfdf mpm_event(opt), mpm_worker: follow up to r1635521.
Allocate retained idle_spawn_rate vector on the process pool.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640161 13f79535-47bb-0310-9956-ffa450edef68
2014-11-17 13:59:36 +00:00
Yann Ylavic
c5d85f6439 mpm_worker, mpm_prefork: follow up to r1635521.
Use one dedicated accept mutex per listeners bucket.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640145 13f79535-47bb-0310-9956-ffa450edef68
2014-11-17 11:45:29 +00:00
Yann Ylavic
f1cb9b287a event, eventopt: follow up to r1638879 and r1639960.
Clear the pool in ap_push_pool() before recycling.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640031 13f79535-47bb-0310-9956-ffa450edef68
2014-11-16 21:32:48 +00:00
Christophe Jaillet
ebbed36037 avoid dereferencing a recently apr_pool_clear()'ed event_conn_state_t *cs
in several paths where ptrans is being recycled at the end of a request.

Same as r1638879 which was for the event MPM.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1639960 13f79535-47bb-0310-9956-ffa450edef68
2014-11-16 05:55:14 +00:00
Eric Covener
b38d5d5979 don't call notify_suspend() in a worker thread after
start_lingering_close_common may have put the socket back
into the pollset. 

If it becomes readable too quickly, cs can be
free'ed or accessed concurrently.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1639614 13f79535-47bb-0310-9956-ffa450edef68
2014-11-14 12:04:46 +00:00
Eric Covener
c2d42b1214 revert r1638691, more comprehensive followup planned shortly.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1639564 13f79535-47bb-0310-9956-ffa450edef68
2014-11-14 02:24:40 +00:00
Eric Covener
051a1291c9 avoid dereferencing a recently apr_pool_clear()'ed event_conn_state_t *cs
in several paths where ptrans is being recycled at the end of a request.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1638879 13f79535-47bb-0310-9956-ffa450edef68
2014-11-12 17:32:24 +00:00
Eric Covener
48611f3ed2 Fix a bug in r1604350 that can lead to crashes in the event MPM under load.
if start_lingering_close_blocking() returns 0, notify_suspend() will 
write a 1 into some potentially recently free'd memory from 
ptrans (cs->suspended).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1638691 13f79535-47bb-0310-9956-ffa450edef68
2014-11-12 02:29:38 +00:00
Yann Ylavic
61d5a3c1ca MPMs, core: make duplicated listeners (SO_REUSEPORT) introduced in r1599531
less intrusive.

Submitted by: Yingqi Lu <yingqi.lu@intel.com>
Modified/Committed by: ylavic

Add ListenCoresBucketsRatio which is a configurable ratio between the number of
CPU cores (online) and the number of listeners buckets to create, defaulting to
zero (so that listeners buckets become an opt-in, ie. ncpus / ratio > 1).
This could also be made an opt-out by using the previous hardcoded value (8) as
default.

Make ap_close_listeners() act on all the listeners (including duplicated ones),
since the function is also called externally (eg. mod_cgid, mod_ssl_ct and
possibly any third party module) to cleanup opened descriptors when a process
is forked (the duplicated listeners are kept in a scoped/static variable).

Add ap_close_listeners_ex() to close a single bucket of listeners, used by the
children to close unused duplicates and internally by ap_close_listeners().

Make ap_duplicate_listeners() compute the number of buckets to be used, instead
of each MPM. This number is now based on the above ratio and will not change
unless asked to (given *num_buckets < 1, that is when the MPM does not run in
one-process mode nor after a graceful restart).

Remove some global variables (mpm_listen, enable_default_listeners) previously
used to communicate between MPMs and ap_listen, since ap_duplicate_listeners()
API can now be used to do so.
Also rename num_buckets as ap_num_listen_buckets, and prefix have_so_reuseport
with ap_ (both printed by ap_log_common(), hence kept global).
Detect ap_have_so_reuseport once only at startup.

Restore dummy_connection() as before r1599531 since sending POD signals should
not depend on the number of listeners buckets (there is still one single socket
receiving the connections).

For each MPM (concerned), move the bucket data (pod, listeners and eventually
accept mutex) into a struct and instanciate an array of them (sized by the
number of buckets), for each child to use its own data according to its bucket
index, and the parent to maintain the whole.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1635521 13f79535-47bb-0310-9956-ffa450edef68
2014-10-30 15:24:58 +00:00
Yann Ylavic
7ecfc45fdf core: follow up to r1629909: fix min_spare_threads lower bound and check wrt num_buckets.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629990 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 21:59:02 +00:00
Yann Ylavic
d2bec9df64 core: ensure that MPMs return an error on runtime failure and hence that
httpd's main process also exits with an error.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629925 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 16:54:31 +00:00
Yann Ylavic
90d30c63e0 mpms: enforce assertion that unreachable code is not reached.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629918 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 15:46:05 +00:00
Yann Ylavic
7d64b627e5 core: follow up to r1629909: ap_daemons_to_start can't be lower than 1 (not 0) for prefork either.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629916 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 15:35:56 +00:00
Yann Ylavic
a527db4331 core: Use process scoreboard to store each child's listener bucket,
and silently adjust the configured number of processes/threads to
be above the computed number of listener buckets (depending on the
CPU cores).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629909 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 15:16:02 +00:00
Jan Kaluža
71af35749e event: Fix worker-listener deadlock in graceful restart caused by get_worker()
allocating new worker after ap_queue_info_term(), but not setting the
have_idle_worker variable. PR 56960.

Submitted By: Zin UDA
Committed By: jkaluza


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629577 13f79535-47bb-0310-9956-ffa450edef68
2014-10-06 06:07:47 +00:00
Jan Kaluža
0b98be8f60 event: have_idle_worker must not be cleared in every listener_thread iteration.
Fixes bug when workers were not stopped after graceful restart (introduced in
r1605328).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629576 13f79535-47bb-0310-9956-ffa450edef68
2014-10-06 05:57:02 +00:00
Christophe Jaillet
3bd80dadb5 Fix printf format spotted by cppcheck.
Untested.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1621417 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 06:45:09 +00:00
Jan Kaluža
3bd97552e9 worker MPM: Fix null-dereference crash when using -DFOREGROUND with worker MPM
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1620569 13f79535-47bb-0310-9956-ffa450edef68
2014-08-26 11:05:37 +00:00
Jan Kaluža
c2372b9ae3 prefork: Ignore SIGINT in child. This fixes race-condition in signals handling
when httpd is runnning on foreground and user hits ctrl+c. In this case, SIGINT
is sent to all children followed by SIGTERM from the main process, which
interrupts the SIGINT handler and leads to inconsistency (process freezes
or crashes).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1618555 13f79535-47bb-0310-9956-ffa450edef68
2014-08-18 07:43:43 +00:00
Eric Covener
3b7584a58d mod_proxy_wstunnel: Concurrent websockets messages could be
lost or delayed with ProxyWebsocketAsync enabled.  

Submitted By: Edward Lu
Committed By: covener


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1613493 13f79535-47bb-0310-9956-ffa450edef68
2014-07-25 18:54:03 +00:00
Christophe Jaillet
56d0c25725 Add missing APLOGNO.
Refactor some lines to keep APLOGNO on the same line as ap_log_error, when applicable.
Split lines longer than 80.
Improve alignment.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1612068 13f79535-47bb-0310-9956-ffa450edef68
2014-07-20 09:32:58 +00:00
William A. Rowe Jr
3d737aca1f As noted by Yann, this resulted in a dead var assignment. Preinit won't
work due to the fact that we overload rv as both the DWORD windows result
and the apr_status_t result code.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1611244 13f79535-47bb-0310-9956-ffa450edef68
2014-07-17 04:30:25 +00:00
William A. Rowe Jr
dd79305a3b mpm_winnt: Accept utf-8 (Unicode) service names and descriptions for
internationalization.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1611169 13f79535-47bb-0310-9956-ffa450edef68
2014-07-16 20:15:49 +00:00
William A. Rowe Jr
ec69073576 General whitespace cleanup, error message normalization, and style conformance
for 80 character folding and legibility.

Folds several identical errors into the same APLOGNO() groups.

Catches several errors which were missing APLOGNO() entries, in the
existing groups and in one new message.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1611165 13f79535-47bb-0310-9956-ffa450edef68
2014-07-16 20:06:54 +00:00
Jeff Trawick
42bcf81be8 SECURITY (CVE-2014-3523): Fix a memory consumption denial of
service in the WinNT MPM used in all Windows installations.
Workaround: AcceptFilter <protocol> {none|connect}

Submitted by: trawick
Reviewed by: jorton, covener, jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1610652 13f79535-47bb-0310-9956-ffa450edef68
2014-07-15 11:15:26 +00:00
Rainer Jung
3c4f5a1bb3 Avoid C99 idiom.
Followup to r1604466.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1610323 13f79535-47bb-0310-9956-ffa450edef68
2014-07-13 23:26:12 +00:00
Jeff Trawick
39a3cbbaa8 clarify a comment
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1608785 13f79535-47bb-0310-9956-ffa450edef68
2014-07-08 13:54:09 +00:00
Jeff Trawick
0ff069dd31 Follow-up to r1606368: HANDLE is PVOID which is void * (fix format string)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1607352 13f79535-47bb-0310-9956-ffa450edef68
2014-07-02 12:51:20 +00:00
Jeff Trawick
71916e1357 Follow up to r1527220/r1588852:
Implement better error checking/reporting around notification of abrupt parent
process termination.

It is likely that something bad is happening here based on these
user reports:

https://www.apachelounge.com/viewtopic.php?p=27848
http://mail-archives.apache.org/mod_mbox/httpd-users/201406.mbox/%3CCAC%2BRZnuwLD%2BJnoy2TYO8oeAWt6bFLMa%3DEhfDf9hS3cuuGUHXAw%40mail.gmail.com%3E



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1606368 13f79535-47bb-0310-9956-ffa450edef68
2014-06-28 15:01:11 +00:00
Takashi Sato
3d83bde5ef Revert r1601943, r1602058, r1605307 (socket callback returning pollfds)
Revert r1605369 (wstunnel refactoring)

per discassion on dev@httpd.a.o thread Message-ID:
<CALK=YjN9HfThP_k_rF9iJPcUhcQk9sNOaDPxZNG+HcJNWS4ZAQ@mail.gmail.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1605946 13f79535-47bb-0310-9956-ffa450edef68
2014-06-27 04:17:30 +00:00
Takashi Sato
b63e4f9a27 event: minify local variables scope.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1605328 13f79535-47bb-0310-9956-ffa450edef68
2014-06-25 10:42:32 +00:00
Takashi Sato
eee719b59b follow up r1601943:
Each apr_pollset_poll modified *out_pfd, so we need to copy it.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1605307 13f79535-47bb-0310-9956-ffa450edef68
2014-06-25 09:42:41 +00:00
Eric Covener
9be0156800 followup to r1604350, move the c->sbh assignment to immediately before the
socket is added to the timeout queue. Technically not needed because we hold
the lock on the timeout queue, but more consistent with other blocks that
leave the thread.


Submitted By: Edward Lu <Chaosed0 gmail com>
Committed By: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1605067 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 12:34:52 +00:00
Yann Ylavic
520e7a1441 event: Avoid timer's mutex two successive locks/unlocks with unrelated (and
optional) work in between.

Also saves declaration/usage of pointer 'ep' by reusing available 'te' instead,
and removes duplicated 'te' declaration in a local block.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1604466 13f79535-47bb-0310-9956-ffa450edef68
2014-06-21 21:45:40 +00:00
Yann Ylavic
52d5055aef event: follow up to r1604347.
Don't leak the timer event when it is cancelled.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1604451 13f79535-47bb-0310-9956-ffa450edef68
2014-06-21 20:02:23 +00:00
Eric Covener
191be1b5d6 missed a case in r1538490:
PR56639

Always NULL c->sbh before putting a connection back in a pollset or queue.

We can't NULL c->sbh at the bottom of process_socket() after putting a socket back on 
the event_pollset or having it go into lingering close, because the listener or a worker
thread could A) continue on the connection or B) free and allocate the same conn_rec
pointer before we get to the bottom of process_socket().

Submitted By: Edward Lu
Committed By: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1604350 13f79535-47bb-0310-9956-ffa450edef68
2014-06-21 13:03:19 +00:00
Takashi Sato
83b56e81a0 Do not call a timeout callback after the asociated socket
woke and the socket callback was called.
PR 56642


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1604347 13f79535-47bb-0310-9956-ffa450edef68
2014-06-21 12:58:35 +00:00
Yann Ylavic
5d05482970 Fixed unused "ap_listen_rec *lr;" in prefork_run().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1602827 13f79535-47bb-0310-9956-ffa450edef68
2014-06-16 09:34:36 +00:00
Yann Ylavic
d2e9cc1e16 Mark all unused/duplicated/closed child listeners as inactive.
Fix unused "ap_listen_rec *lr;" in worker_run().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1602826 13f79535-47bb-0310-9956-ffa450edef68
2014-06-16 09:28:01 +00:00
Takashi Sato
273671f6fd style fix, no functional change.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1602544 13f79535-47bb-0310-9956-ffa450edef68
2014-06-14 02:49:35 +00:00
Takashi Sato
de08177faf eventMPM:
fix SEGV in the case socket callback was registered
and no timeout function was registered.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1602409 13f79535-47bb-0310-9956-ffa450edef68
2014-06-13 12:30:12 +00:00