Below is the changed fragment (old code is commented), and the problem is that it seems it's not multithreaded! I watched `ps fauxw` and during heavy load, while old version was runnig there were from 3 to 8 processes in beautiful tree, now it seems it has 1 child only at a time... Related problem is that during heavy load like this i get "connetcion refused" on clients...
Is there something wrong in this code? Maybe i just misunderstood Your "patching instructions"
Please Help!
my $dbh = DBI->connect("DBI:mysql:database=qmail;host=localhost", "qmail", $pass, {'RaiseError' => 1}); logmsg "server started on port $port"; my $waitedpid = 0; my $paddr; sub REAPER { #!!!!!!!!!!!!v $waitedpid = wait; $SIG{CHLD} = \&REAPER; # loathe sysV #logmsg "reaped $waitedpid" . ($? ? " with exit $?" : ''); } $SIG{CHLD} = \&REAPER; #!!!!!!!!!!!!!!^ for ( $waitedpid = 0; ($paddr = accept(Client,Server)) || $waitedpid; $waitedpid = 0, close Client) { next if $waitedpid and not $paddr; my($port,$iaddr) = sockaddr_in($paddr); my $name = gethostbyaddr($iaddr,AF_INET); logmsg "connection from $name [", inet_ntoa($iaddr), "] at port $port"; #do { # $kid = waitpid(-1,&WNOHANG); # } until $kid == -1; spawn sub { my $line = <STDIN>; chomp $line; my @param = split (/ /,$line);
-- Daniellek
In reply to Re: Re: Attempt to free unreferenced scalar...
by Daniellek
in thread Attempt to free unreferenced scalar...
by Daniellek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |