mysql never realase memory

Bug #1710146 reported by peter zasada
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mysql-5.7 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Mysql gradually consumes memory . The memory is never released back to OS . The easiest way to reproduce the issue is run few mysqldumps and observe memory usage.
I used :
mysqldump DB1 > /dev/null &

About 5-6 times.
After dumps are completed mysql do not release memory and continue to consume even more memory.
Mysqld process uses all system memory, then starts to use swap memory up to the point where the database is killed by OOM errors.

here is memory usage after few mysqldumps commands :

ps -aux | grep mysql
mysql 607 0.7 49.0 1769788 1005184 ? Ssl Aug10 10:50 /usr/sbin/mysqld

1GB on a system with 128MB innodb buffer pool. Performance schema does not report any issues and states that myslq is taking only around 400MB .

The issue seems to be related to the default memory allocation library malloc. Installing jemmalloc and forcing jemmalloc in mysql conf seems to resolve this issue .
I used the same method as described before and memory usage looks stable :

ps uax | grep mysql
mysql 1540 5.9 23.4 957244 481036 ? Ssl 12:59 4:38 /usr/sbin/mysqld

Same issue and workaround was reported on mysql bug forum by Machiel Richards .

lsb_release -rd
Description: Ubuntu 16.04.2 LTS
Release: 16.04

mysql-server:
  Installed: 5.7.19-0ubuntu0.16.04.1
  Candidate: 5.7.19-0ubuntu0.16.04.1
  Version table:
 *** 5.7.19-0ubuntu0.16.04.1 500
        500 http://de.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
        100 /var/lib/dpkg/status
     5.7.11-0ubuntu6 500
        500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-5.7 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.