On 09/01/14 00:53, Fred Moyer wrote:
> Getting a segfault with httpd 2.2.24/5.14.2, will get a coredump and
> backtrace and report back.
> 
I probably missed your initial mail, sorry. I take it the perl
application accessing the scoreboard dumps core, not the apache, right?

You need to compile the perl module with exactly the same header files
as apache. Also, it may be an issue with the .24. I don't remember which
version I last tried it with. But I doubt that. The scoreboard structure
has been very stable over the years. Another reason might be how apache
accesses the scoreboard. There is a setting when you compile APR how
anonymous and name-based shared memory is created. I compile my apaches
to use classical mmap for that. [1] Default is to use SysV shmget. I am
currently not aware if apache uses this configuration to create the
shared scoreboard. If it does, then that explains the coredump. SysV
shared memory needs the file only to compute a unique key (based on
inode/device number) in a completely different namespace.

The perl module simply uses mmap.

Would be best, I think, to use APR also in the perl module to connect
the shared memory segment. Feel free to provide a patch.

The relevant piece of code is this function in ScoreBoardFile.xs:

static inline int
init(int fd, Apache2__ScoreBoardFile *result) {
  void *map;
  struct stat statbuf;

  *result=NULL;
  if(fstat(fd, &statbuf)) return -1;

  map=mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
  if( map==MAP_FAILED ) return -1;

  *result=map;
  return 0;
}

Torsten


[1] I found that administrators often don't know about ipcs and how to
kill a SysV shared memory segment in case on an unclean shutdown (kill
-9). Mmap based shm is more hassle-free in such situations.
--- configure.orig	2011-10-07 11:53:28.392251385 +0200
+++ configure	2011-10-07 12:52:50.253787714 +0200
@@ -27755,6 +27755,13 @@
 
         ;;
 esac
+    for ac_item in USE_SHMEM_MMAP_ANON; do
+         eval "ac_decision_this=\$ac_decision_${ac_item}"
+         if test ".$ac_decision_this" = .yes; then
+             ac_decision=$ac_item
+             eval "ac_decision_msg=\$ac_decision_${ac_item}_msg"
+         fi
+    done
 if test ".$ac_decision" = .; then
     echo "$0:Error: decision on $ac_decision_item failed" 1>&2
     exit 1
@@ -28056,6 +28063,13 @@
         fi
         ;;
 esac
+    for ac_item in USE_SHMEM_MMAP_TMP; do
+         eval "ac_decision_this=\$ac_decision_${ac_item}"
+         if test ".$ac_decision_this" = .yes; then
+             ac_decision=$ac_item
+             eval "ac_decision_msg=\$ac_decision_${ac_item}_msg"
+         fi
+    done
 if test ".$ac_decision" = .; then
     echo "$0:Error: decision on $ac_decision_item failed" 1>&2
     exit 1

Reply via email to