[Bug] Query is aborted since it requests more memory than can be allocated
- Lingua principale
- Java
- Stelle
- 6.4k
- Fork
- 1.2k
- Merge medio
- 1g 23h
- PR unite (30g)
- 115
Descrizione
### 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!
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con la configurazione di docker-compose.yml, conf/datanode-env.sh, i log della memoria all’avvio e la query group-by segnalata. Riproduci il problema e traccia il motivo per cui maxBytesCanReserve rimane 1159642B nonostante le impostazioni configurate per heap, off-heap e memoria delle query. Il lavoro è concluso quando il comportamento della configurazione è compreso e la query viene eseguita, oppure il problema è chiaramente diagnosticato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- docker, java
- Ambito
- databases
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100