I hope You're still tracking this thread, because i've got real big problem with this program after "patching" it...

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.