nextcloud / nextcloud/files_fulltextsearch
ELASTICSEARCH_HEAP_SIZE on mastercontainer fails to set Elasticsearch child container heap size, stuck at 512MB causing OOM
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 72
- Forks
- 41
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 9
Description
Problem Description:
According to the official Nextcloud AIO documentation (Containers.md#elasticsearch), it should be possible to adjust the JVM heap size of the Elasticsearch child container by setting the ELASTICSEARCH_HEAP_SIZE environment variable on the nextcloud-aio-mastercontainer. However, testing reveals that regardless of how this variable is set (e.g., to 4g), the ES_JAVA_OPTS environment variable in a newly created nextcloud-aio-fulltextsearch container is consistently fixed at -Xms512M -Xmx512M. This causes Elasticsearch to crash frequently due to insufficient memory (java.lang.OutOfMemoryError: Java heap space), rendering the full-text search feature unusable.
Expected Behavior:
When the nextcloud-aio-mastercontainer is started with, for example, --env ELASTICSEARCH_HEAP_SIZE=4g, the nextcloud-aio-fulltextsearch container it creates should receive the corresponding heap memory configuration (e.g., ES_JAVA_OPTS should reflect -Xms4g -Xmx4g or an equivalent configuration).
Actual Behavior:
- The
nextcloud-aio-mastercontainer's environment variables are confirmed to includeELASTICSEARCH_HEAP_SIZE=4g(verified viaConfig.Envfromdocker inspect nextcloud-aio-mastercontainer). - Even after deleting the old
nextcloud-aio-fulltextsearchcontainer, a newnextcloud-aio-fulltextsearchcontainer recreated by the aforementioned mastercontainer still hasES_JAVA_OPTSset to-Xms512M -Xmx512Min itsConfig.Env(verified viadocker inspect nextcloud-aio-fulltextsearch). - Logs from the
nextcloud-aio-fulltextsearchcontainer confirm its JVM heap size is 512MB, and it exits due tojava.lang.OutOfMemoryError: Java heap space. - The Nextcloud AIO admin interface does not offer an option to adjust the Elasticsearch JVM heap size.
Steps to Reproduce:
- Stop and remove any existing
nextcloud-aio-mastercontainerandnextcloud-aio-fulltextsearchcontainers.sudo docker stop nextcloud-aio-mastercontainer sudo docker rm nextcloud-aio-mastercontainer sudo docker rm nextcloud-aio-fulltextsearch - Start the
nextcloud-aio-mastercontainerwith the following command (usingELASTICSEARCH_HEAP_SIZE=4gas an example, and/home/ncdataas the data directory):sudo docker run \ --init \ --sig-proxy=false \ --name nextcloud-aio-mastercontainer \ --restart always \ --publish 80:80 \ --publish 8080:8080 \ --publish 8443:8443 \ --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \ --volume /var/run/docker.sock:/var/run/docker.sock:ro \ --env NEXTCLOUD_DATADIR="/home/ncdata" \ --env ELASTICSEARCH_HEAP_SIZE=4g \ ghcr.io/nextcloud-releases/all-in-one:latest - Wait for the
nextcloud-aio-mastercontainerto start and create thenextcloud-aio-fulltextsearchcontainer. - Inspect the environment variables of the
nextcloud-aio-mastercontainer:
(Verify thatsudo docker inspect nextcloud-aio-mastercontainerELASTICSEARCH_HEAP_SIZE=4gis present inConfig.Env) - Inspect the environment variables of the newly created
nextcloud-aio-fulltextsearchcontainer:
(Observe thatsudo docker inspect nextcloud-aio-fulltextsearchES_JAVA_OPTSinConfig.Envis still-Xms512M -Xmx512M) - Check the logs of the
nextcloud-aio-fulltextsearchcontainer:
(Observe the reportedsudo docker logs nextcloud-aio-fulltextsearchheap sizeon startup and any OOM errors)
Environment Details:
- Nextcloud AIO Version:
ghcr.io/nextcloud-releases/all-in-one:latest(as of 2025-06-03) - Docker Version:
Docker version 28.2.2, build e6534b4 - Host Operating System:
Ubuntu 24.04 LTS - Relevant Documentation: Nextcloud AIO Containers Documentation - Elasticsearch
Impact:
Due to the inability to correctly configure Elasticsearch's memory, the full-text search feature cannot operate stably. The Elasticsearch container continuously crashes due to OutOfMemoryError, impacting system stability and generating numerous error logs. This effectively makes the documented feature for adjusting Elasticsearch memory unusable.
Relevant Log Snippets:
nextcloud-aio-fulltextsearchOOM error log snippet:java.lang.OutOfMemoryError: Java heap space Dumping heap to data/java_pidXX.hprof ... Terminating due to java.lang.OutOfMemoryError: Java heap space ERROR: Elasticsearch exited unexpectedly, with exit code 3nextcloud-aio-fulltextsearchJVM arguments on startup (fromdocker logs ...):{"@timestamp":"...","message":"JVM arguments [..., -Xms512M, -Xmx512M, ...]"} {"@timestamp":"...","message":"heap size [512mb]..."}- Key part of
Config.Envfromdocker inspect nextcloud-aio-fulltextsearch:"Env": [ // ... "ES_JAVA_OPTS=-Xms512M -Xmx512M", // ... ]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the mastercontainer code path that creates nextcloud-aio-fulltextsearch, and compare its environment handling with Containers.md#elasticsearch. Reproduce the issue with ELASTICSEARCH_HEAP_SIZE=4g, then verify with docker inspect and container logs that the child container receives the requested heap settings and no longer remains fixed at 512MB.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, elasticsearch, php
- Domain
- backend, devops, search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100