httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@ai.mit.edu (Robert S. Thau)
Subject Re: changes to mod_cookies.c
Date Wed, 16 Aug 1995 09:29:01 GMT
   Date: Wed, 16 Aug 95 10:06 BST
   From: drtr@ast.cam.ac.uk (David Robinson)

   Ahh well, I'm not surprised it doesn't work; no one mentioned log files
   over NFS before. I've justed checked; 0.8.8 hangs on a restart if error_log
   is NFS mounted.

   File locking on a file mounted over NFS is TERRIBLE BEHAVIOUR. Apart
   from the dire server performance this incurs, lock daemons are notoriously
   buggy.

This can be solved for the moment by locking the scoreboard file
(which is, for now, guaranteed to be in /tmp); if we move the
scoreboard file elsewhere, then at that point we could open a file in
/tmp, and immediately unlink it; this would allow us still lock it,
with fcntl() at least (though not with flock()), while keeping files
from piling up in /tmp.

(And, clearing up another mystery, the reason this shows up only on
Solaris is that the accept()-locking is #ifdeffed out on other
systems). 

   Apache should NEVER be trying to lock a file that is mounted over NFS.
   And this is yet another reason why the scoreboard file should not be
   in the logs directory, performance will suffer again.

Actually, it's the first such reason I've heard --- it may not be a
bad one, though... FWIW, the scoreboard machinery doesn't require any
locking at all on the scoreboard file per se (it's arranged so that
there's only one process which should be writing a given byte in the
file at any given time), so it ought to *work* over NFS.

   -1 on releasing 0.8.9 for 1 day to give me a chance to fix this.

Locking the scoreboard file instead of the error log should be
adequate for the moment... something like this:  (warning: am testing
now...) 

*** http_main.c~	Sat Aug 12 10:45:01 1995
--- http_main.c	Wed Aug 16 09:26:23 1995
***************
*** 140,151 ****
  #ifdef FCNTL_SERIALIZED_ACCEPT
  struct flock lock_it = { F_WRLCK, 0, 0, 0 };
  struct flock unlock_it = { F_UNLCK, 0, 0, 0 };
  
  void accept_mutex_on()
  {
      int ret;
      
!     while ((ret = fcntl(fileno(server_conf->error_log),F_SETLKW, &lock_it)) <
0
  	   && errno == EINTR)
  	continue;
  
--- 140,152 ----
  #ifdef FCNTL_SERIALIZED_ACCEPT
  struct flock lock_it = { F_WRLCK, 0, 0, 0 };
  struct flock unlock_it = { F_UNLCK, 0, 0, 0 };
+ static int scoreboard_fd;
  
  void accept_mutex_on()
  {
      int ret;
      
!     while ((ret = fcntl(scoreboard_fd, F_SETLKW, &lock_it)) < 0
  	   && errno == EINTR)
  	continue;
  
***************
*** 158,164 ****
  
  void accept_mutex_off()
  {
!     fcntl (fileno(server_conf->error_log), F_SETLKW, &unlock_it);
  }
  #else
  /* Default --- no serialization.  Other methods *could* go here,
--- 159,165 ----
  
  void accept_mutex_off()
  {
!     fcntl (scoreboard_fd, F_SETLKW, &unlock_it);
  }
  #else
  /* Default --- no serialization.  Other methods *could* go here,

Mime
View raw message