Bug #62849 Memory leak using SELECT statements in a multi-threaded application.
Submitted: 20 Oct 2011 16:59 Modified: 24 Jan 2013 18:20
Reporter: Edwin Vandamme Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S2 (Serious)
Version:5.0.45, 5.0.77, 5.5.16 OS:Linux
Assigned to: CPU Architecture:Any
Tags: memory leak, multi threaded

File: Maximum allowed size is 3MB.
Description:
Privacy:

If the data you need to attach is more than 3MB, you should create a compressed archive of the data and a README file that describes the data with a filename that includes the bug number (recommended filename: mysql-bug-data-62849.zip) and upload one to sftp.oracle.com. A free Oracle Web (SSO) account (the one you use to login bugs.mysql.com) and a client that supports SFTP are required in order to access the SFTP server.

To upload the file to sftp.oracle.com:

  1. Open an SFTP client and connect to sftp.oracle.com. Specify port 2021 and remote directory /support/incoming/.
  2. Log in with your newly created Oracle Web account (email address) and password.
  3. Upload the archive to /support/incoming.
  4. Once you have uploaded the file, add a comment to this bug to notify us about it.
Example: sftp -oPort=2021 -oUser=email sftp.oracle.com:/support/incoming

Usage Notes: This directory is unlistable, which means that once you have uploaded your file, you will not be able to see it. A file cannot be uploaded more than once with the same filename. The filename must be changed before attempting to upload the file again. The filename should always start with mysql-bug- prefix. Files are retained on the SFTP server for 7 days and then permanently removed.

[20 Oct 2011 17:02] Edwin Vandamme
Code and tools to reproduce the problem

Attachment: mysql.error.report.tar.gz (application/x-gzip, text), 10.43 KiB.

[22 Oct 2011 17:58] Edwin Vandamme
Some logs from a recent test

Attachment: mysql.error.report.logs.tar.gz (application/x-gzip, text), 3.84 KiB.

[5 Nov 2011 9:47] Edwin Vandamme
Logs and code as mentioned above (minus log files as they are to big)

Attachment: mysql.error.report.002.tar.gz (application/x-gzip, text), 27.63 KiB.

[16 Nov 2011 7:01] Edwin Vandamme
1st run with valgrind as mentioned above.

Attachment: mysql.error.report.003.tar.gz (application/x-gzip, text), 194.31 KiB.

[16 Nov 2011 7:02] Edwin Vandamme
2th run with valgrind as mentioned above.

Attachment: mysql.error.report.004.tar.gz (application/x-gzip, text), 290.09 KiB.

[24 Sep 2012 11:21] Edwin Vandamme
Last test results with valgrind errors reported.

Attachment: mysql.error.report.005.tar.gz (application/x-gzip, text), 26.62 KiB.

[24 Sep 2012 13:31] Shane Bester
whoops, does this program leak memory ?

Attachment: bug62849.c (text/plain), 5.85 KiB.

[29 Sep 2012 11:18] Edwin Vandamme
bug62849 results after 72 hours

Attachment: stat.tot (application/octet-stream, text), 624 bytes.

[30 Sep 2012 16:35] Edwin Vandamme
Modified bug62849.c to read memory usage from stat file.

Attachment: bug62849_1.c (application/octet-stream, text), 10.85 KiB.

[3 Oct 2012 5:24] Shane Bester
5.5.27 client libs, 480 million queries, no leaking seen.

Attachment: no_leaks.txt (text/plain), 9.16 KiB.