一个语句导致服务器内存耗尽,该设置什么参数限制nebula最大内存呢

版本 3.5.0,单机
执行下面语句:

MATCH p=(v:city)-[:railway*1..10]->(v) RETURN p

执行了至少10分钟没出结果。这时执行LINUX命令报错:

[nebula@test-86 ~]$ top
-bash: fork: 无法分配内存

CTRL+C终止查询,等一会LINUX恢复正常,查看nebula服务状态,发现nebula-graphd挂了:

[one@test-86 ~]$ sudo /nebula/nebula-graph-3.5.0.el7.x86_64/scripts/nebula.service status all
[WARN] The maximum files allowed to open might be too few: 1024
[INFO] nebula-metad(18fd7b1): Running as 18220, Listening on 9559
[INFO] nebula-graphd(18fd7b1): Exited
[INFO] nebula-storaged(18fd7b1): Running as 18355, Listening on 9779
[one@test-86 ~]$ 

问题是怎么限制nebula的最大内存避免出现这种情况。

先解决下 Linux 系统的文件打开问题,可以参考 CSDN 的这个文章:关于open file limit问题解决_configuration of maximum open file limit is too lo-CSDN博客

你的版本是 3.5 的话支持 memory tracker 功能了,你可以了解下它的使用:https://docs.nebula-graph.com.cn/3.5.0/20.appendix/0.FAQ/#-1005graphmemoryexceeded_-2600

谢谢回复。我测试了下,在3.5中memory tracker 不起作用,在3.6中同样数据同样的语句是报错终止,如下:
[ERROR (-1005)]: GraphMemoryExceeded: (-2600)

你的 memory tracker 是咋设置的呢?

默认设置,我比较了相关参数,3.5和3.6的设置一样。

抱歉,回复迟了,:thinking: 现在的设置是什么?

配置是这样(3.5、3.6一样):

[nebula@nebulagraph1 nebula]$ grep memory_tracker /nebula/nebula-graph-3.5.0.el7.x86_64/etc/*.conf 
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-graphd.conf:--memory_tracker_limit_ratio=0.8
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-graphd.conf:--memory_tracker_untracked_reserved_memory_mb=50
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-graphd.conf:--memory_tracker_detail_log=false
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-graphd.conf:--memory_tracker_detail_log_interval_ms=60000
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-storaged.conf:--memory_tracker_limit_ratio=0.8
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-storaged.conf:--memory_tracker_untracked_reserved_memory_mb=50
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-storaged.conf:--memory_tracker_detail_log=false
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-storaged.conf:--memory_tracker_detail_log_interval_ms=60000
[nebula@nebulagraph1 nebula]$ grep memory_purge /nebula/nebula-graph-3.5.0.el7.x86_64/etc/*.conf 
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-graphd.conf:--memory_purge_enabled=true
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-graphd.conf:--memory_purge_interval_seconds=10
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-storaged.conf:--memory_purge_enabled=true
/nebula/nebula-graph-3.5.0.el7.x86_64/etc/nebula-storaged.conf:--memory_purge_interval_seconds=10