[GH-ISSUE #5411] [Engine] Repeated start/stop leaves ~178 GiB on anonymous LRU and eventually freezes the host #3231

Open
opened 2026-11-07 14:39:02 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @hualiyexi on GitHub (Nov 6, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5411

Area: Engine

Problem

After several Strata engine start/stop cycles, large amounts of anonymous memory remain on the kernel LRU lists after all Strata processes have exited. The memory does not return to baseline, eventually exhausting swap and freezing the host.

Environment

  • Strata: v0.2.11
  • Engine: build 0.1.57, cuda13
  • OS: Ubuntu 24.04
  • Kernel: 6.11.0-24-generic
  • CPU/RAM: AMD EPYC 9554, approximately 235.6 GiB RAM
  • GPUs: 3× NVIDIA RTX 4090 D, 24 GiB VRAM each
  • NVIDIA driver: 595.91.07
  • Models: Qwen3.8-Flash-Next, UD-Q4_K_XL and IQ3_S GGUF
  • Execution modes tested: layer split across 2 or 3 GPUs, MTP drafting
  • Relevant settings: KV streaming/pinned host memory, --kv-resident 32768; KV formats used during the affected test session included int8, k8v4, and q4_0

One affected two-GPU preset resolved to:

model=IQ3_S
gpus=0,1
context=131072
kv=int8
drafting=mtp
parallel=4
port=8001

The three-GPU configuration used gpus=0,1,2, context=262144, kv=k8v4, and parallel=8.

Reproduce

  1. Start the engine using one of the affected presets:

    strata launch --preset iq3s-2card-p4-int8-c128k --no-tui --yes
    
  2. Wait for the model to become ready and issue several generation requests.

  3. Stop the engine:

    strata launch --stop --preset iq3s-2card-p4-int8-c128k
    
  4. Confirm that the Strata processes have exited and that nvidia-smi reports no compute applications.

  5. Record the anonymous-memory counters:

    grep -E 'Active\(anon\)|Inactive\(anon\)|AnonPages|Shmem|SwapFree' /proc/meminfo
    

    Also record memory.current and memory.stat for the cgroup from which Strata was launched.

  6. Repeat the start/stop cycle several times and compare the counters with the pre-launch baseline.

On this host, the launching cgroup was:

/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/app-zcode-20684.scope

The cgroup path will differ on other systems.

Expected

When the engine exits, all host pages allocated or pinned for KV streaming and expert arenas should be released. Active(anon), Inactive(anon), and the launching cgroup's memory.current should return approximately to their pre-launch values without requiring a reboot.

Actual

The anonymous LRU counters remain elevated after the engine and its CUDA contexts disappear. Repeating start/stop cycles accumulates more retained memory.

During the eventual memory-exhaustion event, the kernel reported order-7 and order-9 page-allocation failures in the strata process. Available swap fell to 56 kB, followed by multiple Cannot map memory messages. The host subsequently froze and required a hard reboot.

Evidence

Memory accounting after engine exit

On 2026-11-07, with no Strata process running:

Active(anon):       115983548 kB
Inactive(anon):      70385968 kB
Combined:           186369516 kB (~177.7 GiB)
AnonPages:           11821784 kB (~11.3 GiB)
Shmem:                 189928 kB
SwapTotal:                  8 GiB
SwapFree:                ~1.5 GiB

The launching cgroup contained:

memory.current                 208787025920 bytes (~194.4 GiB)
memory.stat:anon                  501161984 bytes (~478 MiB)
memory.stat:active_anon        110345801728 bytes
memory.stat:inactive_anon       68700590080 bytes
memory.stat:file               29293252608 bytes
memory.stat:kernel               515670016 bytes
memory.swap.current              616566784 bytes

Thus, only about 478 MiB remained as mapped anonymous memory in that cgroup, while approximately 166.8 GiB remained on its active/inactive anonymous LRU lists. cgroup.procs contained only the desktop/ZCode tooling used to launch the tests, with no Strata process.

These counters do not by themselves prove generic “kernel-space memory usage.” The significant observation is that the pages no longer have corresponding userspace mappings but remain allocated on the anonymous LRU lists and charged to the launching cgroup.

Kernel stack from the memory-exhaustion event

journalctl -k -b captured the following path during the order-7/order-9 allocation failures:

strata: page allocation failure

check_and_migrate_movable_pages
__gup_longterm_locked
pin_user_pages
os_lock_user_pages+0xb5/0x1c0 [nvidia]
RmCreateOsDescriptor+0x99/0x180 [nvidia]
RmIoctl+0xc2c/0xda0 [nvidia]
rm_ioctl [nvidia]
nvidia_unlocked_ioctl [nvidia]

This directly connects the affected host-memory allocations to NVIDIA's long-term page-pinning path.

The remaining ownership question is whether Strata is missing a pinned-host-allocation release on some normal/error/exit paths, or whether the NVIDIA driver is failing to release all page pins during final client cleanup. The current evidence does not conclusively assign the defect to only one of those layers.

Other checks

  • /dev/shm was empty and Shmem was only about 0.2 GiB.
  • nvidia-smi --query-compute-apps showed no compute processes after engine exit.
  • Only Xorg remained visible as an NVIDIA graphics client, using 4 MiB per GPU.
  • drop_caches and compact_memory did not release the retained anonymous pages.
  • A cgroup memory.reclaim probe reclaimed file cache but did not reduce the total active/inactive anonymous memory. Approximately 35.8 GiB merely moved between inactive_anon and active_anon.
  • Killing the remaining launcher processes or removing the cgroup would not constitute a safe way to force-release pages that may still carry driver references.

Full sanitized meminfo, cgroup statistics, and kernel allocation-failure logs can be provided if needed.

Reproduction status

Reproduced locally through repeated Strata start/stop cycles on the host described above. This is an observed runtime issue, not a code-only or scanner-derived finding.

Originally created by @hualiyexi on GitHub (Nov 6, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5411 **Area:** Engine ## Problem After several Strata engine start/stop cycles, large amounts of anonymous memory remain on the kernel LRU lists after all Strata processes have exited. The memory does not return to baseline, eventually exhausting swap and freezing the host. ## Environment - **Strata:** v0.2.11 - **Engine:** build 0.1.57, cuda13 - **OS:** Ubuntu 24.04 - **Kernel:** 6.11.0-24-generic - **CPU/RAM:** AMD EPYC 9554, approximately 235.6 GiB RAM - **GPUs:** 3× NVIDIA RTX 4090 D, 24 GiB VRAM each - **NVIDIA driver:** 595.91.07 - **Models:** Qwen3.8-Flash-Next, UD-Q4_K_XL and IQ3_S GGUF - **Execution modes tested:** layer split across 2 or 3 GPUs, MTP drafting - **Relevant settings:** KV streaming/pinned host memory, `--kv-resident 32768`; KV formats used during the affected test session included `int8`, `k8v4`, and `q4_0` One affected two-GPU preset resolved to: ```text model=IQ3_S gpus=0,1 context=131072 kv=int8 drafting=mtp parallel=4 port=8001 ``` The three-GPU configuration used `gpus=0,1,2`, `context=262144`, `kv=k8v4`, and `parallel=8`. ## Reproduce 1. Start the engine using one of the affected presets: ```bash strata launch --preset iq3s-2card-p4-int8-c128k --no-tui --yes ``` 2. Wait for the model to become ready and issue several generation requests. 3. Stop the engine: ```bash strata launch --stop --preset iq3s-2card-p4-int8-c128k ``` 4. Confirm that the Strata processes have exited and that `nvidia-smi` reports no compute applications. 5. Record the anonymous-memory counters: ```bash grep -E 'Active\(anon\)|Inactive\(anon\)|AnonPages|Shmem|SwapFree' /proc/meminfo ``` Also record `memory.current` and `memory.stat` for the cgroup from which Strata was launched. 6. Repeat the start/stop cycle several times and compare the counters with the pre-launch baseline. On this host, the launching cgroup was: ```text /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/app-zcode-20684.scope ``` The cgroup path will differ on other systems. ## Expected When the engine exits, all host pages allocated or pinned for KV streaming and expert arenas should be released. `Active(anon)`, `Inactive(anon)`, and the launching cgroup's `memory.current` should return approximately to their pre-launch values without requiring a reboot. ## Actual The anonymous LRU counters remain elevated after the engine and its CUDA contexts disappear. Repeating start/stop cycles accumulates more retained memory. During the eventual memory-exhaustion event, the kernel reported order-7 and order-9 page-allocation failures in the `strata` process. Available swap fell to 56 kB, followed by multiple `Cannot map memory` messages. The host subsequently froze and required a hard reboot. ## Evidence ### Memory accounting after engine exit On 2026-11-07, with no Strata process running: ```text Active(anon): 115983548 kB Inactive(anon): 70385968 kB Combined: 186369516 kB (~177.7 GiB) AnonPages: 11821784 kB (~11.3 GiB) Shmem: 189928 kB SwapTotal: 8 GiB SwapFree: ~1.5 GiB ``` The launching cgroup contained: ```text memory.current 208787025920 bytes (~194.4 GiB) memory.stat:anon 501161984 bytes (~478 MiB) memory.stat:active_anon 110345801728 bytes memory.stat:inactive_anon 68700590080 bytes memory.stat:file 29293252608 bytes memory.stat:kernel 515670016 bytes memory.swap.current 616566784 bytes ``` Thus, only about 478 MiB remained as mapped anonymous memory in that cgroup, while approximately 166.8 GiB remained on its active/inactive anonymous LRU lists. `cgroup.procs` contained only the desktop/ZCode tooling used to launch the tests, with no Strata process. These counters do not by themselves prove generic “kernel-space memory usage.” The significant observation is that the pages no longer have corresponding userspace mappings but remain allocated on the anonymous LRU lists and charged to the launching cgroup. ### Kernel stack from the memory-exhaustion event `journalctl -k -b` captured the following path during the order-7/order-9 allocation failures: ```text strata: page allocation failure check_and_migrate_movable_pages __gup_longterm_locked pin_user_pages os_lock_user_pages+0xb5/0x1c0 [nvidia] RmCreateOsDescriptor+0x99/0x180 [nvidia] RmIoctl+0xc2c/0xda0 [nvidia] rm_ioctl [nvidia] nvidia_unlocked_ioctl [nvidia] ``` This directly connects the affected host-memory allocations to NVIDIA's long-term page-pinning path. The remaining ownership question is whether Strata is missing a pinned-host-allocation release on some normal/error/exit paths, or whether the NVIDIA driver is failing to release all page pins during final client cleanup. The current evidence does not conclusively assign the defect to only one of those layers. ### Other checks - `/dev/shm` was empty and `Shmem` was only about 0.2 GiB. - `nvidia-smi --query-compute-apps` showed no compute processes after engine exit. - Only Xorg remained visible as an NVIDIA graphics client, using 4 MiB per GPU. - `drop_caches` and `compact_memory` did not release the retained anonymous pages. - A cgroup `memory.reclaim` probe reclaimed file cache but did not reduce the total active/inactive anonymous memory. Approximately 35.8 GiB merely moved between `inactive_anon` and `active_anon`. - Killing the remaining launcher processes or removing the cgroup would not constitute a safe way to force-release pages that may still carry driver references. Full sanitized `meminfo`, cgroup statistics, and kernel allocation-failure logs can be provided if needed. ## Reproduction status **Reproduced locally** through repeated Strata start/stop cycles on the host described above. This is an observed runtime issue, not a code-only or scanner-derived finding.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 6, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes".

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6689248852 --> @github-actions[bot] commented on GitHub (Nov 6, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes". Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@github-actions[bot] commented on GitHub (Nov 7, 2026):

Thanks, this follows the format now.

<!-- gh-comment-id:6701516615 --> @github-actions[bot] commented on GitHub (Nov 7, 2026): Thanks, this follows the format now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3231
No description provided.