[MDEV-32946] Memory leak after upgrading from 10.4 to 10.6 Created: 2023-12-04 Updated: 2024-01-08 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.6.15, 10.6.16 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Marcin Gryszkalis | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MariaDB 10.6.15 and .16 on FreeBSD 12.4 |
||
| Attachments: |
|
| Description |
|
After upgrading from 10.4.29 to 10.6.15 (and then 10.6.16) I'm observing huge memory leak probably related to FTS. As calculated by mytuner.pl max memory usage should be around 20GB (and it was like that on 10.4) - with the leak memory can grow up to 90GB within few hours. Attached example graph of memory usage. Database is mostly innodb. Observations I made:
Table used is like that:
Queries that seems to cause leak are 99% like that:
|
| Comments |
| Comment by Sergei Golubchik [ 2023-12-04 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What does MariaDB think of the memory usage? (MEMORY_USED in SHOW GLOBAL STATUS, MEMORY_USED in INFORMATION_SCHEMA.PROCESSLIST) Do you use standard glibc memory allocator or do you preload, say, jemalloc or tcmalloc? Do you have transparent huge pages enabled? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marcin Gryszkalis [ 2023-12-04 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I don't preload anything - although FreeBSD uses jemalloc as a standard libc allocator (not glibc obviously). Regarding THP - in FreeBSD these are called "superpages" and they're enabled by default since FreeBSD 7 (~2009):
although it's not enabled in MariaDB config:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-12-04 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sorry, I missed that it's FreeBSD (you did write it in the Environment). There are many reports around about transparent huge pages on Linux, mostly when combined with jemalloc, but not only.
I didn't find anything for FreeBSD's transparent superpages, and given that FreeBSD uses jemalloc by default, I wouldn't try to say that the above applies to FreeBSD directly. Still, you might want to try to disable transparent superpages and see if it'll make any difference. Meanwhile, we should try to repeat this memory growth and see what we can do about it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marcin Gryszkalis [ 2023-12-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
After switching FTS index/table to MyISAM the memory levels raised a bit since restart but then it's just fluctuating (I don't like having mixed engines though). I will try to isolate and replicate the problem on test FreeBSD instance where I can play with low-level configuration (like superpages) anyway. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2023-12-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Could you please also add the structure of `kl` table and your .cnf file(s)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marcin Gryszkalis [ 2023-12-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
relevant config entries (skipped paths, some logs and audit etc)
regarding tables - kl is large table (~130 colums, many indices, 15 FKs), kt is smaller. I can provide you with full anonymized definition if it's useful (later today). |