Couple of more issues resolved, this time regarding daemonization of POE
processes, see below. Thanks!

-- Mike

Mike Schilli
m...@perlmeister.com

---------- Forwarded message ----------
From: "p...@0ne.us" <p...@0ne.us>
To: Mike Schilli <m...@perlmeister.com>
Subject: Re: POE::Wheel::Run and sig_child
Date: Thu, 22 Apr 2010 21:23:09 -0700

Hmm, I didn't realize it was myself who replied to that thread ;)

If I remember correctly it's because POE caches the signal handlers on
startup ( not POE::Kernel->run() time BUT during the use/compile time )
and if you fork afterwards, it gets confused... That's why you generally
need to call the POE::Kernel->has_forked() sub after you fork so it can
futz with the internals -
http://search.cpan.org/~rcaputo/POE-1.289/lib/POE/Kernel.pm#has_forked

P.S. Could you please post this to the mailinglist too? That way, future
POE users could find the answer in the archives :)

~Apocalypse

Mike Schilli wrote:
On Thu, 22 Apr 2010, p...@0ne.us wrote:

Oh, you could grep the mailinglist for daemonization issues - there
were a few posts about that some weeks ago... The advice in there
probably would apply to you :)

OMG, you did it again, jackpot! I added the BEGIN block and all of
a sudden the daemon works just fine.

I guess you referred to this post:

    http://www.mail-archive.com/poe@perl.org/msg04514.html

However, I couldn't find an explanation on why this is required ... do
you have a pointer ready by any chance?

Thanks again!

-- Mike

Mike Schilli
m...@perlmeister.com


In a nutshell: Don't load POE until you've daemonized... sample code:

BEGIN {
   use Net::Server::Daemonize;    # or any other daemonization module
   daemonize();
}
use POE;

~Apocalypse

Mike Schilli wrote:
On Wed, 21 Apr 2010, p...@0ne.us wrote:

   Ah, Let me fix a few bugs/typos in your code then it'll work as
   intended!

Wow, thanks a lot for that, it was really helpful -- let me work
that in
and come back with more questions :) I have a weird case where after
a daemon forks and then starts a POE kernel all of a sudden doesn't
handle signals properly anymore, but I'll try to figure it out myself
with the info you sent.

Thanks again!

-- Mike

Mike Schilli
m...@perlmeister.com

Reply via email to