温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

【MYSQL】mysql5.7-bug -information_schema的表被查询可能导致内存泄漏

发布时间:2020-08-11 07:23:38 来源:ITPUB博客 阅读:188 作者:小亮520cl 栏目:MySQL数据库


  1. [11 May 2017 6:57] Cho-Shing Ma
  2. Description:
  3. Running a query (on Information _Schema.tables (where clause) to exclude system schema, showing memory growing eventually Out-of-memory. Number of table entries around 20,000 (40 databases with 500 tables for each db)

  4. mysql -uroot -h227.0.0.1 -e "select concat_ws('|',ifnull(TABLE_SCHEMA,''),ifnull(TABLE_NAME,''),ifnull(ENGINE,''),ifnull(TABLE_ROWS,'0'),ifnull(DATA_LENGTH,'0'), ifnull(INDEX_LENGTH,'0'),ifnull(DATA_FREE,'0'), ifnull(TABLE_COLLATION,''),ifnull(CREATE_TIME,''), ifnull(UPDATE_TIME,'')) from information_schema.TABLES where TABLE_SCHEMA not in ('mysql','test','information_schema','performance_schema','sys');"

  5. How to repeat:
  6. Please refer to attached document.

  7. table_definition_cache=10000
  8. table_open_cache =10000
  9. innodb_open_files=10000
  10. open_files_limit=10000

  11. run the sql query every second and record the memory growing from OS and the mysqld.

  12. mysql -uroot -h227.0.0.1 -e "select concat_ws('|',ifnull(TABLE_SCHEMA,''),ifnull(TABLE_NAME,''),ifnull(ENGINE,''),ifnull(TABLE_ROWS,'0'),ifnull(DATA_LENGTH,'0'), ifnull(INDEX_LENGTH,'0'),ifnull(DATA_FREE,'0'), ifnull(TABLE_COLLATION,''),ifnull(CREATE_TIME,''), ifnull(UPDATE_TIME,'')) from information_schema.TABLES where TABLE_SCHEMA not in ('mysql','test','information_schema','performance_schema','sys');"

  13. Suggested fix:
  14. No idea but the memory is growing.


         日前,作者遇到一个疑似“内存”泄露的问题,一时找不头绪,然后就从mysql的官方上找线索,发现了上面的bug(见上图,bug id 86279 ),查询information_schema下的tables表导致内存溢出。 经动手简单测试,貌似还真有这回事。 同理,该schema下的其他的一下表,可能也存在这个问题。

         对于表数量特别多的系统,可能更需要慎重。 但也无须惊慌,上面写的重现现象是重复查询,然后内存逐步增长,最终OOM.

         

         以上信息仅供各位朋友参考!!!



percona 5.7 

  1. https://bugs.launchpad.net/percona-server/+bug/1693511 --performance占用大量内存--10G左右稳定下来

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI