amavis crashing in Natty

Mark Martinec Mark.Martinec+amavis at ijs.si
Wed Apr 6 19:16:44 CEST 2011


> Don't know what makes Maverick behave better than Natty, but
> as far as I can tell it is pure luck, depending on timing.
> 
> The underlying problem seems to be in Net::Server, whose master process
> does not wait for its child processes to shut down when it tells them to.

Actually, the underlying problem seems to be a change in the TCP/IP stack
or kernel.  The following test program can be normally be started repeatedly
without a failure, but chokes on Natty unless at least 13 seconds pass
from a shutdown of the previous incarnation to a new start:


 #!/usr/bin/perl
use strict;
use Socket;

  socket(Server, PF_INET, SOCK_STREAM, getprotobyname('tcp'))
    or die "socket: $!";
  setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack('l', 1))
    or die "setsockopt: $!";
  bind(Server, sockaddr_in(2222, inet_aton('127.0.0.1')))
    or die "bind: $!";
  listen(Server, SOMAXCONN)
    or die "listen: $!";

  my $pid = fork();
  if (!$pid) {  # child
    print "\nChild $$\n";
    sleep 10;
    exit;
  }

  # parent
  print "\nParent $$\n";
  shutdown(Server,2)  or die "shutdown: $!";



Mark


More information about the amavis-users mailing list