| Bug #27854 | 'mysqladmin debug' command invokes 64bit unaware mallinfo() | ||
|---|---|---|---|
| Submitted: | 16 Apr 2007 17:03 | Modified: | 5 Apr 2013 15:43 |
| Reporter: | Shane Bester (Platinum Quality Contributor) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: General | Severity: | S3 (Non-critical) |
| Version: | all 64-bit | OS: | Other (64-bit) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | mallinfo, Memory, mysqladmin debug | ||
[17 Apr 2007 8:06]
MySQL Verification Team
to clarify: this is currently a glibc bug in mallinfo(). But, if that was to be fixed, then the bug would be in mysql because it's casting those values to (int). Therefore, this bug report is just a reminder to eventually fix that, when the mallinfo becomes 64-bit happy.
[15 Feb 2008 23:46]
Trudy Pelzer
To clarify: this is currently a glibc bug in mallinfo() not in MySQL.
[18 Feb 2008 9:39]
Sergei Golubchik
why not to add correct casts now, and forget about the issue ?
[30 Mar 2008 11:28]
MySQL Verification Team
bug #35680 was marked as a duplicate of this.
[5 Apr 2013 15:43]
Paul DuBois
Noted in 5.6.12, 5.7.2 changelogs. mysqladmin debug produced incorrect memory status information in 64-bit environments when mysqld consumed more than 4GB memory.

Description: While useful for debugging memory usage of the server, the "mysqladmin debug" output in the summary section is not giving correct information in 64-bit environments where the mysqld consumes > 4GB of ram. For example, we see the garbage output: Memory status: Non-mmapped space allocated from system: 17182720 Number of free chunks: 59 Number of fastbin blocks: 0 Number of mmapped regions: 1659 Space in mmapped regions: -70148096 Maximum total allocated space: 0 Space available in freed fastbin blocks: 0 Total allocated space: 14404160 Total free space: 2778560 Top-most, releasable space: 132832 Estimated memory (with thread stack): -50606080 However, the unsuspecting dba might see all positive numbers and not realize they have been wrapped around at 2^32 How to repeat: The bug exists in the glibc. If newer glibc is fixed, a bug will exist in mysqld due to the casting: #ifdef HAVE_MALLINFO struct mallinfo info= mallinfo(); printf("\nMemory status:\n\ Non-mmapped space allocated from system: %d\n\ Number of free chunks: %d\n\ Number of fastbin blocks: %d\n\ Number of mmapped regions: %d\n\ Space in mmapped regions: %d\n\ Maximum total allocated space: %d\n\ Space available in freed fastbin blocks: %d\n\ Total allocated space: %d\n\ Total free space: %d\n\ Top-most, releasable space: %d\n\ Estimated memory (with thread stack): %ld\n", (int) info.arena , (int) info.ordblks, (int) info.smblks, (int) info.hblks, (int) info.hblkhd, (int) info.usmblks, (int) info.fsmblks, (int) info.uordblks, (int) info.fordblks, (int) info.keepcost, (long) (thread_count * thread_stack + info.hblkhd + info.arena)); #endif puts(""); } Suggested fix: Either disable mallinfo call on 64-bit, or print a huge warning. Also, do not cast the above to (int). Perhaps size_t will be used in glibc in future then it would work as expected?