[debian-mysql] Bug#551317: mysql-server-5.0: memory leak on amd64
Yves Agostini
agostini at univ-metz.fr
Sat Oct 17 08:21:45 UTC 2009
Package: mysql-server-5.0
Version: 5.0.51a-24+upvm2
Severity: important
Tags: patch
ezPublish (a PHP cms) create very loud SQL requests, with bad indexing
and auto-generated jointures.
When we moved from a 32 to a 64 bits machine we suffered of unpredictable
memory leaks. I don't find any test case.
I applied the following patch on septembre 3 and trouble looks resolved.
No more memory leak for more than one month.
#! /bin/sh /usr/share/dpatch/dpatch-run
## 99-unnamed.dpatch by Christian Hammers <ch at debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Patch provided by Sergei Golubchik of MySQL.
@DPATCH@
# DP: http://lists.mysql.com/commits/41838
# DP: mysql BUG#27732 "Possible memory leak with index_merge"
--- old/sql/handler.cc 2007-11-16 13:46:35 +03:00
+++ new/sql/handler.cc 2008-02-07 05:09:59 +03:00
@@ -1381,6 +1381,13 @@ int ha_delete_table(THD *thd, enum db_ty
handler *handler::clone(MEM_ROOT *mem_root)
{
handler *new_handler= get_new_handler(table, mem_root, table->s->db_type);
+ /*
+ Allocate handler->ref here because otherwise ha_open will allocate it
+ on this->table->mem_root and we will not be able to reclaim that memory
+ when the clone handler object is destroyed.
+ */
+ if (!(new_handler->ref= (byte*) alloc_root(mem_root, ALIGN_SIZE(ref_length)*2)))
+ return NULL;
if (new_handler && !new_handler->ha_open(table->s->path, table->db_stat,
HA_OPEN_IGNORE_IF_LOCKED))
return new_handler;
@@ -1420,8 +1427,9 @@ int handler::ha_open(const char *name, i
(void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL
DBUG_ASSERT(alloc_root_inited(&table->mem_root));
-
- if (!(ref= (byte*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2)))
+ /* ref is already allocated for us if we're called from handler::clone() */
+ if (!ref && !(ref= (byte*) alloc_root(&table->mem_root,
+ ALIGN_SIZE(ref_length)*2)))
{
close();
error=HA_ERR_OUT_OF_MEM;
-- System Information:
Debian Release: 5.0.3
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.26-2-xen-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages mysql-server-5.0 depends on:
ii adduser 3.110 add and remove users and groups
ii debconf [debconf-2.0] 1.5.24 Debian configuration management sy
ii libc6 2.7-18 GNU C Library: Shared libraries
ii libdbi-perl 1.605-1 Perl5 database interface by Tim Bu
ii libgcc1 1:4.3.2-1.1 GCC support library
ii libmysqlclient15off 5.0.51a-24+upvm2 MySQL database client library
ii libncurses5 5.7+20081213-1 shared libraries for terminal hand
ii libreadline5 5.2-3.1 GNU readline and history libraries
ii libstdc++6 4.3.2-1.1 The GNU Standard C++ Library v3
ii libwrap0 7.6.q-16 Wietse Venema's TCP wrappers libra
ii lsb-base 3.2-20 Linux Standard Base 3.2 init scrip
ii mysql-client-5.0 5.0.51a-24+upvm2 MySQL database client binaries
ii mysql-common 5.0.51a-24+upvm2 MySQL database common files
ii passwd 1:4.1.1-6 change and administer password and
ii perl 5.10.0-19lenny2 Larry Wall's Practical Extraction
ii psmisc 22.6-1 Utilities that use the proc filesy
ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime
Versions of packages mysql-server-5.0 recommends:
ii bsd-mailx [mailx] 8.1.2-0.20071201cvs-3 A simple mail user agent
ii libhtml-template-p 2.9-1 HTML::Template : A module for usin
ii mailx 1:20071201-3 Transitional package for mailx ren
Versions of packages mysql-server-5.0 suggests:
pn tinyca <none> (no description available)
-- debconf information excluded
More information about the pkg-mysql-maint
mailing list