Bug #59874 Valgrind warning in InnoDB compression code
Submitted: 1 Feb 2011 17:59 Modified: 10 Feb 2011 19:54
Reporter: Vasil Dimov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.1, 5.5, trunk OS:Any
Assigned to: Vasil Dimov CPU Architecture:Any

[1 Feb 2011 17:59] Vasil Dimov
Description:
After InnoDB valgrind instrumentation got enabled on PB2/valgrind runs we got the following failure:

in 5.1:

innodb_plugin.innodb-zip
innodb_plugin.innodb_bug52745
innodb_plugin.innodb_bug56680

in 5.5:

innodb.innodb-zip
innodb.innodb_bug56680

in trunk:

innodb.innodb-zip
innodb.innodb_bug56680

fail with (output taken from 5.1):

==29347== Thread 17:
==29347== Conditional jump or move depends on uninitialised value(s)
==29347==    at 0xBA65BF: longest_match (deflate.c:1143)
==29347==    by 0xBA7899: deflate_slow (deflate.c:1595)
==29347==    by 0xBA58EB: deflate (deflate.c:790)
==29347==    by 0x6C9D150: btr_store_big_rec_extern_fields (btr0cur.c:3968)
==29347==    by 0x6D53ECE: row_ins_index_entry_low (row0ins.c:2131)
==29347==    by 0x6D54139: row_ins_index_entry (row0ins.c:2180)
==29347==    by 0x6D54395: row_ins_index_entry_step (row0ins.c:2265)
==29347==    by 0x6D5443B: row_ins (row0ins.c:2397)
==29347==    by 0x6D54A9E: row_ins_step (row0ins.c:2507)
==29347==    by 0x6D5D404: row_insert_for_mysql (row0mysql.c:1148)
==29347==    by 0x6CF68C8: ha_innodb::write_row(unsigned char*) (ha_innodb.cc:4780)
==29347==    by 0x7E96D8: handler::ha_write_row(unsigned char*) (handler.cc:4673)
==29347==    by 0x749AC2: write_record(THD*, st_table*, st_copy_info*) (sql_insert.cc:1604)
==29347==    by 0x749F2C: select_insert::send_data(List<Item>&) (sql_insert.cc:3181)
==29347==    by 0x7152BD: end_send(JOIN*, st_join_table*, bool) (sql_select.cc:12335)
==29347==    by 0x71BC09: evaluate_join_record(JOIN*, st_join_table*, int) (sql_select.cc:11555)

How to repeat:
http://pb2.norway.sun.com/?template=show_pushes&branch=mysql-5.1-innodb-pb2
http://pb2.norway.sun.com/?template=show_pushes&branch=mysql-5.5-innodb-pb2
http://pb2.norway.sun.com/?template=show_pushes&branch=mysql-trunk-innodb-pb2
[2 Feb 2011 0:54] MySQL Verification Team
apparently this is a known issue in zlib..
http://www.zlib.net/zlib_faq.html#faq36

so i guess adding a suppression could be done to silence it ?
[2 Feb 2011 8:42] Marko Mäkelä
Vasil, please add a suppression to mysql-test/valgrind.supp.

btr_store_big_rec_extern_fields() checks that the uncompressed BLOB data is fully initialized, and we do not get any Valgrind warnings for this:

		UNIV_MEM_ASSERT_RW(big_rec_vec->fields[i].data,
				   extern_len);
[4 Feb 2011 10:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/130387

3701 Vasil Dimov	2011-02-04
      Fix Bug#59874 Valgrind warning in InnoDB compression code
      
      Add suppressions for a bogus valgrind warnings.
[8 Feb 2011 17:36] Bugs System
Pushed into mysql-5.1 5.1.56 (revid:vasil.dimov@oracle.com-20110208172642-ekjin6otzuy47vn9) (version source revid:vasil.dimov@oracle.com-20110208172642-ekjin6otzuy47vn9) (merge vers: 5.1.56) (pib:24)
[8 Feb 2011 17:37] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:vasil.dimov@oracle.com-20110208173442-ocy58fdcuew3xvex) (version source revid:vasil.dimov@oracle.com-20110208173331-fu0j2s14jbg915zu) (merge vers: 5.6.2) (pib:24)
[8 Feb 2011 17:38] Bugs System
Pushed into mysql-5.5 5.5.10 (revid:vasil.dimov@oracle.com-20110208173046-qsmzbrw1gppahx5o) (version source revid:vasil.dimov@oracle.com-20110208172800-tls70r2ot1i0dub7) (merge vers: 5.5.10) (pib:24)
[13 Jun 2011 21:12] Mark Callaghan
Are the warnings really bogus? Per our local zlib guru:
>>>
InnoDB invokes the zlib inflateInit() or inflateInit2() before initializing
next_in and avail_in. The documentation clearly says that these fields must
be initialized. It is deflateInit() and friends who do not care about these
two fields.
>>>
[13 Jun 2011 22:27] Davi Arnaut
See http://lists.mysql.com/commits/133000
[14 Jun 2011 4:11] Ben Krug
If I read http://lists.mysql.com/commits/133000 right, this bug was properly fixed in commit 3717?  If so, what version of MySQL would that be pushed in?
[14 Jun 2011 22:47] Davi Arnaut
The bug has a Fixed Ver field. Also, I think this and the other one are different issues. This one is a valgrind warning in deflate (see http://www.zlib.net/zlib_faq.html#faq36), whilst the other is in inflate.