Skip Menu |

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

Report information
The Basics
Id: 82539
Status: resolved
Priority: 0/
Queue: Net-Daemon

People
Owner: Nobody in particular
Requestors: kas [...] fi.muni.cz
Cc:
AdminCc:

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



Subject: Net::Daemon fork mode on Windows/Strawberry Perl
We are trying to use a RPC::PlServer service on a Windows machine running Strawberry Perl. RPC::PlServer inherits from Net::Daemon. We use fork mode, and the server keeps dying with "resource not available" after ~64th connection. From the list of processes/threads we think the child processes (threads under Windows) are not reaped when they exit(). Using the standard technique of ignoring child process states (i.e. $SIG{CHLD} = 'IGNORE'; ) did not help. Reaping the child processes explicitly using waitpid() helped, though. Please consider applying the attached patch or using it as a basis for more general solution. Thanks!
Subject: Net-Daemon.diff
--- v0.48/Net/Daemon.pm 2011-03-09 17:41:12.000000000 +0100 +++ new/Net/Daemon.pm 2013-01-07 20:11:18.000000000 +0100 @@ -33,6 +33,8 @@ package Net::Daemon; +use POSIX ":sys_wait_h"; + $Net::Daemon::VERSION = '0.48'; # Dummy share() in case we're >= 5.10. If we are, require/import of @@ -491,7 +493,10 @@ } else { my $pid = fork(); die "Cannot fork: $!" unless defined $pid; - return if $pid; # Parent + if ($pid) { # Parent + 1 while (waitpid(-1,WNOHANG) > 0); + return; + } $self->$method(@args); # Child exit(0); }
Ticket migrated to github as https://github.com/toddr/Net-Daemon/issues/5