Bug #86482 | innodb leaks memory, performance_schema file_instances #sql-ib3129987-252773.ibd | ||
---|---|---|---|
Submitted: | 27 May 2017 7:54 | Modified: | 19 Oct 2017 17:49 |
Reporter: | Shane Bester (Platinum Quality Contributor) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Performance Schema | Severity: | S1 (Critical) |
Version: | 5.7 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | file_instances, Leak, memory leak |
[27 May 2017 7:54]
Shane Bester
[27 May 2017 7:59]
MySQL Verification Team
Testcase starts like: +-----------+------------------------+--------------------+--------------+-----------------------+-----------------+ | iteration | when | duration(HH:mm:ss) | total memory | file_instances memory | ibtmp instances | +-----------+------------------------+--------------------+--------------+-----------------------+-----------------+ | 1 | 2017-05-27 09:55:48.49 | 00:00:23 | 150509064 | 2883584 | 500 | +-----------+------------------------+--------------------+--------------+-----------------------+-----------------+ 1 row in set (23.20 sec) After a short while we see : +-----------+------------------------+--------------------+--------------+-----------------------+-----------------+ | iteration | when | duration(HH:mm:ss) | total memory | file_instances memory | ibtmp instances | +-----------+------------------------+--------------------+--------------+-----------------------+-----------------+ | 8 | 2017-05-27 09:58:47.97 | 00:03:22 | 153392744 | 5767168 | 4000 | +-----------+------------------------+--------------------+--------------+-----------------------+-----------------+ 1 row in set (3 min 22.68 sec)
[27 May 2017 8:17]
MySQL Verification Team
Maybe the autosized performance_schema_max_file_instances is not optimal?
[27 May 2017 8:23]
MySQL Verification Team
https://dev.mysql.com/doc/refman/5.7/en/performance-schema-memory-model.html "As the Performance Schema collects data, memory is allocated in the corresponding buffer. The buffer size is unbounded, and may grow with the load." So, the default setup allows unbounded memory growth? That's not very kind..
[14 Jun 2017 19:37]
MySQL Verification Team
similar issue for replication slaves who process many relay logs... mysql> select count(*) from performance_schema.file_instances where file_name like '%relay%' ; +----------+ | count(*) | +----------+ | 9153 | +----------+ 1 row in set (0.03 sec)
[14 Jul 2017 4:57]
MySQL Verification Team
workaround is to set the my.cnf variable performance_schema_max_file_instances to a reasonable number such as 10000 or 20000 or so (if you're seeing it going too high).
[19 Oct 2017 17:49]
Paul DuBois
Posted by developer: Fixed in 5.7.21, 8.0.4, 9.0.0. The Performance Schema could leak memory due to nondeletion of file instances created for ALTER TABLE operations that used the table-copy algorithm.