Skip to content

feat(core-manager): share a host stop strategy with core supervisors - #475

Merged
4o3F merged 1 commit into
mainfrom
fix/core-stop-strategy
Nov 1, 2026
Merged

4o3F merged 1 commit into
mainfrom
fix/core-stop-strategy

Conversation

@4o3F

@4o3F 4o3F commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Builds on libnyanpasu/nyanpasu-utils#219 (merged): the utils gitlink pins main@6d3574e, which adds StopStrategy (default Graceful) / AtomicStopStrategy / SupervisorBuilder::stop_strategy.

  • CoreManagerBuilder::stop_strategy(Arc<AtomicStopStrategy>), injected like native_store.
  • The same Arc is threaded through ProcessRuntimeBackend and InstanceBuilder into each SupervisorBuilder, so a later store(Kill) reaches running and future instances. Without it nothing is passed and stops stay graceful.
  • Library-only: nyanpasu_service, service-runtime and IPC are untouched, so the shipped service binary does not change and no release is needed.

Test: manager_shares_stop_strategy_with_running_and_future_instances stores Kill between instance starts and checks stop succeeds, processes exit and ports are released; on Windows it also asserts the shutdown helper is never launched.

Verified on Linux: cargo fmt --all --check, cargo clippy -p nyanpasu-core-manager --all-targets -D warnings, cargo test -p nyanpasu-core-manager, cargo check --workspace --all-targets. Not run on Windows.

Refs libnyanpasu/clash-nyanpasu#6054

@semanticdiff-com

semanticdiff-com Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  crates/nyanpasu-core-manager/src/instance.rs  27% smaller
  crates/nyanpasu-core-manager/tests/instance_lifecycle.rs  4% smaller
  crates/nyanpasu-core-manager/src/runtime/process.rs  1% smaller
  Cargo.lock Unsupported file format
  crates/nyanpasu-core-manager/src/manager/mod.rs  0% smaller
  crates/nyanpasu-core-manager/tests/helpers/fake_core.rs  0% smaller
  crates/nyanpasu-utils  0% smaller

A host ending the OS session needs the core's process tree killed instead
of stopped through the Windows Ctrl+C helper, which cannot start while the
session is torn down. CoreManagerBuilder::stop_strategy threads one
Arc<AtomicStopStrategy> to every supervisor, so a later store reaches running
and future instances. Without it the stop stays graceful.

Refs libnyanpasu/clash-nyanpasu#6054
@4o3F
4o3F force-pushed the fix/core-stop-strategy branch from aa0f425 to 7fe429b Compare November 1, 2026 12:25
@4o3F
4o3F merged commit a27c3fc into main Nov 1, 2026
11 checks passed
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