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
In reply to Reaping Zombies (dont wanna wait) by seaver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |