Skip to content

fix: make Core restart failures explicit - #332

Closed
Ezio1997-K wants to merge 1 commit into
appshubcc:mainfrom
Ezio1997-K:fix/core-startup-readiness
Closed

fix: make Core restart failures explicit#332
Ezio1997-K wants to merge 1 commit into
appshubcc:mainfrom
Ezio1997-K:fix/core-startup-readiness

Conversation

@Ezio1997-K

Copy link
Copy Markdown

Summary

Make Core startup/restart failures explicit and preserve useful diagnostics:

  • propagate the 5-second IPC readiness timeout as a typed failure instead of logging and continuing;
  • guard Core startup state with try/finally, so isStarting always resets;
  • clean up a half-started Core while preserving the original startup error;
  • make initial preload() wait for the first Core startup result;
  • fail when Core initialization/state setup returns false;
  • clear stale groups/providers at the start of a desktop profile hard switch;
  • keep logs and requests instead of erasing the incident immediately after a switch;
  • explicitly catch asynchronous profile-change failures;
  • document that checkCoreHealth() checks only IPC/control-plane health, not TUN or mixed-port data-plane health.

This complements #209 but does not change profile apply ordering and does not add automatic restart/watchdog behavior.

Why

In #330 the App, Core process, Helper and mixed-port listener can remain alive while TUN/mixed traffic is unavailable. Treating socket connection or getIsInit as proof of full health leaves the UI showing stale nodes/status and hides restart failures.

The change deliberately avoids automatic self-healing restarts: a failed restart can extend an outage, and silently restarting would erase useful evidence.

Verification

  • dart format on all five modified Dart files: clean;
  • dart analyze lib/clash/core_startup.dart: no issues;
  • standalone Dart 3.12.2 smoke coverage: normal completion, typed timeout, concurrent-start rejection, and state reset after success/failure: PASS;
  • git diff --check: PASS.

Not run locally:

  • full flutter test / whole-project analyze;
  • Windows build or end-to-end TUN test.

The local environment did not have Flutter installed; this limitation is intentionally reported rather than treating the standalone Dart checks as a full Flutter build.

Related: #330, #209

@appshubcc

Copy link
Copy Markdown
Owner

部分已合并

其中过度设计的逻辑未添加

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