seaver has asked for the wisdom of the Perl Monks concerning the following question:
I have a daemon awaiting xml-rpc requests at a port:
#!/usr/bin/env perl use XMLRPC::Transport::HTTP; use XML::Xerces; use XML::Xerces::DOMParse; use Carp; use Fcntl ":flock"; my $daemon = XMLRPC::Transport::HTTP::Daemon -> new (LocalPort => 8081, Reuse => 1) -> dispatch_to('Monster') ; print "Contact to XMLRPC server at ", $daemon->url, "\n"; $daemon->handle; sub go{ shift if UNIVERSAL::isa($_[0] => __PACKAGE__); my $CP = shift; $SIG{CHLD} = 'IGNORE'; ...various faffing about with $CP.... FORK: { $child = fork; if (defined $child) { if($child == 0){ my $exec = "/usr/local/bin/monster -i$id $filePath$file +&"; qx/$exec/; } }elsif ($! == EAGAIN) { sleep 5; redo FORK; }else { die "Can't fork: $!\n"; } } return 0; }
To describe my problem, once i'm running this daemon, and contact it from an applet, it creates two copies (hence the fork) but the second copy, even after 'monster' has finished, never dies, and I want it to die, i dont want any zombies.
Also, I get this error message: "Can't ignore signal CHLD, forcing to default."
Also i dont want to have to wait for process to finish, and for any number of requests to be made at any time, however, once i try to send another request, the webpage hangs, and the daemon dies of a broken pipe....
I was wondering if anyone has any ideas? Im pretty bad at interactions outside perl, cant get my head around it...
Thanks
Sam Seaver
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reaping Zombies (dont wanna wait)
by DrManhattan (Chaplain) on Jun 09, 2003 at 18:03 UTC | |
by halley (Prior) on Jun 09, 2003 at 18:13 UTC | |
|
Re: Reaping Zombies (dont wanna wait)
by bobn (Chaplain) on Jun 09, 2003 at 17:58 UTC | |
|
Re: Reaping Zombies (dont wanna wait)
by sgifford (Prior) on Jun 09, 2003 at 21:07 UTC | |
|
Re: Reaping Zombies (dont wanna wait)
by pemungkah (Priest) on Jun 11, 2003 at 17:12 UTC | |
by Anonymous Monk on Jun 11, 2003 at 18:53 UTC | |
by seaver (Pilgrim) on Jun 11, 2003 at 18:55 UTC | |
by pemungkah (Priest) on Jun 24, 2003 at 21:19 UTC | |
by dragonchild (Archbishop) on Jul 09, 2004 at 15:48 UTC |