Repository navigation
Description
Describe the bug
A forced search reindex of one personal space repeatedly caused the OpenCloud server process to exhaust host memory and be killed. On the profiled run, the operation started at 17:55:06 UTC and exited with code 137 at 17:57:56 UTC on November 18, 2026. The kernel recorded a host-wide OOM and reported 9.0 GiB of anonymous RSS in the OpenCloud process. Docker restarted the container, and the reindex ended before completion.
Steps to reproduce
-
On the upgraded instance, target the affected personal space with its full
storage UUID$space UUIDidentifier. Client sync was paused during the test. -
Run a forced reindex of that space alone.
space_id='STORAGE_UUID$SPACE_UUID' docker compose exec -T opencloud opencloud search index \ --space "$space_id" --force-rescan --insecure
-
Monitor OpenCloud process RSS and available host memory during the scan.
Expected behavior
The forced reindex completes and OpenCloud continues serving requests. If the reindex cannot proceed, the command reports the failure while the server stays up.
Actual behavior
After a couple minutes successfully reindexing, OpenCloud memory usage suddenly grew unconstrained (>9GB) until the kernel killed it.
Setup
- OpenCloud 9.1.1 stable (
opencloudeu/opencloud:9.1.1), upgraded from 7.2.5 - Default embedded Bleve search backend, Apache Tika 4.2.0 in a separate container, and POSIX storage
- Docker Engine 29.6.2 on x86-64 Linux 6.8.0-106-generic
- 15.4 GiB RAM and 4 GiB swap on a shared host, with no Docker memory limit on OpenCloud or Tika
Additional context
I sampled /debug/pprof/heap roughly once a second without requesting a forced GC. The pre-run profile showed about 181 MiB in use. The last successful capture was at 17:57:38 UTC, with 2.7 GiB process RSS and about 1.29 GiB of sampled Go heap in use.
| Allocation site | In-use heap in last valid profile |
|---|---|
bleve/v2/analysis.TokenFrequency under bleve_index_api.AnalysisWorker |
579 MiB flat |
zapx/v17.(*invertedIndexOpaque).realloc |
300 MiB flat, 475 MiB cumulative |
The next profile request timed out. The kernel recorded the 9.0 GiB RSS at the kill roughly 17 seconds after the last valid profile, so that profile identifies major allocation sites during the climb and leaves the final spike unprofiled. The data does not establish whether the memory would have been released after a completed scan.
This resembles the TokenFrequency allocation stack reported in discussion #2033. This reproduction is on 9.1.1, whose release notes list the Bleve indexing memory fix from PR #3900. 9.1.1 release notes
Attachment travis-reindex-profiles.tar.gz contains the baseline and last valid heap profiles, go tool pprof summaries, the RSS and host memory timeline, the kernel OOM excerpt, and the reindex exit status.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Progress
Activity
aduffeck commentedon Nov 19, 2026
My initial suspicion was bleve segment merging causing the spike, but looking at the profiles it actually seems to be the analysis. The last heap profile shows almost all of the memory in Bleve's text analysis and in building the in-memory segment for the current indexing batch. My suspicion is that one or more files in that space extract to a large amount of text and a batch containing them blows up.
Could you check two things?
SEARCH_CONTENT_EXTRACTION_SIZE_LIMIT=10485760and see if it succeeds with that?pettijohn commentedon Nov 19, 2026
I'll try that. Extracting a large archive in memory is a plausible theory. Is there any way to enable logging such that I can see which file it's trying to index when it crashes?
aduffeck commentedon Nov 19, 2026
Yes, if you set
SEARCH_LOG_LEVEL=debugon the opencloud container, the search service logs a "Walking tree" line with the path of every file it processes. Documents are analyzed in batches of up to 50 though, so the last lines before the crash only narrow it down to the last batch.To pin it down to one file you can additionally set
SEARCH_BATCH_SIZE=1for this run, so every file is indexed on its own. Either outcome helps us:pettijohn commentedon Nov 19, 2026
I tested a forced reindex, twice, of the same personal space on OpenCloud 9.1.1 with the following settings.
Go profiling was disabled for these tests. The 10 MiB extraction limit did not prevent the OOM with the default batch size, and the OOM also reproduced with
SEARCH_BATCH_SIZE=1. The batch-size-one run exited with code137, and the kernel killed OpenCloud at about 9.2 GiB of anonymous RSS.The first batch-size-one trace had three relevant points:
AmericanFlag.pdn(9.7 MiB, Paint.NET)IMG_8972.JPG(118 KiB, JPEG)IMG_0003.jpg(2.8 MiB, JPEG)I sent
IMG_8972.JPGto the same Tika 4.2.0 server separately using/rmeta/text. The response was 7,877 bytes of JSON with one metadata record and no extracted text or title. The previous default-batch run stopped atMVI_0894.AVI, which exceeded the extraction limit. Its indexing call returned successfully in the batch-size-one run, after the steepest memory rise.In both scans, the sustained rise started while
AmericanFlag.pdnwas in progress, despite a different walk order. The sharpest part of the climb and the last logged file differed between the runs; the logs do not establish which operation was allocating the memory.I retried with the same batch-size-one settings. The same sequence repeated about 160 walk entries earlier than in the first batch-size-one run. Anonymous RSS rose from about 460 MiB to 1.5 GiB while
AmericanFlag.pdnwas in progress, then rose past 8 GiB duringIMG_8972.JPG. Both files finished indexing. The retry also indexedMVI_0894.AVIandIMG_0003.jpg, which had been the last logged files in the earlier runs.The retry stalled for about 9½ minutes while
IMG_2562.JPGwas in progress. OpenCloud reached 9.2 GiB of anonymous RSS, then dropped back below 600 MiB RSS and continued. Later spikes elsewhere in the space reached 6.9 and 7.9 GiB of anonymous RSS and also subsided. The command completed with exit code0after about 30 minutes, with 31,234 walk entries and no server restart during the retry.The repeatable rise around the same two files at different positions in the walk suggests that those files or nearby index work matter. The later spikes and drops show that memory can recover during the same scan. The logs still cannot distinguish one file's work from work already in flight.
Unfortunately I am not able to share the personal images/videos.