Tuesday, December 14, 2010

mysql client out of memory

Error:
Out of memory (Needed 1453192 bytes)
DBD::mysql::st execute failed: MySQL client ran out of memory at file

Solution:
Set this flag in the DB handle -
$rdbh->{'mysql_use_result'} = 1;

It forces the API to use mysql mysql_use_result() instead mysql_store_result().
Basically, instead of buffering all the matches, it returns line by line.
Note that this is the same as --quick option available in the mysql client.

This causes the mysql query thread state to change to "writing to net";
mysql> show processlist\G
...
State: writing to net
...







apache jammed with lots of 408s

408 - Request Timeout
A 408 status code means that the client did not produce a request quickly enough. A server is set to only wait a certain amount of time for responses from clients, and a 408 status code indicates that time has passed

http://www.addedbytes.com/articles/http-status-codes-explained/

Solution:
ReadTimeOut 10 (default is 120 seconds)