Repository navigation
fix(server): stop an idle server holding the dictation lane's Qwen and the boot-warmed live model forever - #432
Merged
Merged
Conversation
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.
|
Warning Review limit reachedYou'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. View limit details
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
releaseIdlewalked 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 firstinteractive=truejob 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.warmLivecalledwarmDictation(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.server.model_idle_minutesandasr.modelIdleMinutesaccepted up to 10080 minutes, so a config could keep a 1 to 3 GB process resident for seven days with nothing queued.Fix
releaseIdleapplies the same idle rule to the lane Workers: warm forserver.model_idle_minutesafter the last dictation, then closed with their model and llama-server, with the samejobs: <model> unloaded after N min with no jobline. Their remaining time feeds the same wake timer. How lane Workers are counted and started is unchanged.warmLivepassesuse = true, so the start warm-up arms the live idle timer and the model goes afterasr.modelIdleMinuteslike 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.asr.qwenIdleMinutes. A stored value above it is refused by the existing range check withsetting 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 andasr.modelIdleMinutes1 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 checkon 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
srcmounted, own data dirs, copied models, removed afterwards:server.model_idle_minutes1, Intel iGPU Vulkanqwen3-asr-1.7b unloaded after 1 minlogged, shmem 0 MB, cgroup anon 44 MB, bun RSS 106 MBasr.modelIdleMinutes1, no clientmodels unloaded after 1 minlogged between 50 and 70 s after boot, RssAnon 929 MB to 666 MBakou config getwith 10080 storedsetting refusedline at startAfter 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.