Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 34803
Status: resolved
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: perl [...] 0ne.us
Cc:
AdminCc:

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



Subject: POE v1.0000 broke signal semantics?
Date: Wed, 09 Apr 2008 18:08:41 -0400
To: bug-POE [...] rt.cpan.org
From: Apocalypse <perl [...] 0ne.us>
Hello, After updating POE on my test server, I noticed my application was unable to gracefully shutdown. It seemed to be eating memory for a long time before I had to manually kill the process. After investigation, the culprit seemed to be the way POE processes DIE signals. The way I shutdown the application is to post a DIE signal to the POE::Kernel object, and have it propagate to all sessions. All of my sessions are detached sessions. The exact code is: $poe_kernel->signal( $poe_kernel, "DIE" ); On POE-0.9500 POE will correctly process this and propagate signals. However, on POE-1.0000 it exhibits either behavior: If ASSERT_DEFAULT is turned on: throw errors about improper access (snippet below) if not: hang in a loop, eating memory (TRACE_DEFAULT shows no activity) I have verified this weird behavior by installing different versions of POE and running my app against it. Both versions of POE passes tests on my boxes. POE-0.9500 signal processing: Show quoted text
> <ev> dispatching event 231 (_signal) at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Events.pm line 242 > <rc> decrementing refcount for session dc3-vcs-47fd37af000079f3 (POE::Kernel=ARRAY(0xa1aab0)) at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 331 > <rc> decrementing refcount for session 16 (Server-Debug) at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 331 > <ev> Dispatching event 231 ``_signal'' (DIE) from session 16 (Server-Debug) to session dc3-vcs-47fd37af000079f3 (POE::Kernel=ARRAY(0xa1aab0)) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 847 > <sg> dispatching ET_SIGNAL (DIE) to session dc3-vcs-47fd37af000079f3 (POE::Kernel=ARRAY(0xa1aab0)) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 886 > <sg> propagating explicit signal death_handler (DIE) to session 10 (Admin) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 922 > <ev> Dispatching event -932 ``death_handler'' (DIE) from session dc3-vcs-47fd37af000079f3 (POE::Kernel=ARRAY(0xa1aab0)) to session 10 (Admin) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 847 > <ev> dispatching event -932 ``death_handler'' to session 10 (Admin) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 973 > ( 04/09/08 17:40:08.374327 ) DEBUG: VCS::Admin:71 - stopped > <ev> event -932 ``death_handler'' returns (undef) > <sg> propagating explicit signal death_handler (DIE) to session 8 (Reporting) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 922 > <ev> Dispatching event -932 ``death_handler'' (DIE) from session dc3-vcs-47fd37af000079f3 (POE::Kernel=ARRAY(0xa1aab0)) to session 8 (Reporting) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 847 > <ev> dispatching event -932 ``death_handler'' to session 8 (Reporting) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 973 > ( 04/09/08 17:40:08.379375 ) DEBUG: VCS::Reporting:83 - stopped > <ev> event -932 ``death_handler'' returns (undef) > ...
POE-1.0000 signal processing: Show quoted text
> <ev> dispatching event 234 (_signal) at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Events.pm line 249 > <rc> decrementing refcount for session dc3-vcs-47fd39b200007bfb (POE::Kernel=ARRAY(0xa0df50)) at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 329 > <rc> decrementing refcount for session 16 (Server-Debug) at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 329 > <ev> Dispatching event 234 ``_signal'' (DIE) from session 16 (Server-Debug) to session dc3-vcs-47fd39b200007bfb (POE::Kernel=ARRAY(0xa0df50)) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 847 > <sg> dispatching ET_SIGNAL (DIE) to session dc3-vcs-47fd39b200007bfb (POE::Kernel=ARRAY(0xa0df50)) at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 886 > Please mail the following information to bug-POE@rt.cpan.org: > retrieving parent of a nonexistent session at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 261 > POE::Kernel::_data_ses_get_parent('POE::Kernel=ARRAY(0xa0df50)', 'undef') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 917 > POE::Kernel::_dispatch_event('POE::Kernel=ARRAY(0xa0df50)', 'POE::Kernel=ARRAY(0xa0df50)', 'POE::Session=ARRAY(0x2ae6f90)', '_signal', 16, 'ARRAY(0x2b18400)', '/home/larwan/vcs_install/perl/lib/VCS/Logger.pm', 182, 'POE::Wheel::ReadWrite(15) -> select read', ...) called at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Events.pm line 264 > POE::Kernel::_data_ev_dispatch_due('POE::Kernel=ARRAY(0xa0df50)') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Loop/IO_Poll.pm line 374 > POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0xa0df50)') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Loop/IO_Poll.pm line 382 > POE::Kernel::loop_run('POE::Kernel=ARRAY(0xa0df50)') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 1258 > POE::Kernel::run('POE::Kernel') called at ./bin/vcs.pl line 67 > Please mail the following information to bug-POE@rt.cpan.org: > retrieving parent of a nonexistent session at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 261 > POE::Kernel::_data_ses_get_parent('POE::Kernel=ARRAY(0xa0df50)', 'undef') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 917 > POE::Kernel::_dispatch_event('POE::Kernel=ARRAY(0xa0df50)', 'POE::Kernel=ARRAY(0xa0df50)', 'POE::Session=ARRAY(0x2ae6f90)', '_signal', 16, 'ARRAY(0x2b18400)', '/home/larwan/vcs_install/perl/lib/VCS/Logger.pm', 182, 'POE::Wheel::ReadWrite(15) -> select read', ...) called at /usr/lib64/perl5/site_perl/5.8.8/POE/Resource/Events.pm line 264 > POE::Kernel::_data_ev_dispatch_due('POE::Kernel=ARRAY(0xa0df50)') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Loop/IO_Poll.pm line 374 > POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0xa0df50)') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Loop/IO_Poll.pm line 382 > POE::Kernel::loop_run('POE::Kernel=ARRAY(0xa0df50)') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 1258 > POE::Kernel::run('POE::Kernel') called at ./bin/vcs.pl line 67 > <us> must call select() from a running session at /usr/lib64/perl5/site_perl/5.8.8/POE/Kernel.pm line 2076 > POE::Kernel::select('POE::Kernel=ARRAY(0xa0df50)', 'GLOB(0x2b0caf0)') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Wheel/SocketFactory.pm line 1128 > POE::Wheel::SocketFactory::_shutdown('SCALAR(0x2b11650)', 'REF(0x2b0ccd0)', 'SCALAR(0x2b11560)', 'SCALAR(0x2b117a0)', 'SCALAR(0x2b115b0)', 'SCALAR(0x2b0ccf0)', 'SCALAR(0x2b115c0)', 'SCALAR(0x2b0ca80)') called at /usr/lib64/perl5/site_perl/5.8.8/POE/Wheel/SocketFactory.pm line 1106 > POE::Wheel::SocketFactory::DESTROY('POE::Wheel::SocketFactory=ARRAY(0x2af4180)') called at ./bin/vcs.pl line 0 > eval {...} called at ./bin/vcs.pl line 0 > ...
System info: Show quoted text
> ~ $ uname -a > Linux dc3-vcs 2.6.20-vs2.2.0-gentoo #7 SMP Sat Aug 18 15:34:20 EDT 2007 x86_64 Dual Core AMD Opteron(tm) Processor 270 AuthenticAMD GNU/Linux
Show quoted text
> ~ $ perl -V > Summary of my perl5 (revision 5 version 8 subversion 8) configuration: > Platform: > osname=linux, osvers=2.6.20-vs2.2.0-rc16-gentoo, archname=x86_64-linux > uname='linux zeus 2.6.20-vs2.2.0-rc16-gentoo #7 smp tue mar 20 16:37:21 cet 2007 x86_64 amd athlon(tm) 64 x2 dual core processor 4200+ authenticamd gnulinux ' > config_args='-des -Darchname=x86_64-linux -Dcccdlflags=-fPIC -Dccdlflags=-rdynamic -Dcc=x86_64-pc-linux-gnu-gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dlocincpth= -Doptimize=-O2 -pipe -Duselargefiles -Dd_semctl_semun -Dscriptdir=/usr/bin -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dinstallman1dir=/usr/share/man/man1 -Dinstallman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dinc_version_list=5.8.0 5.8.0/x86_64-linux 5.8.2 5.8.2/x86_64-linux 5.8.4 5.8.4/x86_64-linux 5.8.5 5.8.5/x86_64-linux 5.8.6 5.8.6/x86_64-linux 5.8.7 5.8.7/x86_64-linux -Dinc_version_list=5.8.0 5.8.0/x86_64-linux 5.8.2 5.8.2/x86_64-linux 5.8.4 5.8.4/x86_64-linux 5.8.5 5.8.5/x86_64-linux 5.8.6 5.8.6/x86_64-linux 5.8.7 5.8.7/x86_64-linux -Dcf_by=Gentoo -Ud_csh -Dusenm -Di_ndbm -Di_gdbm -Di_db -Dusrinc=/usr/include/gentoo-multilib/amd64 -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64' > hint=recommended, useposix=true, d_sigaction=define > usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=define use64bitall=define uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='x86_64-pc-linux-gnu-gcc', ccflags ='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', > optimize='-O2 -pipe', > cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/include/gdbm' > ccversion='', gccversion='4.1.1 (Gentoo 4.1.1-r3)', gccosandvers='' > intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 > ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 > alignbytes=8, prototype=define > Linker and Libraries: > ld='x86_64-pc-linux-gnu-gcc', ldflags ='' > libpth=/usr/local/lib64 /lib64 /usr/lib64 > libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc > perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc > libc=/lib/libc-2.5.so, so=so, useshrplib=false, libperl=libperl.a > gnulibc_version='2.5' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' > cccdlflags='-fPIC', lddlflags='-shared' > > > Characteristics of this binary (from libperl): > Compile-time options: PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT > USE_LARGE_FILES USE_PERLIO > Built under linux > Compiled at Mar 24 2007 19:13:38 > @INC: > /etc/perl > /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux > /usr/lib64/perl5/vendor_perl/5.8.8 > /usr/lib64/perl5/vendor_perl > /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux > /usr/lib64/perl5/site_perl/5.8.8 > /usr/lib64/perl5/site_perl > /usr/lib64/perl5/5.8.8/x86_64-linux > /usr/lib64/perl5/5.8.8 > /usr/local/lib/site_perl > .
-- Apocalypse Homepage: http://JiNxEdStAr.0ne.us IRC: Apocalypse@irc.perl.org IRC: Apocalypse@irc.freenode.net Perl Stuff: http://search.cpan.org/~APOCAL/
Verified with this one-liner: perl -wle 'use POE; POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->delay(moo => 999) } } ); $poe_kernel->signal($poe_kernel, "DIE"); POE::Kernel->run'
You wrote: Show quoted text
> The way I shutdown the application is to post a DIE signal to the > POE::Kernel object, and have it propagate to all sessions. All of my > sessions are detached sessions.
Technically you should be using the UIDESTROY to signal that the user interface has been destroyed and the back end should self-destruct. But if you hadn't, I wouldn't have heard about this bug. :) I committed a fix, revision 2313 in svn. The next release will work fine. Meantime, here's a patch if you're feeling inclined. Sorry for RT screwing up the indents. =================================================================== --- lib/POE/Kernel.pm (revision 2308) +++ lib/POE/Kernel.pm (working copy) @@ -926,7 +926,7 @@ if ($signal eq "DIE") { my $next_target = $self->_data_ses_get_parent($session); - while ($next_target != $self) { + while (defined($next_target) and $next_target != $self) { unshift @touched_sessions, $next_target; $next_target = $self->_data_ses_get_parent($next_target); }
Subject: Re: [rt.cpan.org #34803] POE v1.0000 broke signal semantics?
Date: Sun, 20 Apr 2008 22:05:54 -0400
To: bug-POE [...] rt.cpan.org
From: Apocalypse <perl [...] 0ne.us>
Hello, I tested POE-1.0001 and verified that this problem goes away :) For fun, I tested POE-1.0000 with UIDESTROY and it doesn't explode as promised. Thanks again for the quick fix and the clarification, I will be using UIDESTROY from now on in my programs, ha! Apocalypse Homepage: http://JiNxEdStAr.0ne.us IRC: Apocalypse@irc.perl.org IRC: Apocalypse@irc.freenode.net Perl Stuff: http://search.cpan.org/~APOCAL/ RCAPUTO via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=34803 > > > You wrote:
>> The way I shutdown the application is to post a DIE signal to the >> POE::Kernel object, and have it propagate to all sessions. All of my >> sessions are detached sessions.
> > Technically you should be using the UIDESTROY to signal that the user > interface has been destroyed and the back end should self-destruct. > > But if you hadn't, I wouldn't have heard about this bug. :) > > I committed a fix, revision 2313 in svn. The next release will work > fine. Meantime, here's a patch if you're feeling inclined. Sorry for > RT screwing up the indents. > > =================================================================== > --- lib/POE/Kernel.pm (revision 2308) > +++ lib/POE/Kernel.pm (working copy) > @@ -926,7 +926,7 @@ > > if ($signal eq "DIE") { > my $next_target = $self->_data_ses_get_parent($session); > - while ($next_target != $self) { > + while (defined($next_target) and $next_target != $self) { > unshift @touched_sessions, $next_target; > $next_target = $self->_data_ses_get_parent($next_target); > } >