Bug #56650 Valgrind warnings for memory leak in semisync plugin (MYSQL object not freed)
Submitted: 8 Sep 2010 13:56 Modified: 14 Dec 2010 6:40
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:trunk, 5.6 OS:Any
Assigned to: Zhenxing He CPU Architecture:Any
Tags: memory leak, replication, semisync, valgrind

[8 Sep 2010 13:56] Sven Sandberg
Description:
This is one of several Valgrind warnings for trunk-bugfixing in pb2 at https://central.sun.net/http://pb2.norway.sun.com/?action=archive_download&archive_id=2239... . In rpl.rpl_semi_sync_event:

975 (188 direct, 787 indirect) bytes in 2 blocks are definitely lost in loss record 6 of 8
   at 0x4A05809: malloc (vg_replace_malloc.c:149)
   by 0xA72A64: my_malloc (my_malloc.c:38)
   by 0xA67BF1: alloc_root (my_alloc.c:166)
   by 0xA6836F: strmake_root (my_alloc.c:421)
   by 0x886D5E: unpack_fields (client.c:1426)
   by 0x88AE52: cli_read_query_result (client.c:3244)
   by 0x88B031: mysql_real_query (client.c:3278)
   by 0x23B4E21E: ???
   by 0x6AD95B: Binlog_relay_IO_delegate::before_request_transmit(THD*, Master_info*, unsigned short) (rpl_handler.cc:448)
   by 0x874BBE: request_dump(THD*, st_mysql*, Master_info*, bool*) (rpl_slave.cc:2247)
   by 0x87B94D: handle_slave_io (rpl_slave.cc:3112)
   by 0x8AC99A: pfs_spawn_thread (pfs.cc:1061)
   by 0x30242062F6: start_thread (in /lib64/libpthread-2.5.so)
   by 0x30236D1B6C: clone (in /lib64/libc-2.5.so)

This seems to be a MYSQL object that does not get deallocated in the semisync plugin.

How to repeat:
Read the log.
[8 Sep 2010 13:59] Sven Sandberg
See also BUG#56649 and BUG#56652.
[20 Oct 2010 11:11] Sven Sandberg
This happened again on http://pb2.norway.sun.com/web.py?template=show_pushes&branch=mysql-5.5 , on the valgrind host, push http://pb2.norway.sun.com/web.py?template=push_details&push=1618586
in test case rpl_heartbeat_basic. So setting to verified.
[29 Nov 2010 5:55] 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/125293

3258 He Zhenxing	2010-11-29
      BUG#56650 Valgrind warnings for memory leak in semisync plugin (MYSQL object not freed)
      
      The problem was that the query result was not freed properly when
      querying master semi-sync status on slave, fixed the problem by adding
      code to free the query result.
[2 Dec 2010 7:38] 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/125750

3405 He Zhenxing	2010-12-02
      BUG#56650 Valgrind warnings for memory leak in semisync plugin (MYSQL object not freed)
      
      The problem was that the query result was not freed properly when
      querying master semi-sync status on slave, fixed the problem by adding
      code to free the query result.
[2 Dec 2010 8:00] Zhenxing He
Pushed to trunk-bugfixing
[5 Dec 2010 12:42] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (version source revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (merge vers: 5.6.1) (pib:23)
[14 Dec 2010 6:40] Jon Stephens
Issue does not appear in a 5.6 release; no changelog entry required. Closed.