fix(windows): wait for Sunshine readiness in service wrapper#5367
fix(windows): wait for Sunshine readiness in service wrapper#5367scenix007 wants to merge 1 commit into
Conversation
e3d31b5 to
02b5968
Compare
|
This comment was marked as off-topic.
This comment was marked as off-topic.
|
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? |
|
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 |
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. |
|
Using AI as a tool for coding is okay... I don't really want to have a conversation on PRs with an LLM though. |
Noted |
|
|
||
| void signal_ready() { | ||
| std::wstring event_handle_text(32, L'\0'); | ||
| auto length = GetEnvironmentVariableW(SERVICE_READY_EVENT_ENV, event_handle_text.data(), static_cast<DWORD>(event_handle_text.size())); |
There was a problem hiding this comment.
use new common library for get/set env functions, see #5356
There was a problem hiding this comment.
Updated. Changed to lizardbyte::common::get_env() and unset_env()
02b5968 to
4b99717
Compare
|
|
||
| ResetEvent(ready_event); | ||
|
|
||
| if (const auto ready_event_handle_text = std::format(L"{}", std::bit_cast<std::uintptr_t>(ready_event)); !SetEnvironmentVariableW(SERVICE_READY_EVENT_ENV, ready_event_handle_text.c_str())) { |
There was a problem hiding this comment.
same comment in this file
There was a problem hiding this comment.
fixed,using lizardbyte::common helpers. I also added Windows unit tests
4b99717 to
33c0304
Compare



Description
On Windows,
sunshinesvc.exereportedSERVICE_RUNNINGimmediately afterCreateProcessAsUserW()succeeded. IfSunshine.exestarted 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_PENDINGuntil 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 --checkBUILD_WERROR=ONninja -C cmake-build-review sunshine sunshinesvc test_sunshine./cmake-build-review/tests/test_sunshine.exe --gtest_filter=ServiceReadySignalTest.*(3 passed, 0 failed)./cmake-build-review/tests/test_sunshine.exe --gtest_filter=-DownloadFileTests/DownloadFileTest.Run/*(341 passed, 7 skipped; 2 external download tests excluded because the local UCRT libcurl could not load its CA bundle)clang-tidyanalyzer, bugprone, and performance checks on the modified C++ files (no findings in new or modified lines)Screenshot
N/A; this is Windows service behavior and does not change the UI.
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage