]> granicus.if.org Git - apache/commit
mod_slotmem_shm: Rework SHM reuse/deletion.
authorYann Ylavic <ylavic@apache.org>
Mon, 29 Jan 2018 14:34:50 +0000 (14:34 +0000)
committerYann Ylavic <ylavic@apache.org>
Mon, 29 Jan 2018 14:34:50 +0000 (14:34 +0000)
commitea253a63730ab067d1fb841d40f9d3b0479a96b7
treeb8948a5ff96b8e9300175054ae98f18370b16fa8
parent5ff25379f5eefce2065179cf607c6002b28fef2d
mod_slotmem_shm: Rework SHM reuse/deletion.

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
CHANGES
modules/slotmem/mod_slotmem_shm.c