apache / apache/iotdb

[Bug] Query is aborted since it requests more memory than can be allocated

Open
#15,906 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.4k
Forks
1.2k
Avg merge
1d 23h
Merged PRs (30d)
115

Description

### 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!

Contributor guide

Open the contributing guide

Research direction

Start with the docker-compose.yml setup, conf/datanode-env.sh, the startup memory logs, and the reported group-by query. Reproduce the failure and trace why maxBytesCanReserve remains 1159642B despite the configured heap, off-heap, and query-memory settings. Done means the configuration behavior is understood and the query executes or the issue is clearly diagnosed.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.