redundant assignment (clang warning), the apr_file_eof(fp)=>APR_EOF
case assigns rv to APR_EOF and then to APR_SUCCESS after already.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1842882 13f79535-47bb-0310-9956-ffa450edef68
Since persistent files are also reused on stop/start, we must ensure that
they match the same descriptor when reused on the next startup, so add it
to integrity metadata.
Also, the descriptor being the first field in the SHM, we don't need to
copy on the stack it in several places, and can handle it as a pointer.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1831871 13f79535-47bb-0310-9956-ffa450edef68
Don't try to attach SHMs on startup, they might be from a previous crash and
prevent the server to start (on failure to reuse it).
On mpm_winnt though, the pre/post_config() phases are re-run in child process,
and the parent process already created the SMs, so they must be attached there.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1831870 13f79535-47bb-0310-9956-ffa450edef68
Successive generations can't share the same SHMs because restarts may modify
them under the terminating children, while SHMs are not extensible when all
slots are in use.
This effectively restores r1822341 which was reverted by r1822505.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1831869 13f79535-47bb-0310-9956-ffa450edef68
The caller might (and actually balancer_child_init() does) rely on
slotmem_attach() to not mangle the passed in/out slotmem pointer on
failure.
[Reverted by r1831868]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1831394 13f79535-47bb-0310-9956-ffa450edef68
Modifying the number of proxy balancers or balancer members on restart
could have prevented the server to load, notably on Windows. PR 62308.
The generation number integrated in the SHM filename allows to create a
new/resized SHM while the previous is still in use by previous generation
gracefully shutting down (Windows prevents SHM/file to be removed in this
case, but even on Unix(es) an unlinked file might not be re-openable while
an inode exists). The generation number is added/incremented only if the
size requirement changed, such that unrelated restarts continue to share
SHMs between generations.
The cleanup handling is also simplified because both the parent process and
the Windows child process need to cleanup everything on exit. This translates
to cleanup_slotmem() being always registered but in the dry load state
(AP_SQ_MS_CREATE_PRE_CONFIG), for both cases still.
[Reverted by r1831868]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1830800 13f79535-47bb-0310-9956-ffa450edef68
Complete layout of SHM and persited file (ascii art).
Simplify an "if" condition, no functional change.
[Reverted by r1831868]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1823416 13f79535-47bb-0310-9956-ffa450edef68
Do not bind attached slotmems to the global list, they should be detached with
the given pool (pchild) is cleaned up, but not destroyed/removed (doubly) with
pglobal.
[Reverted by r1831868]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1823415 13f79535-47bb-0310-9956-ffa450edef68
Please buildbot (and incidentally users of older APR) by using
apr_shm_remove() instead of the new(er) apr_shm_delete().
[Reverted by r1831868]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822511 13f79535-47bb-0310-9956-ffa450edef68
To fix races with graceful restarts (PR 62044).
This commit does:
1/ use a constant file name for all systems (no generation suffix which
makes a new SHM to be created for each restart, losing previous data)
2/ maintain the list of the created SHMs accross restarts (ap_pglobal list)
3/ not unlink the files on restart anymore (otherwise we can't reuse them)
4/ not attach existing SHMs in slotmem_create() anymore (not suitable since
those are necessarily crash remainders)
5/ add type/sizes consistency check for persisted slots on restoration
6/ unlink the files only on stop/exit or before creating them (crash recovery)
We could possibly avoid 6/ (since we don't need to re-open files now) if we
remove the file just after the SHM is created. This would at least work for
systems with "unlink semantic" (i.e. unlink succeeds even if some descriptors
are opened, the "real" thing happening when the last one desciptor closed), but
this wouldn't work for other systems so I kept the code generic for now.
[Reverted by r1831868]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822509 13f79535-47bb-0310-9956-ffa450edef68
Make systems without unlink() semantic happy by destroying (detaching) the SHM
before removing the base file.
Windows is supposed to have the "delete on last handle closed" semantic but yet
fails here when this handle is owned by the same process (go figure!).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1703169 13f79535-47bb-0310-9956-ffa450edef68
r1702450 changed the behaviour of slotmem_{create,attach}() when given
given an absolute (SHM file )name.
Don't mangle the SHM file name in this case, it's up to the caller to
provide a unique name per call when this matters.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1703149 13f79535-47bb-0310-9956-ffa450edef68
Use the generation number from the MPM (AP_MPMQ_GENERATION) since
AP_SQ_CONFIG_GEN is irrelevent in non-forked MPMs children.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1702501 13f79535-47bb-0310-9956-ffa450edef68
restart when new ones are added (Windows and OS/2 only). PR 58024.
Since Windows and OS/2 don't have the unlink() but the "delete on last close"
semantic for opened files being removed, we can't reuse the same SHM files
names for processes of different generation. Let's append the generation
number in the files names for those.
This commit also axes unused Unix specifics about mutexes/semaphores.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1702450 13f79535-47bb-0310-9956-ffa450edef68
They were added in r1542732.
The need of apr_version.h has been removed in r1561200.
The need of apr_hash.h has been removed in r1561211.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657965 13f79535-47bb-0310-9956-ffa450edef68
Improve messaging...
* easier to tell what went wrong in some cases
* reduce number of debug messages without losing information in some cases
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1574151 13f79535-47bb-0310-9956-ffa450edef68
cross forks, so child processes have access.
When we need true external access, this is something
that APR shm must provide. We should have no
knowledge of APR internals.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1561385 13f79535-47bb-0310-9956-ffa450edef68
The last arg to apr_file_write_full() isn't needed
unless you need to know the number of bytes written before
an error occurred.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1542413 13f79535-47bb-0310-9956-ffa450edef68