List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:April 14 1999 12:38am
Subject:server has gone away, second try
View as plain text  
>>>>> "Derick" == Derick H Siddoway <Derick.H.Siddoway@stripped>
> writes:

Derick> Okay, so I'm rewriting some stuff.
Derick> Originally, I made one connection to the database and used that handle
Derick> for all of my queries.  But then I started playing with fork(), and
Derick> Monty said that when you fork(), you have to connect *after* the fork().

Derick> Okay, hence the rewrite.  So now I have code that makes a connection
Derick> to the database for each query.  Fine enough, the initial tests ran
Derick> just fine.  So I decided to see if I could just create a 10 000 record
Derick> database with this code.  I began to see some

Derick> Error connecting to database: Success
Derick> Error in query: MySQL server has gone away
Derick> Error connecting to database: Success
Derick> Error in query: MySQL server has gone away
Derick> Error connecting to datbase: Success
Derick> ... (etc, etc, etc)

Derick> So, I did some tests, and found that the first 100 connections do
Derick> not exhibit this behavior, but every connection after does this.
Derick> I thought that perhaps I was hitting the server too fast, so I put
Derick> a sleep() in, but the same thing happens.

Derick> mysqladmin version shows that the server has indeed been up the
Derick> whole time.

Derick> The manual says that the most common cause is a server timeout.
Derick> I don't think this is a timeout.
Derick> It also says that you can get this with incorrect or too-large
Derick> queries.  The first 100 go through just fine...

Derick> The table is simple:

Derick> CREATE TABLE temp1 (
Derick> 	temp_id	INT NOT NULL,
Derick> 	temp_value	INT,
Derick> 	PRIMARY KEY (temp_id)
Derick> 	);

Derick> I am incrementing the value for temp_id from 0 to 10 000.  (The table is
Derick> created fresh each run.)

Derick> Any ideas for me?

Derick> Thanks -

Derick> -- 
Derick> derick


By default MySQL only allows you to open 100 simultaneous connections.
If you need more, you have to restart the server with the
'-O max_connections=...' option.

Check also out the test scripts that starts with 'fork...';  They can
be used to very easy simulate many clients doing a wide range of
different things!

server has gone away, second tryMichael Widenius14 Apr