Skip to content

OpenCloud 9.1.1 is killed by the host OOM killer during a forced single-space Bleve reindex #4066

In review

Description

@pettijohn

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

  1. On the upgraded instance, target the affected personal space with its full storage UUID$space UUID identifier. Client sync was paused during the test.

  2. 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
  3. 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.

travis-reindex-profiles.tar.gz

Activity

  1. moved this from Qualification to Prio 2 in OpenCloud Team Boardon Nov 19, 2026
  2. aduffeck commented on Nov 19, 2026

    @aduffeck
    Member

    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?

    1. Are there particular big or text-heavy files in that space like archives, spreadsheets, or big PDFs?
    2. Can you try setting a smaller content extraction limit? The default is 20MB, so maybe try half of that by setting SEARCH_CONTENT_EXTRACTION_SIZE_LIMIT=10485760 and see if it succeeds with that?
  3. pettijohn commented on Nov 19, 2026

    @pettijohn
    Author

    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?

  4. aduffeck commented on Nov 19, 2026

    @aduffeck
    Member

    Yes, if you set SEARCH_LOG_LEVEL=debug on 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=1 for this run, so every file is indexed on its own. Either outcome helps us:

    • If it still runs out of memory, the last "Walking tree" line before the crash is the file causing it. Knowing its type and size would be very helpful.
    • If the reindex completes, the problem is the combination of documents being indexed together in one batch rather than one particular file.
  5. self-assigned this
    on Nov 19, 2026
  6. moved this from Prio 2 to In Progress in OpenCloud Team Boardon Nov 19, 2026
  7. pettijohn commented on Nov 19, 2026

    @pettijohn
    Author

    I tested a forced reindex, twice, of the same personal space on OpenCloud 9.1.1 with the following settings.

    SEARCH_LOG_LEVEL: debug
    SEARCH_CONTENT_EXTRACTION_SIZE_LIMIT: 10485760
    SEARCH_BATCH_SIZE: 1

    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 code 137, and the kernel killed OpenCloud at about 9.2 GiB of anonymous RSS.

    The first batch-size-one trace had three relevant points:

    File Observation
    AmericanFlag.pdn (9.7 MiB, Paint.NET) Anonymous RSS was already rising while this file was in progress. Its indexing call returned.
    IMG_8972.JPG (118 KiB, JPEG) Anonymous RSS climbed from about 1.5 GiB to 8.7 GiB during the roughly four seconds between the walk log and the return from indexing this file. The scan then continued.
    IMG_0003.jpg (2.8 MiB, JPEG) This was the last path logged. Anonymous RSS was already about 9.1 GiB before the walker reached it.

    I sent IMG_8972.JPG to 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 at MVI_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.pdn was 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.pdn was in progress, then rose past 8 GiB during IMG_8972.JPG. Both files finished indexing. The retry also indexed MVI_0894.AVI and IMG_0003.jpg, which had been the last logged files in the earlier runs.

    The retry stalled for about 9½ minutes while IMG_2562.JPG was 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 code 0 after 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions