Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug] IotDB pods crash with OOM because we calculate the memory based on the node not pod resources

未关闭
#17,764 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
java, shell
领域
databases, devops

调研方向

从 conf/confignode-env.sh 和 conf/datanode-env.sh 开始,重点检查使用 free -m 进行的 system_memory_in_mb 计算。比较 issue 中描述的 cgroup v2 和 v1 内存限制情况,然后验证限制为 8 GB 的 pod 是否根据该限制而不是主机内存来确定 JVM 大小,并避免因 OOM 重启。

由索引模型根据 Issue 内容生成。

描述

Search before asking
  • I searched in the issues and found nothing similar.
Version

latest

Describe the bug and provide the minimal reproduce step

Start IOTDB datanode and confignode pods with memory limits, for example 8 GB, and allocate 8 GB of resources to each pod.

Image

Pods keep crashing with OOM errors because the JVM is trying to allocate 16 GB of memory.

What did you expect to see?
            # When running in a container/pod, use cgroup memory limit instead of host memory
            if [ -f /sys/fs/cgroup/memory.max ]; then
                # cgroup v2
                cgroup_mem=`cat /sys/fs/cgroup/memory.max`
                if [ "$cgroup_mem" != "max" ]; then
                    cgroup_mem_in_mb=`expr $cgroup_mem / 1024 / 1024`
                    if [ "$cgroup_mem_in_mb" -lt "$system_memory_in_mb" ]; then
                        system_memory_in_mb=$cgroup_mem_in_mb
                    fi
                fi
            elif [ -f /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then
                # cgroup v1
                cgroup_mem=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes`
                cgroup_mem_in_mb=`expr $cgroup_mem / 1024 / 1024`
                if [ "$cgroup_mem_in_mb" -lt "$system_memory_in_mb" ]; then
                    system_memory_in_mb=$cgroup_mem_in_mb
                fi
            fi

8GB

I would expect the memory to be auto-calculated based on the pod resources (8 GB), not the node resources (32 GB).

# scripts\conf\datanode-env.sh
system_memory_in_mb=`free -m | sed -n '2p' | awk '{print \$2}'` returns 32 GB.
What did you see instead?

32 GB and a lot of pod restarts

Anything else?
# iotdb\WORKING_CONFIGS.md

## 2) JVM Memory (Linux)

Edit these files:
- conf/confignode-env.sh
- conf/datanode-env.sh

Set MEMORY_SIZE explicitly to avoid auto-sizing surprises.

### ConfigNode memory

```bash
# conf/confignode-env.sh
MEMORY_SIZE=2G
DataNode memory
# conf/datanode-env.sh
MEMORY_SIZE=8G

Why are there no env varibales for this setting?
Do you expect the clouad env to manualy go and change this limit?

This is a hack, and we should not have to do this in a pod

- IOTDB_JMX_OPTS=-Xmx4G
Are you willing to submit a PR?
  • I'm willing to submit a PR!
主要语言
Java
星标
6.4k
派生
1.2k
平均合并
1 天 17 小时
30 天内合并 PR
152

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/iotdb 的其他 Issue

查看 apache/iotdb 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。