Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

Windows does not wake up after streaming from Moonlight to Sunshine on an application with an command

Open CrendKing opened this issue 7 months ago • 10 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your issue described in the documentation?

  • [X] I have read the documentation

Is your issue present in the nightly release?

  • [X] This issue is present in the nightly release

Describe the Bug

Base line

Install Sunshine as a Windows service and make it auto start. After booting, use Start menu to sleep. Wake it up with mouse, behave normal.

Minimum reproducible steps

  1. Start Sunshine as Windows service.
  2. Create an application in Sunshine.
  3. Give it a command. The executable could be anything that terminates by itself, but the smallest could be a program that just sleeps a few seconds then exit. Something like
int main(int argc, char **argv) {
    std::this_thread::sleep_for(5s);
    return 0;
}
  1. Uncheck "Continue streaming if the application exits quickly" to make sure Sunshine ends the stream when the command finishes.
  2. Start a stream. After the command finishes, make sure the Sunshine tray icon no longer shows the "Play" icon.
  3. Use Start menu to sleep.
  4. Wake it up with mouse. It's now in a weird state that 1) the screen is off; 2) doesn't respond to any input from keyboard and mouse; 3) doesn't respond to any network request like a ping. The only thing left is to force reboot.

Other tests

It seems the trigger must include a command being in the Sunshine application, and the command terminates itself.

  1. Stream the "Desktop" application, which can last infinite. Make the client quit the stream. The sleep can be waken up.
  2. Stream the "Test" application. After it terminates by itself, restart Sunshine. Sleep can wake.
  3. Stream the "Test" application, but instead of waiting for it to terminate by itself, make the client quit the stream. Sleep can wake.
  4. Start sunshine.exe directly instead of a Windows service and repeat the steps above. Sleep can wake.

Expected Behavior

Regardless if there is a command in the application, or if client quits or not, the host should be able to sleep then wake afterwards.

Additional Context

There is a similar (and probably related) issue at https://github.com/LizardByte/Sunshine/issues/1809. But the trigger seems different. Also, I use WIFI.

Host Operating System

Windows

Operating System Version

Windows 11 23H2

Architecture

64 bit

Sunshine commit or version

0.21.0 and tested in nightly. I verified that earlier versions (such as 0.20.0) does not have the problem.

Package

Windows - Scoop (Third Party) Nightly (https://github.com/LizardByte/Sunshine/commit/29a1b1539fb2e0e82d02e521954b163c6d9d55d1, Portable)

GPU Type

Nvidia

GPU Model

RTX 2070 Super

GPU Driver/Mesa Version

546.17

Capture Method (Linux Only)

No response

Config

<Empty>

Apps

{
    "env": {
        "PATH": "$(PATH)"
    },
    "apps": [
        {
            "name": "Desktop",
            "image-path": "desktop.png"
        },
        {
            "name": "Test",
            "output": "",
            "cmd": "<path>\test.exe",
            "exclude-global-prep-cmd": "false",
            "elevated": "false",
            "auto-detach": "false",
            "image-path": ""
        }
    ]
}

Relevant log output

There is no outstanding log. The last line is just the standard "Process Terminated" line.

CrendKing avatar Nov 22 '23 02:11 CrendKing