mos <[EMAIL PROTECTED]> wrote on 03/23/2005 12:04:59 PM:

> I have a compiled application that accesses a dedicated MySQL 4.1.1 
server 
> with MyISAM tables on Win XP. For some reason when the application is in 
a 
> loop doing simple single table Select statements, the MySQL server after 
48 
> seconds of processing will upchuck with the error "Can't connect to 
MySQL 
> server on 'localhost' (10048)".
> 
> This machine has the server and application on it and no one else is 
using 
> it.  MaxUsedConnections=3 and connections=3974 after it crashes. It is 
> doing about 20 queries per second before it crashes. It usually crashes 
> near the same record. Seconds after the crash if I have another 
application 
> do a "Show status" I get an error "Lost connection to MySQL server 
during 
> query". If I wait a few seconds and re-run it, I get the status results.
> 
> It is running on Win XP AMD 3500+ with 1g ram. There is plenty of memory 

> because the queries are returning only a dozen rows, maybe less.
> 
> Any idea how I can eliminate the crashing?
> 
> Mike
> 

Please, PLEASE, tell me you are not creating and dropping a connection for 
each query within your loop. If you are, try rewriting your code create 
one connection early and drop it only when it's no longer useful. Always 
try to reuse an established connection as much as possible and always use 
the fewest number of connections you need to get the job done.

Some statements (particularly extended INSERT statements) can exceed your 
server's max_allowed_packet size, which I have also seen cause that error.

Also, check your MySQL server's error log to see if you are causing a 
condition you are not seeing reported back to your compiled code.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to