Skip to content

fix(music-server): bound automatic engine restart attempts - #256

Merged
timoncool merged 1 commit into
timoncool:mainfrom
AIwork4me:fix/engine-start-backoff-standalone
Nov 16, 2026
Merged

timoncool merged 1 commit into
timoncool:mainfrom
AIwork4me:fix/engine-start-backoff-standalone

Conversation

@AIwork4me

@AIwork4me AIwork4me commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Why

An engine that cannot start can be automatically relaunched on every supervisor poll (roughly every two seconds). Persistent errors, such as a missing runtime dependency, do not resolve through repeated spawning and can flood logs. This was observed as 25 attempts during Windows testing in #242.

What changed

  • Add one backend-agnostic EngineStartBackoff policy used only by the existing Rust automatic engine supervisor.
  • Retry with 5/15/30/60-second spacing; suspend automatic starts after five consecutive failures for the same engine options and model selection.
  • Reset the budget when the engine is healthy or when engine options / selected model components change.
  • Preserve the existing user-initiated /engine/restart path, cancellation/progress APIs, engine adapter abstraction, and existing CUDA/Vulkan/CPU packaging.
  • Keep the original startup error visible and log retry/suspension decisions.

Only crates/music-server/src/lib.rs and the new engine_start_backoff.rs are changed. No HIP-specific code, GPU dependencies, installer changes, frontend changes, or model files.

Validation

  • Three pure-Rust unit tests exercise bounded delays and suspension, configuration-change reset, and reset after recovery.
  • The source behavior and tests were previously exercised on Windows and Linux in the HIP branch at 4a8186eb (run 43687431936). That run does not count as exact-head CI for this rebased standalone change.
  • The independent fork CI for exact HEAD 6b4a10bd14a9004e1b075cd93996792d6eb095a1 is run 43783205612, SUCCESS: Windows Rust 526 passed / 0 failed / 7 ignored, Linux Rust 520 passed / 0 failed / 4 ignored, frontend 213 passed / 0 failed (62 test files); frontend build and TypeScript checks passed.
  • No physical Radeon validation is needed: this is a backend-independent supervisor change and does not alter model inference.

Scope / contribution requirements

Based on the latest upstream main (0817d319); reviewed the repository's AGENTS.md and MIT license. The change adds no Python/Node runtime dependency, does not special-case any model or provider, and does not commit runtime user data.

Extracted at the maintainer's suggestion in PR #242 discussion. After this standalone change is accepted, the overlapping watchdog change in #242 should be reconciled without losing the HIP work.

@AIwork4me
AIwork4me marked this pull request as ready for review November 16, 2026 00:59
timoncool added a commit that referenced this pull request Nov 16, 2026
… five minutes, so it comes back when its cause is gone; CHANGELOG (#259, pull request #256)
@timoncool
timoncool merged commit f4a7b42 into timoncool:main Nov 16, 2026
@timoncool

Copy link
Copy Markdown
Owner

Merged into the 4.1.0 branch, thank you. One change on top of it: after five failed starts the engine is not left stopped, it is tried every five minutes. Otherwise a cause that goes away by itself would not bring it back: a model file put back into the folder, memory another program gave up. The log line says so once.

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.

2 participants