Dear all,

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

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.