[Bug] Query is aborted since it requests more memory than can be allocated
- 主要语言
- Java
- 星标
- 6.4k
- 派生
- 1.2k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 115
描述
### Search before asking
- [x] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.
### Version
Iotdb:2.0.4-standalone official docker deployment
### Describe the bug and provide the minimal reproduce step
a query with 500 devices and group by 1d leads to:
`Query is aborted since it requests more memory than can be allocated, bytesToReserve: 2945552B, maxBytesCanReserve: 1159642B`
even though my On heap size is set to 200GB and the Off heap size is set to 30GB.
The instance has 256GB of available ram.
The 500 devices have 10 measurements with exactly one data point per day.
The query:
`select sum(*) from [path1,path2,...path500] group by ([2025-07-01T00:00:00, 2025-07-31T23:59:59), 1d)
`
same for
`select sum(*) from root.db.* group by ([2025-07-01T00:00:00, 2025-07-31T23:59:59), 1d)
`
docker-compose.yml setup:
```
version: "3"
services:
iotdb-service:
image: apache/iotdb:2.0.4-standalone
hostname: iotdb
container_name: iotdb
restart: always
ports:
- "6667:6667"
environment:
- cn_internal_address=iotdb
- cn_internal_port=10710
- cn_consensus_port=10720
- cn_seed_config_node=iotdb:10710
- dn_rpc_address=iotdb
- dn_internal_address=iotdb
- dn_rpc_port=6667
- dn_internal_port=10730
- dn_mpp_data_exchange_port=10740
- dn_schema_region_consensus_port=10750
- dn_data_region_consensus_port=10760
- dn_seed_config_node=iotdb:10710
privileged: true
volumes:
- /app/config/iotdb/conf:/iotdb/conf
- /app/data/iotdb/data:/iotdb/data
- /app/data/iotdb/logs:/iotdb/logs
networks:
iotdb:
ipv4_address: 172.18.0.6
networks:
iotdb:
external: true
```
iotdb startup log with info about memory:
> iotdb | setting local JMX...
> iotdb | DataNode on heap memory size = 200GB, off heap memory size = 30GB
> iotdb | If you want to change this configuration, please check conf/datanode-env.sh.
> iotdb | 2025-07-10 09:14:01,192 [main] INFO o.a.i.d.c.IoTDBDescriptor:225 - Start to read config file file:/iotdb/conf/iotdb-system.properties
> iotdb | 2025-07-10 09:14:01,218 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:203 - initial allocateMemoryForWrite = 64424509440
> iotdb | 2025-07-10 09:14:01,218 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:206 - initial allocateMemoryForRead = 64424509440
> iotdb | 2025-07-10 09:14:01,219 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:208 - initial allocateMemoryForSchema = 21474836480
> iotdb | 2025-07-10 09:14:01,219 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:211 - initial allocateMemoryForConsensus = 21474836480
> iotdb | 2025-07-10 09:14:01,219 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:214 - initial allocateMemoryForPipe = 21474836480
> iotdb | 2025-07-10 09:14:01,219 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:277 - allocateMemoryForSchemaRegion = 10737418240
> iotdb | 2025-07-10 09:14:01,219 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:280 - allocateMemoryForSchemaCache = 8589934592
> iotdb | 2025-07-10 09:14:01,219 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:282 - allocateMemoryForPartitionCache = 2147483648
> iotdb | 2025-07-10 09:14:01,245 [main] INFO o.a.t.c.c.TSFileDescriptor:136 - try loading iotdb-system.properties from /iotdb/conf/iotdb-system.properties
> iotdb | 2025-07-10 09:14:01,255 [main] INFO o.a.i.d.c.IoTDBDescriptor:1808 - MQTT host is not configured, will use dn_rpc_address.
> iotdb | 2025-07-10 09:14:01,269 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:203 - initial allocateMemoryForWrite = 64424509440
> iotdb | 2025-07-10 09:14:01,269 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:206 - initial allocateMemoryForRead = 64424509440
> iotdb | 2025-07-10 09:14:01,270 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:208 - initial allocateMemoryForSchema = 21474836480
> iotdb | 2025-07-10 09:14:01,270 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:211 - initial allocateMemoryForConsensus = 21474836480
> iotdb | 2025-07-10 09:14:01,270 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:214 - initial allocateMemoryForPipe = 21474836480
> iotdb | 2025-07-10 09:14:01,270 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:277 - allocateMemoryForSchemaRegion = 10737418240
> iotdb | 2025-07-10 09:14:01,270 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:280 - allocateMemoryForSchemaCache = 8589934592
> iotdb | 2025-07-10 09:14:01,270 [main] INFO o.a.i.d.c.DataNodeMemoryConfig:282 - allocateMemoryForPartitionCache = 2147483648
>
### What did you expect to see?
using more ram and execute this query
### What did you see instead?
an error with maxBytesCanReserve: 1159642B which seems to be way to small
### Anything else?
i already tried to set
IOTDB_MAX_QUERY_MEMORY_PER_FRAGMENT_INSTANCE and IOTDB_MAX_QUERY_MEMORY but this does not seem to have an effect
I also tried to disable enable_query_memory_estimation
it would be greatly appreciated if someone would have a clue about how to fix that
thanks in advance and i wish you all a good day!
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
贡献指南
调研方向
从 docker-compose.yml 设置、conf/datanode-env.sh、启动内存日志以及报告的 group-by 查询开始。复现该故障,并追踪为什么尽管配置了 heap、off-heap 和查询内存设置,maxBytesCanReserve 仍保持为 1159642B。配置行为得到理解,并且查询能够执行或问题得到明确诊断,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- docker, java
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100