Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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 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


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/

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/> 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/

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 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

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (3)
    As of 2018-05-20 12:59 GMT
    Find Nodes?
      Voting Booth?