Skip Menu |

This queue is for tickets about the Net-Server CPAN distribution.

Report information
The Basics
Id: 32266
Status: resolved
Priority: 0/
Queue: Net-Server

People
Owner: Nobody in particular
Requestors: mbarbon [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.97
Fixed in: (no value)



Subject: [PATCH] Correctly tally dequeue process with prefork
Hi, I have noticed that since dequeue childs are not correctly tallied when using Net::Server::PreFork; as a result, when using check_for_dequeue, more and more dequeue processes are forked, regardless of the required number of dequeue processes. I propse the following addition to PreFork.pm. I can provide a proper patch with tests if this solution is OK for you. Thanks! Mattia sub run_dequeue { my( $self ) = @_; my $pid = fork; ### trouble if( not defined $pid ){ $self->fatal("Bad fork [$!]"); ### parent }elsif( $pid ){ $self->{server}->{children}->{$pid}->{status} = 'dequeue'; $self->{server}->{tally}{dequeue} += 1; ### child }else{ $self->dequeue(); exit; } }
From: m-uchino [...] yetipapa.com
(Sorry, my English is poor.) I think that, this patch solves this problem when check_for_dequeue is smaller than 30. If check_for_dequeue is bigger than 30, this problem does not happen, because coordinate_children() calculates {tally} every 30 seconds. And, this patch solves other problem. I set dequeue and log was buried below exhaustively. Tally for dequeue < 0 deleting pid 123 dequeue is not killed by a parent, it kills itself. (exit) And {reaped_children} is set by SIG{CHLD}. coordinate_children() checks {reaped_children} and it calls delete_child() BEFORE it calculates {tally}. Therefore, {tally} is still ZERO when delete_child() runs. delete_child() reduces 1 and it is subtracted. This patch corrects {tally} before delete_child() runs. But, I don't understand why coordinate_children() calculates {tally} every 30 seconds. I think best way is, {tally} is calculated before. And it is recalculated when delete_child() called.
Thank you for your report. Variations of this code are in the most recent version.