Dear APR developers,
Like a couple of random folks on the great Internet (http://www.google.fr/search?hl=fr&q=%22name-based+shared+memory+failure%22), I've been unsuccessfully trying to use a ScoreBoardFile with Apache 2.0.52 under Linux (Debian testing). Symptoms are:
* your usual SysV IPC leakage, which prevents me from restarting the
server (I *did* shutdown Apache with care and SIGTERM);
* the ScoreBoard does not actually contain a scoreboard, only what
looks like a rendez-vous into the allocated SysV shared memory
segment. (I would love to be able to parse the scoreboard file
from Perl as I did with Apache 1.3, without resorting to some
weirdo SysV-shm CPAN wrappage).Tracing the problem back, I found that in my libapr configuration, I have
#define APR_USE_SHMEM_SHMGET 1 #define APR_USE_SHMEM_MMAP_ANON 1
(the rest of APR_USE_SHMEM_* being 0 - this seems to be the normal outcome for Linux as one of the aforementioned folks had the same thing under RedHat), and this in turn is because apr/trunk/configure.in (fresh from Subversion, around line 801) prefers "SysV IPC shmget()" over "Classical mmap() on temporary file", which is the *worse* option in configure.in's view (according to a comment way below, at line 1631).
Now, why on earth would one prefer SysV shared memory over file-based mmap() when both are available? At the very least this should be made a command-line configuration option, for the benefit of distribution maintainers who want to get rid of SysV stuff altogether. Enclosed is a patch to configure.in that sets mmap-first behavior (w/o a command-line switch), and shuffles the documentation around a bit so as to avoid future confusion on this topic.
Best regards and thanks for all the hard work,
-- << Tout n'y est pas parfait, mais on y honore certainement les jardiniers >>
Dominique Quatravaux <[EMAIL PROTECTED]>
Index: configure.in
===================================================================
--- configure.in (revision 149267)
+++ configure.in (working copy)
@@ -729,6 +729,7 @@
fi
# Now we determine which one is our anonymous shmem preference.
+# The last APR_DECIDE to execute sets the default.
haveshmgetanon="0"
havemmapzero="0"
havemmapanon="0"
@@ -793,25 +794,26 @@
AC_SUBST(havemmapanon)
# Now we determine which one is our name-based shmem preference.
+# The last APR_DECIDE to execute sets the default.
havemmaptmp="0"
havemmapshm="0"
haveshmget="0"
havebeosarea="0"
haveos2shm="0"
APR_BEGIN_DECISION([namebased memory allocation method])
-APR_IFALLYES(header:sys/mman.h func:mmap func:munmap,
- [havemmaptmp="1"
- APR_DECIDE(USE_SHMEM_MMAP_TMP,
- [Classical mmap() on temporary file])])
+APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl
+ func:shmget func:shmat func:shmdt func:shmctl,
+ [haveshmget="1"
+ APR_DECIDE(USE_SHMEM_SHMGET, [SysV IPC shmget()])])
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap func:shm_open dnl
func:shm_unlink,
[havemmapshm="1"
APR_DECIDE(USE_SHMEM_MMAP_SHM,
[mmap() via POSIX.1 shm_open() on temporary file])])
-APR_IFALLYES(header:sys/ipc.h header:sys/shm.h header:sys/file.h dnl
- func:shmget func:shmat func:shmdt func:shmctl,
- [haveshmget="1"
- APR_DECIDE(USE_SHMEM_SHMGET, [SysV IPC shmget()])])
+APR_IFALLYES(header:sys/mman.h func:mmap func:munmap,
+ [havemmaptmp="1"
+ APR_DECIDE(USE_SHMEM_MMAP_TMP,
+ [Classical mmap() on temporary file])])
APR_IFALLYES(header:kernel/OS.h func:create_area,
[havebeosshm="1"
APR_DECIDE(USE_SHMEM_BEOS, [BeOS areas])])
