punkish has asked for the wisdom of the Perl Monks concerning the following question:
I have three MySQL/Perl Dancer http://perldancer.org powered web apps.
The user goes to app A which serves up a Google maps base layer. On document ready, app A makes three jQuery ajax calls -- two to app B like so
http://app_B/points.json http://app_B/polys.json
and one to app C
http://app_C/polys.json
Apps B and C query the MySQL database via DBI, and serve up json packets of points and polys that are rendered in the user's browser.
All three apps are proxies through Apache to Perl Starman running via plackup started like so
$ plackup -E production -s Starman -w 10 -p <port> path/to/respec +tive/app.pl
From time to time, I start getting errors back from the apps called via Ajax. The initial symptoms were
{"error":"Warning caught during route execution: DBD::mysql::s +t fetchall_arrayref failed: fetch() without execute() at <path/t +o/app.pm> line 79.\n"}
The offending lines are
71> my $sql = qq{ 72> .. 73> 74> 75> }; 76> 77> my $sth = $dbh->prepare($sql); 78> $sth->execute(); 79> my $res = $sth->fetchall_arrayref({});
This is bizarre... how can execute() not take place above? Perl doesn't have a habit of jumping over lines, does it? So, I turned on DBI_TRACE
$DBI_TRACE=2=logs/dbi.log plackup -E production -p 5001 -s Sta +rman -w 10 -a bin/app.pl
And, following is what stood out to me as the potential culprit in the log file
> Handle is not in asynchronous mode error 2000 recorded: Hand +le is > not in asynchronous mode > !! ERROR: 2000 CLEARED by call to fetch method
What is going on? Basically, as is, app A is non-functional because the other apps don't return data "reliably" -- I put that in quotes because they do work correctly occasionally, so I know I don't have any logic or syntax errors in my code. I have some kind of intrinsic plumbing errors.
quick update: I did find the following http://search.cpan.org/~capttofu/DBD-mysql-4.019/lib/DBD/mysql.pm#ASYNCHRONOUS_QUERIES and am wondering if this is the cause and the solution of my problem. Would a DBI/mysql savvy monk kindly elucidate?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mysql handle not in asynchronous mode
by locked_user sundialsvc4 (Abbot) on Jul 16, 2011 at 11:34 UTC | |
by punkish (Priest) on Jul 16, 2011 at 16:34 UTC | |
|
Re: Mysql handle not in asynchronous mode
by Anonymous Monk on Jul 16, 2011 at 06:39 UTC | |
by punkish (Priest) on Jul 16, 2011 at 15:57 UTC | |
|
Re: Mysql handle not in asynchronous mode
by punkish (Priest) on Jul 17, 2011 at 01:02 UTC | |
|
Re: Mysql handle not in asynchronous mode
by Anonymous Monk on Jul 28, 2015 at 05:36 UTC | |
by ff (Hermit) on Jan 19, 2018 at 03:55 UTC | |
by tultalk (Monk) on Mar 31, 2018 at 12:10 UTC |