Skip to content

[Bug]: 2 proxies were crashed by OOM during statbility test on distributed mode  #17757

Closed

Description

@aressu1985

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

e0d0d00

Other Environment Information

- Hardware parameters:
3*CN: 16C 64G
1*DN: 16C 64G
3*LOG: 4C 16G
3*PROXY 3C 7G
- OS type:
- Others:

Actual Behavior

2 proxies were crashed by OOM during statbility test on distributed mode
image

resource dashbaord:

https://shanghai.idc.matrixorigin.cn:30001/d/85a562078cdf77779eaa1add43ccec1e/kubernetes-compute-resources-namespace-pods?orgId=1&var-datasource=prometheus&var-cluster=&var-namespace=mo-e0d0d00-202407262258&from=1722002230597&to=1722063021780

mo-log:
https://shanghai.idc.matrixorigin.cn:30001/explore?panes=%7B%227BO%22:%7B%22datasource%22:%22loki%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22mo-e0d0d00-202407262258%5C%22%7D%20%7C%3D%20%60%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22loki%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%221722002230597%22,%22to%22:%221722063021780%22%7D%7D%7D&schemaVersion=1&orgId=1

Expected Behavior

No response

Steps to Reproduce

1. run a mo cluster with config in this issue
2. run tpch 10G loop test processes in one independant tenant
3. run tpcc 10 warehouse and 10 ternimals longrunnig test processes in one independant tenant, prepare mode
4. run sysbench mixed cases(insert/delete/update/select) longrunnig test processes with 75 terminals in one independant tenant,non-prepare mode
5. run another sysbench mixed cases(insert/delete/update/select) longrunnig test processe with  75 terminals in one independant tenant,non-prepare mode

Additional information

No response

Activity

  1. added this to the 1.3.0 milestone on Jul 27, 2024
  2. volgariver6 commented on Jul 29, 2024

    @volgariver6
    Contributor

    从日志看不出来问题,需要在环境中加上proxy的heap profile,麻烦 @guguducken 配置一下

  3. volgariver6 commented on Jul 30, 2024

    @volgariver6
    Contributor

    改了配置,正在重新跑测试

  4. volgariver6 commented on Aug 1, 2024

    @volgariver6
    Contributor

    还是有oom发生,需要主动的将heap导出来查看了。

  5. volgariver6 commented on Aug 2, 2024

    @volgariver6
    Contributor

    正在跑测试

  6. volgariver6 commented on Aug 5, 2024

    @volgariver6
    Contributor

    找到问题原因了,堆外内存使用之后没有释放。

    1. 把debug端口映射到本地:

      kubectl -n mo-d73f1c2-202408031024 port-forward stability-regression-dis-proxy-mmn8n 6069:6060
      
    2. 获取当前内存使用情况

      go tool pprof http://localhost:6069/debug/malloc
      
    3. 运行 top 30 查看堆外内存使用

    image

    1. 结合代码做分析,找到问题,主要是 frontend.NewIOSession() 方法中申请的对外内存没有释放。解决办法是在 proxy 的 client conn 和server conn close 方法中释放内存。
  7. volgariver6 commented on Aug 6, 2024

    @volgariver6
    Contributor

    fixed

  8. 2 remaining items

  9. volgariver6 commented on Aug 8, 2024

    @volgariver6
    Contributor

    已提交新的pr修复

  10. volgariver6 commented on Aug 9, 2024

    @volgariver6
    Contributor

    等待pr合并

  11. aressu1985 commented on Aug 12, 2024

    @aressu1985
    ContributorAuthor

    问题尚未解决,需要继续查看

  12. xzxiong commented on Aug 12, 2024

    @xzxiong
    Contributor

    new case:

    https://shanghai.idc.matrixorigin.cn:30001/d/85a562078cdf77779eaa1add43ccec1e/kubernetes-compute-resources-namespace-pods?orgId=1&var-datasource=prometheus&var-cluster=&var-namespace=mo-c2fa177-202408102118&from=now-24h&to=now&refresh=10s

    企业微信截图_722c4e20-ac76-40ac-8fee-24c4589ae5dc

    针对该问题,增加 meric 进行观测,基本确定:

    • 由于写 sql 失败(并且延迟大),导致mometric 的请求堆积,导致申请过多内存
    • 如下图,Collector queue 中 metric 的队列一直在增长。(dashboard: Trace Metric)

    debug 代码, https://github.com/xzxiong/matrixone/tree/5243eadcbcc94399b26120e238f237d97a6e38b6
    image

  13. xzxiong commented on Aug 13, 2024

    @xzxiong
    Contributor

    new case:

    https://shanghai.idc.matrixorigin.cn:30001/d/85a562078cdf77779eaa1add43ccec1e/kubernetes-compute-resources-namespace-pods?orgId=1&var-datasource=prometheus&var-cluster=&var-namespace=mo-c2fa177-202408102118&from=now-24h&to=now&refresh=10s
    [image] ...

    针对该问题,增加 meric 进行观测,基本确定:

    • 由于写 sql 失败(并且延迟大),导致mometric 的请求堆积,导致申请过多内存
    • 如下图,Collector queue 中 metric 的队列一直在增长。(dashboard: Trace Metric)

    debug 代码, https://github.com/xzxiong/matrixone/tree/5243eadcbcc94399b26120e238f237d97a6e38b6
    [image] ...

    #18081 针对这里 metric req 堆积的问题,增加 backoff 策略:当metric queue 中请求数操作 > 8 (根据配置计算)时,跳过 sql flush的操作,直接执行 csv flush

  14. volgariver6 commented on Aug 14, 2024

    @volgariver6
    Contributor

    #18081 已经提交处理OOM的问题

    #18099 将 malloc 的heap文件也保存到etl中,如果再出现oom,再分析一下malloc的heap

  15. volgariver6 commented on Aug 15, 2024

    @volgariver6
    Contributor

    找到最后泄漏的地方,提交pr修复

  16. volgariver6 commented on Aug 16, 2024

    @volgariver6
    Contributor

    image
    proxy 运行内存zhan占用平稳,没有泄漏了

  17. aressu1985 commented on Aug 19, 2024

    @aressu1985
    ContributorAuthor

    fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugphase/testingseverity/s-1

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions