Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
The errors that are reported when the client-side max_allowed_packet limit is reached are not helpful and at worst are misleading: exceeding the value in a resultset causes the error to be reported as:
ERROR 2013 (HY000): Lost connection to server during query
|
The error is technically true: the connection is lost but it was lost because the connector itself closed it because the client-side limit for max_allowed_packet was exceeded. This makes it hard to debug problems related resultsets when the true cause of the error is not known.
At the time of writing, the default values for the option are also not documented but based on the source code, it appears to be 1GiB. This also differs from the MariaDB default of 16MiB and the default that is used by the mariadb client, also 16MiB.
Agree with Markus here, this behaviour is very confusing for users. I just saw a case of this on the #maria channel. It must be very common for users to be bitten by this and have a hard time figuring out what the real problem is.
The problem is made worse since the error message is not merely unhelpful, it is actively misleading. It suggests the problem is on the server side ("Lost connection to server" often means the server closed the connection, eg. server crash), but the real problem is with the configuration on the client side.
The expected behaviour would be to get eg. ER_TOO_LONG_STRING or ER_NET_PACKET_TOO_LARGE.
--source include/have_innodb.inc
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(2048), c LONGBLOB) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0, REPEAT("x", 2048), REPEAT("Hulubulu!!?!", 1024*100));
--exec $MYSQL_DUMP --max-allowed-packet=102400 test t1 > $MYSQLTEST_VARDIR/tmp/tmp_t1.sql
mariadb-dump: Error 2013: Lost connection to server during query when dumping table `t1` at row: 0