MPMs event and worker both need a dedicated pool to handle the creation of
the threads (listener, workers) and synchronization objects (queues, pollset,
mutexes...) in the start_threads() thread, with at least the lifetime of
the connections they handle, and thus survive pchild destruction (notably
in ONE_PROCCESS mode, but SIG_UNGRACEFUL is concerned too).
For instance, without this fix, the below backtrace can happen in ONE_PROCCESS
mode and a signal/^C is received (with active connections):
Thread 1 "httpd" received signal SIGSEGV, Segmentation fault.
(gdb) bt
#0 <BOOM>
#1 0x00007ffff7c7e016 in apr_file_write (thefile=0x0, ...)
^ NULL (cleared)
at file_io/unix/readwrite.c:230
#2 0x00007ffff7c7e4a7 in apr_file_putc (ch=1 '\001', thefile=0x0)
^ NULL (cleared)
at file_io/unix/readwrite.c:377
#3 0x00007ffff7c8da4a in apr_pollset_wakeup (pollset=0x55555568b870)
^ already destroyed by pchild
at poll/unix/pollset.c:224
#4 0x00007ffff7fc16c7 in decrement_connection_count (cs_=0x7fff08000ea0)
at event.c:811
#5 0x00007ffff7c83e15 in run_cleanups (cref=0x7fffe4002b78)
at memory/unix/apr_pools.c:2672
#6 0x00007ffff7c82c2f in apr_pool_destroy (pool=0x7fffe4002b58)
^ master_conn
at memory/unix/apr_pools.c:1007
#7 0x00007ffff7c82c12 in apr_pool_destroy (pool=0x7fff08000c28)
^ ptrans
at memory/unix/apr_pools.c:1004
#8 0x00007ffff7c82c12 in apr_pool_destroy (pool=0x555555638698)
^ pconf
at memory/unix/apr_pools.c:1004
#9 0x00007ffff7c82c12 in apr_pool_destroy (pool=0x555555636688)
^ pglobal
at memory/unix/apr_pools.c:1004
#10 0x00005555555f4709 in ap_terminate ()
at unixd.c:522
#11 0x00007ffff6dbc8f1 in __run_exit_handlers (...)
at exit.c:108
#12 0x00007ffff6dbc9ea in __GI_exit (status=<optimized out>)
at exit.c:139
#13 0x00007ffff7fc1616 in clean_child_exit (code=0)
at event.c:774
^ pchild already destroyed here
#14 0x00007ffff7fc5ae4 in child_main (child_num_arg=0, child_bucket=0)
at event.c:2869
...
While at it, add comments about the lifetimes of MPMs pools and their objects,
and give each pool a tag (e.g. "pchild" accordingly to other MPMs).
(follow up for event_pollset in r1835846).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1835845 13f79535-47bb-0310-9956-ffa450edef68
because of the changes to the argument lists of apr_mmap_dup and apr_socket_create,
2.1-dev won't build with apr and apr-util's 0.9 branch anymore
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101154 13f79535-47bb-0310-9956-ffa450edef68
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
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101122 13f79535-47bb-0310-9956-ffa450edef68
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.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96005 13f79535-47bb-0310-9956-ffa450edef68
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.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94304 13f79535-47bb-0310-9956-ffa450edef68
we're going to use as they could contain leftovers from a previous child.
This solves a problem where a non-graceful restart followed by a graceful
restart would leave previous generation children stuck waiting for non-existant
worker threads to terminate.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93548 13f79535-47bb-0310-9956-ffa450edef68
client_socket from the conn_rec. Diffs from Ryan's patch include:
- rename the create_connection hook to install_transport_filters
- move the point of invocation of the hook till after the call to
after ap_update_vhost_given_ip to enable the hook to use vhost
config info in its decision making.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93087 13f79535-47bb-0310-9956-ffa450edef68
conn_rec. The create_connection_hook has a design flaw that prevents it
from making decisions based on vhost information.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93050 13f79535-47bb-0310-9956-ffa450edef68
pointer math. This is required for portable scoreboards.
vhost becomes the 'vhost name string' so it now survives ap_generation
clicks. next was apparently never used.
This patch also accounts for the changes to the apr_shm api, and gives
Win32 the magic of a shared scoreboard.
Breakage aplenty on non-win32 platforms, I suspect, but this radical
surgery, and culling of unused functions, was really, really needed.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92791 13f79535-47bb-0310-9956-ffa450edef68
many bugs. Instead, it is called where it used to be called. I have
abstracted some of the logic out of the lingering close so that it gets
the socket from the connection using the core's conn_config vector. This
is in anticipation of a change to use a hook for the lingering close,
which I hope to do soon.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91968 13f79535-47bb-0310-9956-ffa450edef68
The first step is to remove the socket from the conn_rec,
the server now lives in a context that is passed to the
core's input and output filters. This forces us to be very
careful when adding calls that use the socket directly,
because the socket isn't available in most locations.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91887 13f79535-47bb-0310-9956-ffa450edef68
a cleanup registered with the connection_pool. I have also turned
ap_lingering_close into a static function, because it is only used
in connection.c. This is the next step to consolidating all of the
socket function calls. ap_lingering_close will only be added if the
core is dealing with a standard socket.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91832 13f79535-47bb-0310-9956-ffa450edef68
connections in the process. When this occurs, a graceful shutdown of the
child is initiated so any leaked resources & hosed memory is disposed of ASAP.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90400 13f79535-47bb-0310-9956-ffa450edef68
better than spmt_os2 already (graceful restarts actually work). A summary
of the process/thread structure is provided in the comments at the start
of mpmt_os2.c
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90289 13f79535-47bb-0310-9956-ffa450edef68