Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the MooseX-Singleton CPAN distribution.

Report information
The Basics
Id: 49735
Status: stalled
Priority: 0/
Queue: MooseX-Singleton

People
Owner: Nobody in particular
Requestors: jquelin [...] cpan.org
Cc:
AdminCc:

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



Subject: singleton objects are destroyed, leading to
Download (untitled) / with headers
text/plain 1.9k
i just updated moose to 0.90, and moosex::singleton to 0.21 and now in games::pandemic, i get some errors. i managed to trace it to the fact that singleton object changes over the program life. to observe it, apply the following patch to games-pandemic: diff --git a/lib/Games/Pandemic/Controller.pm b/lib/Games/Pandemic/Controller.pm index 6a59cff..fd799f8 100644 --- a/lib/Games/Pandemic/Controller.pm +++ b/lib/Games/Pandemic/Controller.pm @@ -236,6 +236,7 @@ Create a new game: (re-)initialize the map, and various internal states. event new_game => sub { my $game = Games::Pandemic->instance; + say "*** new_game: $game"; $game->has_started; # create the map diff --git a/lib/Games/Pandemic/Tk/Main.pm b/lib/Games/Pandemic/Tk/Main.pm index 2b0861f..4b2d778 100644 --- a/lib/Games/Pandemic/Tk/Main.pm +++ b/lib/Games/Pandemic/Tk/Main.pm @@ -1297,7 +1297,7 @@ sub _build_status_bar { my $s = $self->_session; my $tip = $self->_w('tooltip'); my $tipmsg; - +say "*** build_status_bar: $game"; # the status bar itself is a frame my $sb = $mw->Frame->pack(@RIGHT, @FILLX, -before=>$self->_w('canvas')); $self->_set_w( infobar => $sb ); then run pandemic: $ ./bin/pandemic and start a new game with ctrl+n *** run: Games::Pandemic=HASH(0x2c6ca50) *** new_game: Games::Pandemic=HASH(0x2b534b0) ==> the singleton has changed even better, add a DEMOLISH sub in lib/Games/Pandemic.pm diff --git a/lib/Games/Pandemic.pm b/lib/Games/Pandemic.pm index 0ef0bde..a52ecee 100644 --- a/lib/Games/Pandemic.pm +++ b/lib/Games/Pandemic.pm @@ -21,6 +21,7 @@ use Games::Pandemic::Config; use Games::Pandemic::Controller; use Games::Pandemic::Tk::Main; +sub DEMOLISH { say "******* lost singleton"; } # -- accessors ==> rerun the prog, start a new game: *** run: Games::Pandemic=HASH(0x2c6ca50) ******* lost singleton ******* lost singleton *** new_game: Games::Pandemic=HASH(0x2b534b0) ******* lost singleton
Download (untitled) / with headers
text/plain 1.4k
cluck()-ing in DEMOLISH gives the following: *** run: Games::Pandemic=HASH(0x292cab8) ******* lost singleton at /home/jquelin/prog/games-pandemic/bin/../lib/Games/Pandemic.pm line 25 Games::Pandemic::DEMOLISH('Games::Pandemic=HASH(0x6eed48)', 0) called at generated method (unknown origin) line 4 Class::MOP::Method::Generated::__ANON__() called at /usr/lib/perl5/vendor_perl/5.10.1/Try/Tiny.pm line 47 eval {...} called at /usr/lib/perl5/vendor_perl/5.10.1/Try/Tiny.pm line 39 Try::Tiny::try('CODE(0x25657c8)', 'CODE(0x29c7830)') called at generated method (unknown origin) line 5 Games::Pandemic::DESTROY('Games::Pandemic=HASH(0x6eed48)') called at /usr/lib/perl5/vendor_perl/5.10.1/POE/Resource/Events.pm line 267 eval {...} called at /usr/lib/perl5/vendor_perl/5.10.1/POE/Resource/Events.pm line 267 POE::Kernel::_data_ev_dispatch_due('POE::Kernel=ARRAY(0x9b5750)') called at /usr/lib/perl5/vendor_perl/5.10.1/POE/Loop/TkCommon.pm line 143 POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0x9b5750)') called at /usr/lib/perl5/vendor_perl/5.10.1/POE/Loop/TkCommon.pm line 151 POE::Kernel::loop_run('POE::Kernel=ARRAY(0x9b5750)') called at /usr/lib/perl5/vendor_perl/5.10.1/POE/Kernel.pm line 1326 POE::Kernel::run('POE::Kernel') called at /home/jquelin/prog/games-pandemic/bin/../lib/Games/Pandemic.pm line 209 Games::Pandemic::run('Games::Pandemic') called at ./bin/pandemic line 13
Download (untitled) / with headers
text/plain 128b
commenting out the following line in lib/Games/Pandemic.pm __PACKAGE__->meta->make_immutable; makes the singleton stay alive.
Subject: Re: [rt.cpan.org #49735] singleton objects are destroyed, leading to
Date: Fri, 18 Sep 2009 15:51:50 -0500 (CDT)
To: Jerome Quelin via RT <bug-MooseX-Singleton [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
Download (untitled) / with headers
text/plain 1.2k
On Wed, 16 Sep 2009, Jerome Quelin via RT wrote: Show quoted text
> *** run: Games::Pandemic=HASH(0x292cab8) > ******* lost singleton at > /home/jquelin/prog/games-pandemic/bin/../lib/Games/Pandemic.pm line 25 > Games::Pandemic::DEMOLISH('Games::Pandemic=HASH(0x6eed48)', 0) > called at generated method (unknown origin) line 4 > Class::MOP::Method::Generated::__ANON__() called at > /usr/lib/perl5/vendor_perl/5.10.1/Try/Tiny.pm line 47 > eval {...} called at > /usr/lib/perl5/vendor_perl/5.10.1/Try/Tiny.pm line 39 > Try::Tiny::try('CODE(0x25657c8)', 'CODE(0x29c7830)') called at > generated method (unknown origin) line 5 > Games::Pandemic::DESTROY('Games::Pandemic=HASH(0x6eed48)') > called at /usr/lib/perl5/vendor_perl/5.10.1/POE/Resource/Events.pm line 267 > eval {...} called at > /usr/lib/perl5/vendor_perl/5.10.1/POE/Resource/Events.pm line 267
Is it possible this is a POE-specific thing. It looks like the object is being garbage collected from POE somehow. Can you possibly come up with a reproduction recipe that doesn't involve POE? -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.