Skip to content

fix(server): stop an idle server holding the dictation lane's Qwen and the boot-warmed live model forever - #432

Merged
GeiserX merged 2 commits into
mainfrom
fix/ram-B-idle-timers
Oct 24, 2026
Merged

GeiserX merged 2 commits into
mainfrom
fix/ram-B-idle-timers

Conversation

@GeiserX

@GeiserX GeiserX commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Problem

An idle akou server should fall back to about its baseline memory once nothing uses a model. Three paths kept a model loaded with nothing to do:

  1. The dictation lane never unloaded. releaseIdle walked the queue's Workers only. The lane Workers (server.dictation_slots, default 1, so every server has one) were closed only when that setting shrank or the service closed. The first interactive=true job loaded Qwen3-ASR and its llama-server into a lane Worker that stayed until a restart. On a Vulkan box that is about 3.4 GB of GPU buffers counted as shmem in the container.
  2. The streaming model warmed at server start never unloaded. warmLive called warmDictation(choice, false, false), which is "not a use", and the live idle timer arms only on a use. A server with a streaming model on disk held it (about 930 MB anonymous) until the first live session plus the idle minutes, and forever when no live client came.
  3. The idle settings allowed a week. server.model_idle_minutes and asr.modelIdleMinutes accepted up to 10080 minutes, so a config could keep a 1 to 3 GB process resident for seven days with nothing queued.

Fix

  • releaseIdle applies the same idle rule to the lane Workers: warm for server.model_idle_minutes after the last dictation, then closed with their model and llama-server, with the same jobs: <model> unloaded after N min with no job line. Their remaining time feeds the same wake timer. How lane Workers are counted and started is unchanged.
  • warmLive passes use = true, so the start warm-up arms the live idle timer and the model goes after asr.modelIdleMinutes like any other use. The warm-up itself stays, so a first session within the idle time still finds the model loaded. The desktop warm-at-start path is untouched.
  • Both idle settings are capped at 1440 (a day), like asr.qwenIdleMinutes. A stored value above it is refused by the existing range check with setting refused: ... out of range (0 to 1440); using the default, so an existing config holding 10080 still boots, on the default. docs/configuration.md says what a long value costs.

This makes sure the release calls happen. Whether a released Worker hands its native memory back to the OS (the residual anonymous memory below) is a separate change.

Evidence

Tests, each watched failing on main first (MacMini, Bun 1.4.2):

  • tests/lane-idle.test.ts: the lane case (interactive job, fake llama-server, manual clock) still had [qwen3-asr-1.7b] loaded after 11 min on main and is unloaded with its llama-server gone after the fix. Positive control: the queued-job Worker unloads on the same rig, on main and on the branch. The schema case read 10080 back on main.
  • tests/live-warm.test.ts: a server with the fake streaming model on disk and asr.modelIdleMinutes 1 timed out waiting for the unload line on main. It passes on the branch, and the model is still held 30 s in (positive control).
  • bun run check on the branch: 3365 pass, 37 skip, 0 fail; floor check passed.

Measured in throwaway containers from the 1.2.2-vulkan image with main's or the branch's src mounted, own data dirs, copied models, removed afterwards:

Case main branch
One interactive Qwen job, server.model_idle_minutes 1, Intel iGPU Vulkan llama-server alive 150 s after job.done, cgroup shmem 3474 MB, cgroup anon 174 MB llama-server gone between 45 and 60 s after job.done, qwen3-asr-1.7b unloaded after 1 min logged, shmem 0 MB, cgroup anon 44 MB, bun RSS 106 MB
Boot with nemotron-3.5-560 on disk, asr.modelIdleMinutes 1, no client RssAnon 928 to 931 MB for 160 s, no unload line models unloaded after 1 min logged between 50 and 70 s after boot, RssAnon 929 MB to 666 MB
akou config get with 10080 stored 10080 for both settings 10 and 5 (the defaults), each with a setting refused line at start

After the boot-warm unload, 666 MB of anonymous memory is still held. That is the allocator keeping freed native memory, and it needs the separate release-path change to fall back to about 40 to 50 MB.

Three ways a server kept a model loaded with nothing to do:

- releaseIdle walked the queue's Workers only. The dictation lane's
  Worker (server.dictation_slots defaults to 1) kept Qwen and its
  llama-server after the first interactive job until a restart. It now
  follows the same idle rule and logs the same unload line.
- The streaming model warmed at server start was not counted as a use,
  so the live idle timer never armed and a server with no live client
  held it forever. The warm-up now counts as a use.
- server.model_idle_minutes and asr.modelIdleMinutes allowed a week.
  Both are capped at 1440, like asr.qwenIdleMinutes; a larger stored
  value is refused with a message and the default is used, so an old
  config still boots.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between d8cde46 and b0a3112.

Files selected for processing: 6
  • docs/configuration.md
  • src/main/config/schema.ts
  • src/main/index.ts
  • src/main/server/jobs.ts
  • tests/lane-idle.test.ts
  • tests/live-warm.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@GeiserX
GeiserX merged commit 4a4ed31 into main Oct 24, 2026
29 checks passed
@GeiserX
GeiserX deleted the fix/ram-B-idle-timers branch October 24, 2026 18:44
GeiserX added a commit that referenced this pull request Oct 24, 2026
…el (#435)

Release 1.2.4: the memory fixes of #430, #431, #432 and #434, /healthz reporting stalled jobs (#428), and the fix for a server that died when a job was cancelled during a model load (#429). Version stamped in 11 places, CHANGELOG section, terms check of 2026-10-24.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant