[MDEV-29147] full text index causes memory leak Created: 2022-07-21 Updated: 2023-02-15 Resolved: 2023-01-03 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Galera, Storage Engine - InnoDB |
| Affects Version/s: | 10.6.8 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Critical |
| Reporter: | Richard Stracke | Assignee: | Denis Protivensky |
| Resolution: | Cannot Reproduce | Votes: | 1 |
| Labels: | Memory_leak | ||
| Attachments: |
|
| Description |
|
Complex queries with fulltext index cause memory leak over time. with innodb_prefix_index_cluster_optimization=On memory consumption/ leak |
| Comments |
| Comment by Elena Stepanova [ 2022-07-25 ] | |||||||||||||
|
We'll need something reproducible for this. | |||||||||||||
| Comment by Richard Stracke [ 2022-08-05 ] | |||||||||||||
|
Finally I can reproduce it. 1. Create a galera cluster 2. Create a table with fulltext index 3. fire inserts and a select on the column with fulltext index and "order by" on the same time
| |||||||||||||
| Comment by Elena Stepanova [ 2022-08-05 ] | |||||||||||||
|
ramesh, could you please verify and assign as needed? | |||||||||||||
| Comment by Ramesh Sivaraman [ 2022-08-06 ] | |||||||||||||
|
Reproduced the issue using the given test case.
| |||||||||||||
| Comment by Jan Lindström (Inactive) [ 2022-09-13 ] | |||||||||||||
|
After few rounds of mtr with attached test case, I could not get any memory leak reports from valgrind. Furthermore, based on code review there should not be anything special wsrep handling on FTS (expect on SST). Therefore, if there is a memory leak it should be repeatable without Galera. | |||||||||||||
| Comment by Ramesh Sivaraman [ 2022-09-13 ] | |||||||||||||
|
jplindst When testing Galera the buffer_pool configuration on my local VM box was not noticed, the increased memory usage was not due to INSERT/SELECT on FTS but due to higher buffer_pool size. Non-Galera server also showing increased memory usage with higher buffer_pool size. Richard Can you please check if memory usage exceeds buffer_pool size when running INSERT/SELECT on FTS on your local box? | |||||||||||||
| Comment by Marko Mäkelä [ 2022-09-14 ] | |||||||||||||
|
jplindst, can you please provide a way to reproduce this bug without using Galera? | |||||||||||||
| Comment by Marko Mäkelä [ 2022-09-14 ] | |||||||||||||
|
Side note: In | |||||||||||||
| Comment by Marko Mäkelä [ 2022-09-14 ] | |||||||||||||
|
Richard, I removed the link to | |||||||||||||
| Comment by Marko Mäkelä [ 2022-09-14 ] | |||||||||||||
|
Richard, which type of a server build did you use? In galera_mysqlslap.test Sometimes memory leaks are confused with internal memory fragmentation in the allocator. I would suggest to try a different allocator, or configuring the allocator in the C runtime library. For GNU/Linux, see man mallopt or try replacing the GNU libc malloc() with jemalloc or tcmalloc. At least the latter includes a heap profiler. I would also suggest trying this without Galera, to confirm if the observed memory usage is Galera related. | |||||||||||||
| Comment by Daniel Black [ 2022-09-16 ] | |||||||||||||
|
The bitnami image doesn't include jemalloc however the Docker Library images do. So either:
Note without bitnami symbols, resolution might be hard: https://github.com/bitnami/containers/issues/6290 General form running jemalloc is using LD_PRELOAD and MALLOC_CONF env variable in containers as mysqld_safe isn't used:
I'm not an expert in MALLOC_CONF, I just copied from https://access.redhat.com/articles/6817071, a more detailed look acheive less noisy results. | |||||||||||||
| Comment by Denis Protivensky [ 2022-12-19 ] | |||||||||||||
|
Test setup: upstream 10.6 branch (dd5f4b3625d); ASAN-enabled build; default Galera settings; test scenario with mysqlslap. Conclusion: Memory leak is not confirmed with Galera, although memory growth speed is higher up to some point in time, and the memory usage stabilization takes longer compared to non-Galera server run. Explanation: `galera.cache` ring buffer cache file of 128M size (by default) is mmap-ed into memory, and while it's getting filled with data, more physical pages are allocated by the OS, resulting in some notable memory growth. After some time, when the cache file is filled up, the memory usage of the server stabilizes and its behavior becomes identical to the memory usage of the server running without Galera. |