Bug #9673 | valgrind shows not freed memory in InnoDB | ||
---|---|---|---|
Submitted: | 6 Apr 2005 11:26 | Modified: | 25 May 2005 10:39 |
Reporter: | Michael Widenius | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 5.0.3 | OS: | Linux (Linux) |
Assigned to: | Marko Mäkelä | CPU Architecture: | Any |
[6 Apr 2005 11:26]
Michael Widenius
[6 Apr 2005 12:12]
Heikki Tuuri
Marko, please look at this. Heikki
[7 Apr 2005 16:29]
Marko Mäkelä
Monty, Did you by any chance use innodb_fast_shutdown? In that case, innobase_shutdown_for_mysql() will return before closing dict_foreign_err_file and calling ut_free_all_mem() in order to free all memory allocated by ut_malloc(). In other words, that would be the expected behaviour. I couldn't repeat these problems with innodb_fast_shutdown=0, but I got some weird traces: ==19715== Syscall param write(buf) points to uninitialised byte(s) ==19715== at 0x83C0024: write (in /home/msmakela/innobase/mysql-5.0.4/sql/mysqld) ==19715== by 0x833A42F: os_thread_create (os0thread.c:158) ==19715== by 0x8209361: innobase_start_or_create_for_mysql (srv0start.c:1555) ==19715== by 0x81A020D: innobase_init() (ha_innodb.cc:1282) ==19715== by 0x819512B: ha_init() (handler.cc:381) ==19715== by 0x80E3E64: init_server_components() (mysqld.cc:2782) ==19715== by 0x80E7B24: main (mysqld.cc:3087) ==19715== Address 0x52BFA4AC is on thread 1's stack Judging from the disassembly, the write() call is in __pthread_create_2_1, whatever that is. I was using a recent mysql 5.0.4-bk on GNU/Linux with kernel 2.6 and GNU libc 2.3.2, compiled with gcc 3.4.4 20050314 (prerelease) and linked statically.
[7 May 2005 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[24 May 2005 15:09]
Marko Mäkelä
Monty, you should pass --skip-innodb-fast-shutdown to mysqld when testing for memory leaks. Otherwise InnoDB will skip most of its shutdown procedures, including the step to free all memory pools. (The memory pools will be freed by the operating system anyway.)
[24 May 2005 15:20]
Marko Mäkelä
Sorry, it is indeed a bug. Someone changed 5.0 so that innobase_shutdown_for_mysql() will essentially crash InnoDB if innodb_fast_shutdown=1 (the default). The shutdown procedure should only be skipped if innodb_fast_shutdown=2.
[25 May 2005 10:35]
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/internals/25257
[25 May 2005 10:39]
Marko Mäkelä
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html Additional info: When the option innodb_fast_shutdown=2 was introduced, the InnoDB shutdown procedure was modified so that it would essentially crash InnoDB if innodb_fast_shutdown differs from 0. With innodb_fast_shutdown=1, InnoDB should wait for all threads to exit and release all allocated memory, as it does in MySQL 4.1.