I have a Catalyst app that builds some graphs which is occasionally giving screwy results. It will be fine, and then the result set suddenly returns, missing values. I've boiled an example down to the code as follows.
package myapp::Controller::tests::report;
use strict;
use warnings;
use parent 'Catalyst::Controller';
sub day_simple :Local :Args(2) {
my ( $self, $c, $test_id, $passed_date) = @_;
my @passed_date_split = split /\D/, $passed_date;
my $formatted_passed_date = join '-', @passed_date_split;
my $tests_rs = $c->model('DB::Tests')->search(
{
name => { '=', $test_id },
date_time => { '>=', "$formatted_passed_date 00:00:00",
+'<=', "$formatted_passed_date 23:59:59" },
},
{
order_by => 'date_time',
},
);
my $output = "";
while (my $row = $tests_rs->next) {
$output .= $row->get_column('date_time') . ", " . $row->get_co
+lumn('time_taken') . "<br/>\n";
}
$c->response->body( $output );
}
which when run gives
2009-06-24 00:03:41, 0.952
2009-06-24 00:14:06, 0.968
2009-06-24 00:24:31, 0.968
2009-06-24 00:34:50, 0.812
2009-06-24 00:45:17, 0.844
2009-06-24 00:55:49, 1.577
, 0.921
2009-06-24 01:16:29, 0.812
2009-06-24 01:26:50, 1.39
2009-06-24 01:37:35, 8.387
2009-06-24 01:48:24, 1.181
, 0.847
2009-06-24 02:09:19, 1.739
2009-06-24 02:19:49, 0.877
etc...
All those lines are there in the database all with valid date_time value (as implied by the order by date_time directive).
Very wierdly, runing a select over this table from a mysql command shell seems to clear this problem, and the values start returning normally for a while, but the problem always comes back. Bouncing apache has no effect.
I'm running active perl v5.10.0, apache 2.2.11.0, Win Server 2003, DBIx::Class v0.08010, Catalyst 5.71001 and modperl 1.99.
Any help/pointers much appreciated.
Thanks.
Rob
---
my name's not Keith, and I'm not reasonable.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.