Bug #32543 ERROR 2006 (HY000) at line 40: MySQL server has gone away
Submitted: 20 Nov 2007 19:35 Modified: 12 Dec 2007 12:44
Reporter: Dmitry Labutin Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.45-community OS:Windows (2003 Server)
Assigned to: Martin Hansson CPU Architecture:Any
Tags: hy000, server has gone away

[20 Nov 2007 19:35] Dmitry Labutin
Description:
I try move tables from MySQL 4 to MySQL5.
I made backup using mysqldump
Then I try to restore database on MySQL 5 and see:
ERROR 2006 (HY000) at line 40: MySQL server has gone away

How to repeat:
Try to restore table using mysql command
[20 Nov 2007 19:37] Dmitry Labutin
I can't to make file smaller than 500K :(
You can download it here:
http://tmp.incub.ru/mysqlbug/parts2.rar (3 MB)
[21 Nov 2007 0:56] MySQL Verification Team
Thank you for the bug report. Starting the server with the default variables
the server running on Linux gives the correct error message and the Windows
server instead the message reported:

On Linux:

[miguel@skybr 5.0]$ bin/mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.52-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> source /home/miguel/var/parts2.sql
Query OK, 0 rows affected (0.13 sec)

<cut>

Query OK, 0 rows affected (0.00 sec)

ERROR 1153 (08S01): Got a packet bigger than 'max_allowed_packet' bytes
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

On Windows:

c:\dev>5.0\bin\mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.52-nt Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> source c:/temp/parts2.sql
Query OK, 0 rows affected (0.00 sec)

<cut>

Query OK, 0 rows affected (0.00 sec)

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    2
Current database: test

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    3
Current database: test

ERROR 2006 (HY000): MySQL server has gone away
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    4
Current database: test
[7 Dec 2007 12:52] Martin Hansson
I get the same message, but the server does not die.

echo "select version()" | client/debug/mysql.exe -u root --port=9306 bug32543 
version()
5.0.45-debug-log

client/debug/mysql.exe -u root --port=9306 bug32543 < ../parts2.sql
ERROR 2006 (HY000) at line 40: MySQL server has gone away

echo "select version()" | client/debug/mysql.exe -u root --port=9306 bug32543
version()
5.0.45-debug-log

echo "show tables" | client/debug/mysql.exe -u root --port=9306 bug32543
Tables_in_bug32543
vsm_attachments
[7 Dec 2007 13:05] Martin Hansson
Not repeatable on mysql-5.0.45-community with debug build
[7 Dec 2007 14:05] Martin Hansson
From the MySQL Manual:

"You can also get these errors ["MySQL server has gone away", my note] if you send a query to the server that is incorrect or too large. If mysqld receives a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection. If you need big queries (for example, if you are working with big BLOB columns), you can increase the query limit by setting the server's max_allowed_packet variable, which has a default value of 1MB. You may also need to increase the maximum packet size on the client end. More information on setting the packet size is given in Section B.1.2.10, “Packet too large”."

From Section B.1.2.10:

"When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too large error and closes the connection. With some clients, you may also get a Lost connection to MySQL server during query error if the communication packet is too large."
[7 Dec 2007 17:08] Martin Hansson
Miguel, can you confirm that the server indeed died when you verified? In that case I haven't managed to repeat it completely.
[10 Dec 2007 12:14] MySQL Verification Team
Martin,
The server didn't died, just the incorrect message.
[11 Dec 2007 14:47] Martin Hansson
Thank you, Miguel. In that case there is nothing unexpected happening here.
[12 Dec 2007 12:44] Martin Hansson
This is normal behavior in MySQL. The Blob you are trying to insert is bigger than  the maximum packet size. Please refer to secions B.1.2.9 and B.1.2.10 in the manual.
[12 Dec 2007 14:51] MySQL Verification Team
Hi Martin,

I don' agree with the status !bug even you can find in the Manual comments
which may support that conclusion. The question is why on Linux is launched
the actual error message:

ERROR 1153 (08S01): Got a packet bigger than 'max_allowed_packet' bytes
Query OK, 0 rows affected (0.00 sec)

which indicates to the user where he can fix the issue. On another hand Windows
server gives an error messages that sometimes is launched when the server
actually was away:

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    2
Current database: test

So my question: why Linux and Windows servers behaves different in the error
message. Thanks in advance.
[6 Jun 2011 22:57] Steven Hartland
I believe this is still the case in 5.5.11, can't tell for sure as I don't have anyway of finding out if this was the error.

Which seems like the reason this bug was raised, so the user knows what the error was when running under windows.

I would hence, kindly request this bug is reopened so it can be fixed.
[18 Nov 2011 16:21] Lucas J.
I agree with Steven, it would be really nice if this would be fixed.