Bug #102641 MySQL Server memory consumption
Submitted: 18 Feb 2021 11:46 Modified: 18 Feb 2021 14:31
Reporter: Andrey Tovstik Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:8.0.23 OS:Solaris
Assigned to: CPU Architecture:SPARC

[18 Feb 2021 11:46] Andrey Tovstik
Description:
I observe a strange behavior of one of my MySQL instances. According to system metrics it consumes around 93Gb of RAM. 

   PID USERNAME     SIZE      RSS STATE   PRI NICE      TIME    CPU PROCESS/NLWP  
 28969 70        110362M   93398M sleep    59    0  91:25:30 0.110% mysqld/445

But 
select * from sys.memory_global_total;

gives me only 25.97 GiB memory consumed and this value corresponds to values from my.cnf

pmap running on mysqld process shows me that a lot of memory consuming by heap pieces ~4Gb size per piece.

0000000110000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000000200000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000002F0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000003E0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000004D0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000005C0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000006B0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000007A0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000000890000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000000980000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000000A70000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000000B60000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000000C50000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000000D40000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000000E30000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000000F20000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000001010000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
0000001100000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000011F0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000012E0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000013D0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000014C0000000   3932160  3932160  3932160    - 256M rwx----  [ heap ]
00000015B0000000    524288   524288   524288    - 256M rwx----  [ heap ]

the last heap piece currently stops grows, but I'm not sure that it will not increase in the future.

Any suggestion on how to find out why memory grows and don't release?

How to repeat:
I can't reproduce this bug anywhere
[18 Feb 2021 11:47] Andrey Tovstik
my.cnf from the server

Attachment: my.cnf (application/octet-stream, text), 2.60 KiB.

[18 Feb 2021 11:47] Andrey Tovstik
full pmap output

Attachment: pmap-ext.out (application/octet-stream, text), 88.18 KiB.

[18 Feb 2021 13:35] MySQL Verification Team
Hi Mr. Tovstik,

Thank you for your bug report.

However, this is not our bug. Simply, system malloc libraries on most operating systems, tend to reserver memory for future requests.

You can observe memory usage with many utilities on Solaris, including vmstat, pmap, prstat, plockstat, swap and some others.

Not a bug.