Bug #55838 Memory leak in ndb_mgm> LOG BLOCK=block_name
Submitted: 9 Aug 2010 14:05 Modified: 30 Nov 2010 14:53
Reporter: Magnus Blåudd Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-7.0 OS:Any
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: 7.0.17

[9 Aug 2010 14:05] Magnus Blåudd
Description:
Small memory leak detected in ndb_mgm> when running the "ALL LOG BLOCK = <block_name>" command.

For example:
ndb_mgm> ALL LOG BLOCK = DBTUP

gives these valgrind warnings:

==6577== 12 bytes in 2 blocks are definitely lost in loss record 6 of 42
==6577==    at 0x4C284A8: malloc (vg_replace_malloc.c:236)
==6577==    by 0x5E05D51: strdup (strdup.c:43)
==6577==    by 0x47C415: CommandInterpreter::parseBlockSpecification(char const*, Vector<char const*>&) (CommandInterpreter.cpp:1513)
==6577==    by 0x47FCA0: CommandInterpreter::executeLog(int, char const*, bool) (CommandInterpreter.cpp:2664)
==6577==    by 0x47C18A: CommandInterpreter::executeForAll(char const*, int (CommandInterpreter::*)(int, char const*, bool), char const*) (CommandInterpreter.cpp:1463)
==6577==    by 0x47BC67: CommandInterpreter::analyseAfterFirstToken(int, char*) (CommandInterpreter.cpp:1362)
==6577==    by 0x47B7B6: CommandInterpreter::execute_impl(char const*, bool) (CommandInterpreter.cpp:1259)
==6577==    by 0x47ACBE: CommandInterpreter::execute(char const*, int, bool, int*) (CommandInterpreter.cpp:1032)
==6577==    by 0x479940: Ndb_mgmclient::execute(char const*, int, bool, int*) (CommandInterpreter.cpp:186)
==6577==    by 0x47937F: read_and_execute(int) (main.cpp:112)
==6577==    by 0x479601: main (main.cpp:159)

How to repeat:
ndb_mgm> ALL LOG BLOCK = DBTUP

Suggested fix:
Remove the  strdup and use a Vector<BaseString> instead of Vector<char*>.
[17 Aug 2010 11:57] 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/115935
[23 Sep 2010 9:52] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.47-ndb-7.0.19 (revid:magnus.blaudd@sun.com-20100923093619-c0b9mvyffucp9nhi) (version source revid:magnus.blaudd@sun.com-20100923093619-c0b9mvyffucp9nhi) (merge vers: 5.1.47-ndb-7.0.19) (pib:21)
[30 Nov 2010 14:53] Jon Stephens
Since this command is available in debug builds only, no changelog entry is required.

(We should probably document the debug-only stuff in the NDB Internals doc, but that's a separate issue, at least for now.)

Closed.