Use an allocator and mutex for ptrans' to be safe with concurrent
creation and destruction of its subpools, like with mod_http2.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783810 13f79535-47bb-0310-9956-ffa450edef68
Keep QUEUE_APPEND()+pollset_add() or QUEUE_REMOVE()+pollset_remove() atomic.
Otherwise when a worker adds an entry in some queue (e.g. KA, lingering), it
might race with the listener in the time between the mutex is released and the
pollset is updated; meanwhile the listener might process the queue and find an
entry no yet in its pollset.
For the lingering queue, the entry could then have been used after its pool
destroyed.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1779354 13f79535-47bb-0310-9956-ffa450edef68
On graceful shutdown/restart, kill kept-alive connections before poll()ing
again, avoiding to wait for their "normal" timers (before being woken up)
when they remain the last handled connections.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1774538 13f79535-47bb-0310-9956-ffa450edef68
Allow to use all slots up to ServerLimit. This makes 'scoreboard full'
errors much less likely.
And if ther is a situation where the scoreboard is full, don't make any
more processes finish gracefully due to reduced load until some old
processes have terminated. Otherwise, the situation would get worse once
the load increases again.
ap_daemon_limit is renamed to the more descriptive active_server_limit,
to make sure that all its uses are taken care of.
PR 53555
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1770752 13f79535-47bb-0310-9956-ffa450edef68
apr_pollset_wakeup(), when implemented, to signal the listener according to the
next timers or timeout queues expiry (updated at insert and maintenance time).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1762718 13f79535-47bb-0310-9956-ffa450edef68
We don't need external locking since it's created with APR_POLLSET_THREADSAFE,
hence reduce those sections to the lowest cycles possible.
A spinlock may be interesting instead of the mutex now, we won't block and the
TO_QUEUE_*() and process_timeout_queue() operations are fast...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1762701 13f79535-47bb-0310-9956-ffa450edef68
MSDN documentation states that
Any unused members of [an OVERLAPPED] structure should always be
initialized to zero before the structure is used in a function call.
Otherwise, the function may fail and return ERROR_INVALID_PARAMETER.
Prior to this patch, the internal state left over from previous
overlapped I/O was passed into the next call. It's unclear what effect
this might have, if any. (I have not personally witnessed an
ERROR_INVALID_PARAMETER myself.)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1758310 13f79535-47bb-0310-9956-ffa450edef68
Further follow-up to the previous commit: now that we no longer patch a
network bucket into the brigade, we can revert to calling
ap_process_connection() directly instead of duplicating its logic.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1758309 13f79535-47bb-0310-9956-ffa450edef68
Follow-up to the prior commit: without an incoming data buffer, the
custom network bucket code is now orphaned and we can remove it
entirely. This has the added benefit that we are no longer using the
internal OVERLAPPED.Pointer field, which is discouraged by the MSDN
docs.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1758308 13f79535-47bb-0310-9956-ffa450edef68
The 'data' AcceptFilter optimization instructs Windows to wait until
data is received on a connection before completing the AcceptEx
operation. Unfortunately, it seems this isn't performed atomically --
AcceptEx "partially" accepts the incoming connection during the wait for
data, leaving all other incoming connections in the accept queue. This
opens the server to a denial of service.
Since the fix for this requires a substantial rearchitecture (likely
involving multiple outstanding calls to AcceptEx), disable the 'data'
filter for now and replace it with 'connect', which uses the AcceptEx
interface but does not wait for data.
Users running prior releases of httpd on Windows should explicitly move
to a 'connect' AcceptFilter in their configurations if they are
currently using the default 'data' filter.
Many thanks to mludha, Arthur Ramsey, Paul Spangler, and many others for
their assistance in tracking down and diagnosing this issue.
PR: 59970
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1758307 13f79535-47bb-0310-9956-ffa450edef68
This causes inconsistent data in the scoreboard (due to async
connections) and makes it difficult to determine what is going on.
Therefore it is not a useful fix for the scoreboard-full issues (PR
53555).
The consent on the dev list is that we should allocate/use more
scoreboard entries instead.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1757031 13f79535-47bb-0310-9956-ffa450edef68
status WRITE (meaning 'in the request processing
phase' even if still consuming the request body,
not literally in a 'now writing' state).
Ensure a number of MPMs and the h2 connection io
no longer clobber the request status line during
state-only changes. While at it, clean up some
very ugly formatting and unnecessary decoration,
and avoid the wordy _from_conn() flavor when we
are not passing a connection_rec.
Ensure the useragent_ip is only used in the case
where it has been initialized, fall back on the
connection's remote_ip if the status is accidently
updated from an uninitialized request_rec.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1741310 13f79535-47bb-0310-9956-ffa450edef68
Follow up to r1738466: During graceful shutdown, when the listener thread is
closing a connection, it needs to wake up a worker thread so that it may
terminate.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1738486 13f79535-47bb-0310-9956-ffa450edef68
During graceful shutdown, if there are more running worker threads than open
connections, terminate some threads. This frees resources faster, which may be
needed for new processes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1738466 13f79535-47bb-0310-9956-ffa450edef68
When shutting down a process gracefully, terminate keep-alive connections so
that we don't get any new requests which may keep the dying process alive
longer.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1738464 13f79535-47bb-0310-9956-ffa450edef68