#136 _mysql_exceptions.OperationalError: (2020, "Got packet bigge

MySQLdb-1.2
closed
MySQLdb (285)
5
2012-09-19
2005-05-11
No

Hi,
it seems to me that either _mysql or mysqldb somehow
uses small max_allowed_packet variable. At least this
is where the error message points to. my.cnf files on
both, server and client set the variable to 1GB. They
are properly honored by mysql and mysqld. I point
mysqldb to read the .my.cnf file and in principle have
no reason to think it ignores it.

However, I perform very small select statement and it
dies with the above message. It works for other rows
and the difference is that this row contains over 8k
characters in BLOB. That's not much at all and even
with often default max_allowed_packet=1M this should
still work fine.

I suspect it's a bug in the wrappers. I have tested
mysql-4.0.24, 4.1.11, all on 2 machines running linux.
No luck.

$ cat >> bug.py
from MySQLdb import connect, DatabaseError, cursors
_c = connect(read_default_file =
"/home/mmokrejs/.my.cnf", read_default_group = 'test')
_c.query("show variables")
s = _c.store_result()
print s.num_rows()
_count = s.num_rows()
_index = 0
while _count != _index:
print s.row_tell()
print s.fetch_row()
_index += 1

The output is:

184
0
(('back_log', '100'),)
4
(('basedir',
'/usr/local/mysql-standard-4.1.11-pc-linux-gnu-i686/'),)
-1431655754
(('binlog_cache_size', '32768'),)
16
(('bulk_insert_buffer_size', '8388608'),)
-1431655744
(('character_set_client', 'latin1'),)
26
(('character_set_connection', 'latin1'),)
-1431655734
(('character_set_database', 'latin1'),)
1431655802
(('character_set_results', 'latin1'),)
42
(('character_set_server', 'latin1'),)
1431655812
(('character_set_system', 'utf8'),)
-1431655714

Maybe this would point to the problem with my select
statement and explain why it looks like the
max_allowed_packet problem?

Discussion

<< < 1 2 (Page 2 of 2)
  • Andy Dustman

    Andy Dustman - 2005-05-12

    Logged In: YES
    user_id=71372

    Scratch part of that last comment: .num_rows() does return
    a valid value in the .use_result() case, but only after you
    have read the entire result set, which makes it not terribly
    useful, but it is what it is.

     
  • Martin Mokrejs

    Martin Mokrejs - 2005-05-12

    Logged In: YES
    user_id=696559

    You should call --cflags instead of --include

    $ find /usr/local/mysql* -name mysql_config | while read f;
    do $f --cflags; done
    -I/usr/local/mysql-debug-4.1.11-pc-linux-gnu-i686/include
    -mcpu=pentiumpro
    -I'/usr/local/mysql-max-4.0.15-pc-linux-i686/include'
    -I/usr/local/mysql-max-4.0.16-pc-linux-i686/include
    -mpentiumpro -DBIG_TABLES
    -I/usr/local/mysql-max-4.0.17-pc-linux-i686/include
    -mpentiumpro -DBIG_TABLES
    -I/usr/local/mysql-max-4.0.18-pc-linux-i686/include
    -mpentiumpro -DBIG_TABLES
    -I/usr/local/mysql-max-4.0.21-pc-linux-i686/include
    -mpentiumpro -DBIG_TABLES
    -I/usr/local/mysql-max-4.0.22-pc-linux-i686/include
    -mpentiumpro -DBIG_TABLES
    -I/usr/local/mysql-standard-4.0.22-pc-linux-i686-icc-glibc23/include
    -unroll2 -ip -mp -no-gcc -restrict
    -I/usr/local/mysql-standard-4.0.24-pc-linux-gnu-i686/include
    -mcpu=pentiumpro
    -I/usr/local/mysql-standard-4.1.10-pc-linux-gnu-i686/include
    -mcpu=pentiumpro
    -I/usr/local/mysql-standard-4.1.10a-pc-linux-gnu-i686/include
    -mcpu=pentiumpro
    -I/usr/local/mysql-standard-4.1.11-pc-linux-gnu-i686/include
    -mcpu=pentiumpro
    -I/usr/local/mysql-standard-4.1.11-unknown-linux-gnu-x86_64-icc-glibc23/include
    -ip -ip_no_inlining
    -I/usr/local/mysql-standard-4.1.6-gamma-pc-linux-i686/include
    -mcpu=pentiumpro
    -I/usr/local/mysql-standard-4.1.7-pc-linux-i686/include
    -mcpu=pentiumpro
    -I/usr/local/mysql-standard-4.1.8-pc-linux-i686/include
    -mcpu=pentiumpro
    -I/usr/local/mysql-standard-4.1.9-pc-linux-gnu-i686/include
    -mcpu=pentiumpro
    $

     
  • Andy Dustman

    Andy Dustman - 2005-05-12

    Logged In: YES
    user_id=71372

    Does --include just not work on the older versions, or does
    it return bad data?

     
  • Martin Mokrejs

    Martin Mokrejs - 2005-05-12

    Logged In: YES
    user_id=696559

    Including the patch. The dummy() function might be removed,
    but am still a beginner programmer. :(

    To answer your question, you get no data back on STDOUT, on
    STDERR is the usage message:

    find /usr/local/mysql* -name mysql_config | while read f;

    do $f --include; done
    -I/usr/local/mysql-debug-4.1.11-pc-linux-gnu-i686/include
    Usage:
    /usr/local/mysql-max-4.0.15-pc-linux-i686/bin/mysql_config
    [OPTIONS]
    Options:
    --cflags
    [-I'/usr/local/mysql-max-4.0.15-pc-linux-i686/include']
    --libs
    [-L'/usr/local/mysql-max-4.0.15-pc-linux-i686/lib'
    -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files
    -lnss_dns -lresolv -lc -lnss_files -lnss_dns -lresolv]

    --socket [/tmp/mysql.sock]
    --port [3306]
    --version [4.0.15]
    --libmysqld-libs
    -L'/usr/local/mysql-max-4.0.15-pc-linux-i686/lib' -lmysqld
    -lpthread -lz -lcrypt -lnsl -lm -lpthread -lc -lnss_files
    -lnss_dns -lresolv -lc -lnss_files -lnss_dns -lresolv -lrt

    -I/usr/local/mysql-max-4.0.16-pc-linux-i686/include
    -I/usr/local/mysql-max-4.0.17-pc-linux-i686/include
    -I/usr/local/mysql-max-4.0.18-pc-linux-i686/include
    -I/usr/local/mysql-max-4.0.21-pc-linux-i686/include
    -I/usr/local/mysql-max-4.0.22-pc-linux-i686/include
    -I/usr/local/mysql-standard-4.0.22-pc-linux-i686-icc-glibc23/include
    -I/usr/local/mysql-standard-4.0.24-pc-linux-gnu-i686/include
    -I/usr/local/mysql-standard-4.1.10-pc-linux-gnu-i686/include
    -I/usr/local/mysql-standard-4.1.10a-pc-linux-gnu-i686/include
    -I/usr/local/mysql-standard-4.1.11-pc-linux-gnu-i686/include
    -I/usr/local/mysql-standard-4.1.11-unknown-linux-gnu-x86_64-icc-glibc23/include
    -I/usr/local/mysql-standard-4.1.6-gamma-pc-linux-i686/include
    -I/usr/local/mysql-standard-4.1.7-pc-linux-i686/include
    -I/usr/local/mysql-standard-4.1.8-pc-linux-i686/include
    -I/usr/local/mysql-standard-4.1.9-pc-linux-gnu-i686/include

     
  • Martin Mokrejs

    Martin Mokrejs - 2005-05-12

    MySQL-python-1.2.1c3/setup.py.patch

     
  • Andy Dustman

    Andy Dustman - 2005-05-12

    Logged In: YES
    user_id=71372

    Can you test on the broken versions to see if it is setting
    a non-zero exit code:

    mysql_config --include || echo "Error occurred'

    setup.py is discarding output from mysql_config if it
    returns a non-zero exit code, so I suspect that these
    versions do not set it.

     
  • Andy Dustman

    Andy Dustman - 2006-02-27

    Logged In: YES
    user_id=71372

    If you can replicate this with the CVS version or 1.2.1c4
    (not released yet), reopen.

     
<< < 1 2 (Page 2 of 2)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks