Bug #10609 possible regression since 4.0.15
Submitted: 12 May 2005 19:46 Modified: 10 Aug 2005 12:59
Reporter: Martin Mokrejs Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.11 OS:Linux (linux-2.6.11.9)
Assigned to: CPU Architecture:Any

[12 May 2005 19:46] Martin Mokrejs
Description:
I use mysql-python from https://sourceforge.net/project/showfiles.php?group_id=22307.
I have found that whenever I set max_allowed_packet to ANY value in custom .my.cnf and ask the database connection constructor to use the file to fetch settings, I get some *reproducible* breaks of connection. I get working connection, I manage to insert about 400 rows, do commit after each but then it breaks.

I made a survey of mysqldb version adn underlying static mysql libraries (official binaries) and it seems the bug is is libmysqlclient and not in the pythonic wrapper.

The long bugreport which you don't have to read I think is at
https://sourceforge.net/tracker/?func=detail&atid=374932&aid=1200901&group_id=22307

I serve you now with the summary. Although I found the problem initially with 4.0.24 (server+client), all tests mentioned below I've done against 4.1.11 server running on linux. Every binary was from your gcc generated binary packages.

mysql-python-1.2.0 breaks when built with mysql-4.0.24 (2006, 'MySQL server has gone away')

mysql-python-1.2.0 breaks when built with mysql-4.0.22 (2006, 'MySQL server has gone away')

mysql-python-1.2.0 breaks when built with mysql-4.0.21 (2006, 'MySQL server has gone away')

mysql-python-1.2.0 breaks when built with mysql-4.0.18 (2006, 'MySQL server has gone away')

mysql-python-1.2.0 breaks when built with mysql-4.0.16 (2006, 'MySQL server has gone away')

mysql-python-1.2.1c4 works with mysql-4.0.15

mysql-python-1.2.0 doesn't build with mysql-4.0.15 (because of buggy mysql_config)

mysql-python-1.0.1 doesn't build with mysql-4.1.6

mysql-python-1.0.1 doesn't build with mysql-4.0.24

mysql-python-1.0.1 works when built with mysql-4.0.22

mysql-python-1.0.0 doesn't build with mysql-4.1.7

mysql-python-1.0.0 doesn't build with mysql-4.1.6

mysql-python-1.0.0 doesn't build with mysql-4.0.24

mysql-python-1.0.0 works when built with mysql-4.0.22

mysql-python-1.0.0 works when built with mysql-4.0.21

mysql-python-1.0.0 works when built with mysql-4.0.18

mysql-python-1.0.0 works when built with mysql-4.0.17

mysql-python-1.0.0 works when built with mysql-4.0.16

mysql-python-1.0.0 works when built with mysql-4.0.15

mysql-python-0.9.2 works when built with mysql-4.0.15

Because mysql-python above 1.2.1c3 builds (I'll provide you a patch for it) against mysql-4.0.15 I conclude it is a bug in mysql, introduced between 4.0.15 and 4.0.16.
I'll attach table definition file and the simple script. You should be either able to install python from www.python.org with mysql-python module or I can help you with that, if you email me. Or, write a simple C client. ;)

How to repeat:
I have very simple program to run. It inserts into a BLOB column string of increasing lenght by one character. It reproducibly breaks when trying to insert string of 8180/8181 chars (when compression is somewhat on, as it says (2006, 'MySQL server has
gone away')).

There is nothing in server errorlog.

The reason why I suspect compression is that when it's seemingly off, I get the error message about packet too big. There is no "quick" in /etc/my.cnf file but am still uncertain where is the compression defined by default. I turn it off now in mysqldb python's wrapper. However, "quick" is not in clients .my.cnf nor on the server.
Anyway, thsi you get when compression was off:

[cut]
reading row 490 with sequence_string long 8179 chars.
reading row 491 with sequence_string long 8180 chars.
reading row 492 with sequence_string long 8181 chars.
reading row 493 with sequence_string long 8182 chars.
Traceback (most recent call last):
  File "bug.py", line 21, in ?
    s = _c.use_result().fetch_row()
_mysql_exceptions.OperationalError: (2020, "Got packet
bigger than 'max_allowed_packet' bytes")
$ 

I will attach the
[12 May 2005 19:48] Martin Mokrejs
testcase in python

Attachment: bug.py (text/x-python), 632 bytes.

[12 May 2005 19:50] Martin Mokrejs
table definition

Attachment: bug2.sql (application/octet-stream, text), 1.48 KiB.

[12 May 2005 19:52] Martin Mokrejs
MySQL-python-1.2.1c3/setup.py patch to build against 4.0.15 and earlier

Attachment: setup.py.patch (application/octet-stream, text), 1.52 KiB.

[23 May 2005 13:19] MySQL Verification Team
Could you please provide the database schema and yes I would prefer
a C program for test.
Thanks in advance.
[2 Jun 2005 15:47] Martin Mokrejs
The table is created by

CREATE TABLE `sequence` (
  `sequence_id` bigint(20) unsigned NOT NULL auto_increment,
  `sequence_string` text,
  `size` bigint(20) unsigned default NULL,
  `md5` varchar(32) default NULL,
  `sha1` varchar(40) default NULL,
  PRIMARY KEY  (`sequence_id`),
  KEY `md5` (`md5`),
  KEY `sha1` (`sha1`),
  KEY `size` (`size`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Sorry, but I'm not able to code in C, so the only test-case I'm able to provide is the one in python.
[2 Jun 2005 15:48] Martin Mokrejs
BTW: The attached file bug2.sql is the mysql dump of the database/table!
[10 Jul 2005 12:59] Vasily Kishkin
Could you please write value of max_allowed_packet ? (just run the follow command:  show variables like "max_allowed_packet" )
[10 Aug 2005 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".