[MDEV-30096] Memory leak 10.3.37 and 10.6.11 Created: 2022-11-25 Updated: 2023-11-28 Resolved: 2022-12-28 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Prepared Statements |
| Affects Version/s: | 10.3.37, 10.6.11 |
| Fix Version/s: | 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Erik Friesen | Assignee: | Sergei Golubchik |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | regression | ||
| Environment: |
VPS server on Centos 7 x64 with 8bg, cpanel/whm |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Since the server auto updated from 10.3.36 to 10.3.37, as well as after updating from 10.3.37 to 10.6.11, there is a memory leak. on 10.3.37, top showed 1.3g use
Which didn't match the 162MB shown by SHOW ENGINE INNODB STATUS;
Moving to 10.6.11: Some px-aux | grep mariadb log points
I have done a couple of consecutive memory dumps using and while I may not understand what to look for, it seems like the growing files show data relating to these tables and queries.
Memory dump script from here https://serverfault.com/questions/173999/dump-a-linux-processs-memory-to-file
I'll try to migrate everything, but here is my original issue - https://dba.stackexchange.com/questions/320126/memory-leak-mariadb-10-3-37 |
| Comments |
| Comment by Daniel Black [ 2022-11-27 ] | |||||||||||||||||||||||||
|
Thanks Erik for reporting the bug. The time"59:49" on the 10.6 measurement is ambiguous. If you've got further 10.6 measurements to confirm the trend that would be useful. 10.5+ has performance schema, which I'm not terribly well versed, in however setting the following start to provide instrumentation:
After that the following tables/views will be populated:
SELECT * FROM performance_schema.memory_summary_global_by_event_name might start to show a leak by area. Much appreciate your assistance in narrowing down this problem. | |||||||||||||||||||||||||
| Comment by Erik Friesen [ 2022-11-27 ] | |||||||||||||||||||||||||
|
Yes, the time is pretty nebulous. Its growing by about 320MB daily it appears. My initial guess is that this may well be related to MDEV-29404 Those prepared statements above are by far the bulk of what happens on this server. I'll work on getting more data. | |||||||||||||||||||||||||
| Comment by Erik Friesen [ 2022-11-28 ] | |||||||||||||||||||||||||
|
I've added some files. I restarted the server at 16:19 and took the second snapshots at 8:45. ps -aux output @ 11.28.2022-8:41:AM is | |||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-11-28 ] | |||||||||||||||||||||||||
|
It cannot be MDEV-29404 because a comment there says "Verified that this is not a new regression" and yours is not present in 10.3.36. Can you try to close all connections for a moment and see if the memory would stop growing after they reconnect? That would mean the memory is not truly lost, but is freed on disconnect. Does your processlist have unusually many connections in the "Starting cleanup" state? It might be As a workaround you can try to wrap your parameters (question marks) in CONVERT and see it that helps, like in
| |||||||||||||||||||||||||
| Comment by Erik Friesen [ 2022-11-28 ] | |||||||||||||||||||||||||
|
I am unable to stop all connections easily, but the one I did reconnect did appear to release about 300MB of memory.
I have a number of items in sleep, but none in "Starting cleanup" This is a production server in active use, I am somewhat limited in my testing options. Also note that I am using 10.6.11 for these present tests. | |||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-11-28 ] | |||||||||||||||||||||||||
|
Yes,
if all that matches your use case you could be affected by
and workarounds could be
or wait for the next release that will have it fixed | |||||||||||||||||||||||||
| Comment by Miroslav Lachman [ 2022-12-28 ] | |||||||||||||||||||||||||
|
Are there any update and fix for this memory issue in 10.6.11? | |||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-12-28 ] | |||||||||||||||||||||||||
|
Lachman, yes, it's a duplicate of | |||||||||||||||||||||||||
| Comment by MAtteo Valsasna [ 2023-01-12 ] | |||||||||||||||||||||||||
|
memory leak on 10.5.18 (debian 11) here it seems to match quite well the description by Sergei Golubchik above also, information_schema.PROCESSLIST.memory_used points a finger on emqx 4.1.3, which is indeed executing always the same prepared statement with string comparisons each time an MQTT PUBLISH is received, which is thousands of times. what doesn't match is that if I kill the emqx mysql connections no memory is released to the OS (instead, /proc/pid/VmSize keeps growing at the same rate). is it supposed to be released to the OS or to a mariadb memory pool? also, in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1027337 it seems that the bug was introduced between 10.5.15 and 10.5.18. can you confirm? we would like to downgrade to the latest non-affected debian package while we wait for 10.5.19 thanks MAtteo | |||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-01-12 ] | |||||||||||||||||||||||||
|
Introduced in 10.5.18 (there's a "Caused by" link in Other possible workarounds, besides downgrading, could be
10.5.19 is planned to be released (see https://jira.mariadb.org) in two weeks | |||||||||||||||||||||||||
| Comment by MAtteo Valsasna [ 2023-01-12 ] | |||||||||||||||||||||||||
|
I tried forcing disconnections using mysql kill (the application reconnects gracefully), but apparently did not free the memory (at least from the OS perspective), and did not stop the mariadb memory occupation growth (so it seems that also mariadb didn't recover the memory). our workload includes at least 20/s queries to stored procedures with string comparisons and different charsets, which triggered if we downgrade to 10.1.15, could we be exposed to the bug whose fix introduced thanks MAtteo | |||||||||||||||||||||||||
| Comment by Mariusz Gronczewski [ 2023-11-28 ] | |||||||||||||||||||||||||
|
I'm using 10.11.4 (Debian Bookworm package) and PowerDNS is causing this leak pretty repeatably echo 'kill user dns' | mysql helps temporarily I don't think it should be closed, it is neither related to any tickets as "duplicate" nor fixed | |||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-11-28 ] | |||||||||||||||||||||||||
|
xani, if you're using 10.11.4, it cannot be this leak, it must be something else. Does MariaDB internal memory monitoring show the leak? MEMORY_USED status variable? MEMORY_USED column in the INFORMATION_SCHEMA.PROCESSLIST, performance schema? |