[MDEV-16838] Mariadb (with TokuDB) excessive memory usage/leak Created: 2018-07-27 Updated: 2019-10-10 Resolved: 2018-08-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Documentation, Storage Engine - TokuDB |
| Affects Version/s: | 10.3.7 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Marios Hadjieleftheriou | Assignee: | Ian Gilfillan |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | crash | ||
| Environment: |
Linux 4.9.0-5-amd64 #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 GNU/Linux |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
Same issue as After a couple of days and quite a bit of "load data infile", mysqld dies with out of memory (eventually consuming 1TB of RAM and 100GB of swap). We have several identical servers (load balanced), and they keep crashing with out of memory every couple of days one after the other. All our tables are using tokudb. Our cnf file is attached. |
| Comments |
| Comment by Marios Hadjieleftheriou [ 2018-07-27 ] | ||
|
We have a hunch that this is related to haproxy. In the general query log we see this every 2 seconds: When we had a single server with exactly the same install, the box was up and running fine for more than two weeks. Once we setup the replicas and started running haproxy, out of memory issues ensued. We will stop haproxy and see if that alleviates the problem, but this still sounds like a mysql memory leak (maybe connection related). | ||
| Comment by Marios Hadjieleftheriou [ 2018-07-28 ] | ||
|
We disabled haproxy and the problem did not go away. I realized that certain queries on very large tables (400 million rows) drive memory up quickly by several GBs, which are never released. A few consecutive invocations of such a query will crash mysqld. The query looks like this: | ||
| Comment by Marios Hadjieleftheriou [ 2018-08-04 ] | ||
|
We solved the issue by adding this to our cnf file:
We compiled MariaDB from source, with non-standard configuration files. The problem might have been self inflicted. Nevertheless, in MariaDB tokuDB plugin installation page, there is no mention that tokuDB requires jemalloc. I found this information on the Percona installation page. | ||
| Comment by Elena Stepanova [ 2018-08-04 ] | ||
|
greenman, | ||
| Comment by Ian Gilfillan [ 2018-08-06 ] | ||
|
libjemalloc is listed as a requirement upstream, so have added a note about it at https://mariadb.com/kb/en/library/installing-tokudb/. | ||
| Comment by Stefan Reger [ 2019-10-10 ] | ||
|
We have the same problem here with Debian Buster and libjemalloc2 (v5.1.0-3). If we switch to libjemalloc1 provided by the mariadb debian buster repository, it works fine (v3.6.0-9.1). Unfortunately the mariadb installation uses libjemalloc2 if this has already been installed before, so we have to manually switch to the older version. |