perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <torsten.foert...@gmx.net>
Subject Re: Scoreboard effects on server performance [was Re: Accessing list of worker statuses in /server-status via Apache2::Status]
Date Thu, 09 Jan 2014 10:13:02 GMT
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.

Mime
View raw message