Skip Menu |

This queue is for tickets about the POE-Component-Cron CPAN distribution.

Report information
The Basics
Id: 31542
Status: open
Priority: 0/
Queue: POE-Component-Cron

People
Owner: Nobody in particular
Requestors: cja987 [...] gmail.com
Cc:
AdminCc:

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



Subject: Does not increase session refcount
I've created a scheduler class as a POE session, but I found that my scheduler entry components never fired unless the kernel was also doing something else, like servicing a periodic alarm (which is how my scheduler used to be done until I switched it to PoCo-Cron). Being a relative noob at POE, I don't have a patch, but I'm told that it needs to increase the session refcount. I copied the relevant IRC log on #poe: <sproingie> hm. i'm trying to use POE::Component::Cron, but it seems that the cron tasks only run if I have an alarm outstanding <sproingie> so i've set up my session to do a 'tick' every 10 seconds using $_[KERNEL]->alarm('tick') <sproingie> but i don't really know why I need that, and it bothers me. anyone know? <pravus> sproingie: perhaps the session you are using is getting reaped when not using an alarm? perhaps you should set an alias or increment its refcount? <integral> at a guess, POE::Component::Cron isn't putting an extref on the sessions it does callbacks to <sproingie> i'm not well versed in POE, how would I go verifying that? <sproingie> or where can I find a simple example of a component that does properly add an extref? <integral> I think I'm right from reading the source now. A work around is to put an alias on your session. <sproingie> so just put $poe_kernel->alias_set( 'dummy' ) somewhere in my startup state? <BinGOs> that would do it, yeah. <BinGOs> that said, like integral pointed out PoCo-Cron should be increasing the refcount of the requesting sessions <sproingie> i could file a bug, but i wouldn't know enough to put in a fix <integral> copy this IRC conversation to the bug :-)
I just noticed this. If you still have the time it'd be nice to see a small example that exhibits the problem. I'll look into it as time permits. On Fri Dec 14 12:25:42 2007, sproingie wrote: Show quoted text
> I've created a scheduler class as a POE session, but I found that my > scheduler entry components never fired unless the kernel was also doing > something else, like servicing a periodic alarm (which is how my > scheduler used to be done until I switched it to PoCo-Cron). Being a > relative noob at POE, I don't have a patch, but I'm told that it needs > to increase the session refcount. I copied the relevant IRC log on #poe: > > > <sproingie> hm. i'm trying to use POE::Component::Cron, but it seems > that the cron tasks only run if I have an alarm outstanding > <sproingie> so i've set up my session to do a 'tick' every 10 seconds > using $_[KERNEL]->alarm('tick') > <sproingie> but i don't really know why I need that, and it bothers me. > anyone know? > <pravus> sproingie: perhaps the session you are using is getting reaped > when not using an alarm? perhaps you should set an alias or increment > its refcount? > <integral> at a guess, POE::Component::Cron isn't putting an extref on > the sessions it does callbacks to > <sproingie> i'm not well versed in POE, how would I go verifying that? > <sproingie> or where can I find a simple example of a component that > does properly add an extref? > <integral> I think I'm right from reading the source now. A work around > is to put an alias on your session. > <sproingie> so just put $poe_kernel->alias_set( 'dummy' ) somewhere in > my startup state? > <BinGOs> that would do it, yeah. > <BinGOs> that said, like integral pointed out PoCo-Cron should be > increasing the refcount of the requesting sessions > <sproingie> i could file a bug, but i wouldn't know enough to put in a fix > <integral> copy this IRC conversation to the bug :-)
In my experience with 0.019, this is a feature: the session lives while you have some tasks (created with POE::Component::Cron->add). Once you have deleted all the tasks, the session has no more events waiting, so is terminated. So you must create at least one cron task in your session _start.