[Bug] Query is aborted since it requests more memory than can be allocated
- 主要言語
- Java
- スター
- 6.4k
- フォーク
- 1.2k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 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、query-memory の設定にもかかわらず maxBytesCanReserve が 1159642B のままになる理由を追跡します。設定の動作を理解し、クエリが実行されるか、問題が明確に診断できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- docker, java
- 領域
- databases
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100