Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I asked this question on the dbi list (no response yet), so am posting it here for collective wisdom of the monks.

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?



when small people start casting long shadows, it is time to go to bed

In reply to Mysql handle not in asynchronous mode by punkish

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (13)
    As of 2014-04-16 17:49 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (433 votes), past polls