> Date: Wed, 27 Sep 2006 08:06:38 -0400
> From: johnzenger at mailc.net
> Subject: Re: [Scoop-help] db_select returns nothing?

> On Tue, 26 Sep 2006 21:48:00 -0700, janra at write-on.org said:
>> Do you have any error messages in your apache error log?
> 
> No.  The only time I got an error message was when I tried to called
> fetchrow_hashref on the undefined $sth.

It's always preferable to check the return value before calling
statement handle methods, which should allow for more efficient debugging.

[...]

> Each time I reload, it does not work.  It seems that if I wait a few
> minutes, and then reload, it works.

Ah. This suggests that you've hit your mysql concurrent connection
limit; also that the connection timeout is too long. Check /etc/my.cnf
on your server to evaluate and adjust these settings. Each apache child
process creates it's own DB connection so it you have 10 apache children
all connected to the DB, and your mysql configuration only allows 10
connections, with a timeout of 30 seconds, the first request will
operate properly and the next will not until 30 seconds have passed.
You'll want to bump up the allowed concurrent myswl connection and
reduce the timeout to a few seconds.

I assume your site is not using a static content proxy. You may want to
configure a proxy apache instance to handle images and other static
content, so the instance of apache that handles mod_perl requests to
Scoop (utilizing a DB connection) is called only for requests that
actually need Scoop to deliver content (only the main HTML page).

Best Regards,
Colin Hill

-- 
Scoophost.com - a service of Pinnacle Digital
Scoop consulting and hosting services

>> Have you tried completely stopping then starting apache? (I've found  
>> that errors that show up on one request but not on another are  
>> sometimes caused by the cache getting out of sync between apache  
>> threads, and stop/starting apache resets that.)
> 
> It always works the first time after I restart apache.  So maybe it is a
> cache problem?  I thought it might be.  That's why I put NOCACHE => 1
> into the query.  Maybe I got the syntax for that wrong?  (NOCACHE isn't
> documented, so maybe it is not supported anymore...?)
> 
>> Nothing in the query immediately jumps out at me as being wrong,  
>> apart from the nonsense words substituted for your table and field  
>> names :-)
>>
>> -janra
>>
>> On 26-Sep-06, at 6:59 PM, johnzenger at mailc.net wrote:
>>
>>> So I've got a page that is generated mostly from the results of a  
>>> single
>>> db_select query.  The first time I load the page, it all works fine.
>>> Then, I hit reload, and db_select does not return a sth, but instead
>>> returns an undefined value.
>>>
>>> Is this a problem with how I've set up MySQL?  Or am is there  
>>> something
>>> wrong with my query statement?:
>>>
>>>     my ($rv, $sth) = $S->db_select({
>>>         WHAT => qq~foreignk, anotherk, DATE_FORMAT(date_made, "%e % 
>>> b %Y
>>>         %T") AS date, field, ornate_field, prkey, quack~,
>>>         FROM => 'supertable',
>>>         WHERE => "prkey = 5",
>>>         ORDER_BY => 'date_made DESC',
>>>         NOCACHE => 1
>>>     });
>>>
>>> _______________________________________________
>>> Scoop-help mailing list
>>> Scoop-help at lists.kuro5hin.org
>>> http://lists.kuro5hin.org/mailman/listinfo/scoop-help
> 
> 
> ------------------------------
> 
> _______________________________________________
> Scoop-help mailing list
> Scoop-help at lists.kuro5hin.org
> http://lists.kuro5hin.org/mailman/listinfo/scoop-help
> 
> 
> End of Scoop-help Digest, Vol 26, Issue 5
> *****************************************

-- 
Scoophost.com - a service of Pinnacle Digital
Scoop consulting and hosting services