Bug #34275 mysqld leak if doing multiple statements within same transaction (or wo/ trans)
Submitted: 4 Feb 2008 12:35 Modified: 20 Feb 2008 21:07
Reporter: Jonas Oreland Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Tomas Ulin CPU Architecture:Any

[4 Feb 2008 12:35] Jonas Oreland
Description:
begin;
select * from kalle; // here 32 bytes are allocated
select * from kalle; // here 32 bytes are allocated
...

commit; // here 32 x X bytes are released

How to repeat:
run above, watch mysqld memory consumption

Suggested fix:
dont clear open_tables hash at every statement
this leads to get_open_table not finding it in hash, making allocate 32 bytes
  and transaction memroot.
[4 Feb 2008 14:40] 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/41652

ChangeSet@1.2674, 2008-02-04 15:40:04+01:00, tomas@poseidon.ndb.mysql.com +2 -0
  Bug #34275 mysqld leak if doing multiple statements within same transaction (or wo/ trans)
  - in autocommit do not allocate statistics share, but instead use one directly on the handler
[12 Feb 2008 15:19] Jon Stephens
Documented bugfix in 5.1.23-ndb-6.3.9 changelog as follows:

        Performing many SQL statements within a single transaction, or
        in AUTOCOMMIT mode, on NDB tables caused a memory leak in
        mysqld.

Left in PQ status pending further merges.
[12 Feb 2008 16:10] Jon Stephens
Also documented for 5.1.23-ndb-6.2.12.
[12 Feb 2008 17:43] Jonas Oreland
I stand corrected, problem only occurs in auto-commit mode.
I.e not when starting with "begin"
[20 Feb 2008 16:03] Bugs System
Pushed into 5.1.24-rc
[20 Feb 2008 16:04] Bugs System
Pushed into 6.0.5-alpha
[20 Feb 2008 21:07] Jon Stephens
Updated changelog entry per note from Jonas.

Fix also now documented for 5.1.24 and 6.0.5.