I have been successfully using DateTime::Set objects created from cron 
specifications for a while. Last week I had some issues when Europe 
switched to summer time, this week because (I assume) the US switched 
over.

Under certain circumstances the script will just hang. I think I've 
tracked this down to attempting to call method 'previous' on a 
DateTime::Set, where the previous date would come before the timezone 
change. Although I'm not sure....

Aside from this weekend and last weekend I have not seen any issues and 
the code below works fine.

Running truss on the process I can see that it's continually calling 
"getcontext(address)" and getting no where. 
Attempting to debug it (without wanting to get in too deep) it looks like 
it's going round the while loop in DateTime::Event::Cron::_invalid_decr 
which has been called with values of 
(DateTime::Event::Cron=HASH (empty hash), <a valid DateTime object>)

Here's the script, with a stack trace below it.

Any help appreciated

DateTime::Event::Cron   - version 0.07
DateTime::Set           - version 0.22

---------------------------------------------------------------------------------------------
#!/apps/perl/5.8.7.0/solaris/bin/perl

use DateTime;
use DateTime::Event::Cron;

$| = 1;

$cron="00 10 * * 5";

my %parms = (time_zone => 'GB-Eire');
my $now = DateTime->now(%parms);
print "\nNow: " . $now->datetime;

print "\nDoing it..."; 
my $set = DateTime::Event::Cron->from_cron($cron);
print "    Did it!\n"; 

print "\nGetting next...";
$set->next($now);
print "    Did it!\n"; 

print "\nGetting previous...";
$set->previous($now);           # It hangs here
print "    Did it!\n"; 
--------------------------------------------------------------------------------------------------


Stack trace:
. = DateTime::Event::Cron::_invalid_decr(ref(DateTime::Event::Cron), 
ref(DateTime)) called from file 
`/apps/perl/5.8.7.0/solaris/lib/site_perl/5.8.7/DateTime/Event/Cron.pm' 
line 174
. = DateTime::Event::Cron::_attempt_decrement(ref(DateTime::Event::Cron), 
ref(DateTime)) called from file 
`/apps/perl/5.8.7.0/solaris/lib/site_perl/5.8.7/DateTime/Event/Cron.pm' 
line 156
@ = DateTime::Event::Cron::decrement(ref(DateTime::Event::Cron), 
ref(DateTime)) called from file 
`/apps/perl/5.8.7.0/solaris/lib/site_perl/5.8.7/DateTime/Event/Cron.pm' 
line 138
@ = DateTime::Event::Cron::previous(ref(DateTime::Event::Cron), 
ref(DateTime)) called from file 
`/apps/perl/5.8.7.0/solaris/lib/site_perl/5.8.7/DateTime/Event/Cron.pm' 
line 62
@ = 
DateTime::Event::Cron::__ANON__[/apps/perl/5.8.7.0/solaris/lib/site_perl/5.8.7/DateTime/Event/Cron.pm:62](ref(DateTime))
 
called from file 
`/apps/perl/5.8.7.0/solaris/lib/site_perl/5.8.7/DateTime/Set.pm' line 223
@ = 
DateTime::Set::__ANON__[/apps/perl/5.8.7.0/solaris/lib/site_perl/5.8.7/DateTime/Set.pm:224](ref(DateTime))
 
called from file 
`/apps/perl/5.8.7.0/solaris/lib/site_perl/5.8.7/DateTime/Set.pm' line 443
. = DateTime::Set::previous(ref(DateTime::Set), ref(DateTime)) called from 
file `./test_dt2' line 24



This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein 
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries 
and affiliates.

Reply via email to