Skip to content

fix(windows): wait for Sunshine readiness in service wrapper#5367

Open
scenix007 wants to merge 1 commit into
LizardByte:masterfrom
scenix007:windows-service-readiness
Open

fix(windows): wait for Sunshine readiness in service wrapper#5367
scenix007 wants to merge 1 commit into
LizardByte:masterfrom
scenix007:windows-service-readiness

Conversation

@scenix007

@scenix007 scenix007 commented Jul 2, 2026

Copy link
Copy Markdown

Description

On Windows, sunshinesvc.exe reported SERVICE_RUNNING immediately after CreateProcessAsUserW() succeeded. If Sunshine.exe started but hung before opening its listeners, SCM still showed the service as running even though clients could not discover or connect to the host.

This changes the Windows service wrapper to keep the service in SERVICE_START_PENDING until the child process signals readiness after the configuration HTTPS listener starts. If the child exits, times out, or the active console session changes before readiness, the wrapper cleans up the process and retries instead of reporting a false running state.

Validation performed:

  • git diff --check
  • cmake -B cmake-build-pr2 -G Ninja -S . -DBUILD_WERROR=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSUNSHINE_ASSETS_DIR=assets -DSUNSHINE_PUBLISHER_NAME=LizardByte -DSUNSHINE_PUBLISHER_WEBSITE=https://app.lizardbyte.dev -DSUNSHINE_PUBLISHER_ISSUE_URL=https://app.lizardbyte.dev/support -DDOTNET_EXECUTABLE=/c/Users/sceni/.dotnet-pr/dotnet.exe
  • ninja -C cmake-build-pr2 sunshine sunshinesvc
  • ninja -C cmake-build-pr2 test_sunshine
  • ./cmake-build-pr2/tests/test_sunshine.exe (340 passed, 7 skipped, 0 failed)

Screenshot

N/A; this is Windows service behavior and does not change the UI.

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@scenix007 scenix007 force-pushed the windows-service-readiness branch 4 times, most recently from c6f0eef to e3d31b5 Compare July 2, 2026 16:21
@scenix007 scenix007 force-pushed the windows-service-readiness branch from e3d31b5 to 02b5968 Compare July 2, 2026 16:24
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@scenix007

This comment was marked as off-topic.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thank you for the PR submission, but I noticed you didn't use our PR template.

Please update the PR to use the correct template. You can find it at https://github.com/LizardByte/.github/blob/master/.github/pull_request_template.md?plain=1

And what does a Linux issue have to do with the Windows service?

@ReenigneArcher ReenigneArcher added the ai PR has signs of heavy ai usage (either indicated by user or assumed) label Jul 2, 2026
@scenix007

Copy link
Copy Markdown
Author

Thanks for pointing that out. I updated the PR description to use the project template.

You're right about #5294. I had referenced it only because the user-visible symptom was similar, but it is a Linux startup hang and this PR is specifically about the Windows service wrapper reporting SERVICE_RUNNING before Sunshine.exe is actually ready. I removed that reference from the PR description to avoid implying this fixes the Linux issue.

@ReenigneArcher

Copy link
Copy Markdown
Member

Thanks for pointing that out. I updated the PR description to use the project template.

You're right about #5294. I had referenced it only because the user-visible symptom was similar, but it is a Linux startup hang and this PR is specifically about the Windows service wrapper reporting SERVICE_RUNNING before Sunshine.exe is actually ready. I removed that reference from the PR description to avoid implying this fixes the Linux issue.

Did you generate this response with AI?

@scenix007

Copy link
Copy Markdown
Author

Thanks for pointing that out. I updated the PR description to use the project template.
You're right about #5294. I had referenced it only because the user-visible symptom was similar, but it is a Linux startup hang and this PR is specifically about the Windows service wrapper reporting SERVICE_RUNNING before Sunshine.exe is actually ready. I removed that reference from the PR description to avoid implying this fixes the Linux issue.

Did you generate this response with AI?

You caught me; I wrote one myself, but I found that the AI actually did a better job than I did. So I deleted the one I wrote; I hope you don't mind.

@ReenigneArcher

Copy link
Copy Markdown
Member

Using AI a tool for coding is okay... I don't really want to have a conversation on PRs with an LLM though.

@scenix007

Copy link
Copy Markdown
Author

Using AI a tool for coding is okay... I don't really want to have a conversation on PRs with an LLM though.

Noted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai PR has signs of heavy ai usage (either indicated by user or assumed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants