moonlight-qt icon indicating copy to clipboard operation
moonlight-qt copied to clipboard

Potential memory corruption bug in macOS

Open f1yn opened this issue 3 years ago • 5 comments

Describe the bug A clear and concise description of what the bug is.

When using Moonlight-QT on macOS, it will crash (either intermittently or when I try to manually close the app) with the EXC_BAD_ACCESS (SIGSEGV) exception type. I use this setup with other hosts on my network running moonlight, so I'm pretty confident this bug is specific to mac and not the windows machine that is being streamed.

Steps to reproduce Any special steps that are required for the bug to appear.

Run moonlight on macOS, connect to host on LAN at 1080p at any bandwidth.

Wait 10 to 15 minutes. Normally I'm listening to music over the network using moonlight-qt as the client, so moonlight is typically not being interacted with constantly.

The first thing I notice before a crash is that the cursor is not picked up by moonlight anymore, but the audio and video are still being received from the host.

Affected games List the games you've tried that exhibit the issue. To see if the issue is game-specific, try streaming Steam Big Picture with Moonlight and see if the issue persists there.

Any executable. I only use desktop sharing with macOS so I can perform sysadmin tasks and listen to my music while I work.

Other Moonlight clients

  • Does the issue occur when using Moonlight on iOS or Android? No

Moonlight settings (please complete the following information)

  • Have any settings been adjusted from defaults? Yes
  • If so, which settings have been changed? The optimize for remote desktop setting is enabled, as well as the quality of the stream
  • Does the problem still occur after reverting settings back to default? Yes

Client PC details (please complete the following information)

  • OS: macOS Monterey (x86)
  • Moonlight Version: 4.1.0
  • GPU: Radeon Pro 555X 4 GB + Intel UHD Graphics 630 1536 MB

Server PC details (please complete the following information)

  • OS: Windows 11
  • GeForce Experience version: 3.25.1.17
  • Nvidia GPU driver: 512.15
  • Antivirus and firewall software: Windows Defender and Windows Firewall

Moonlight Logs (please attach) This bug seems to exist outside of the logs, or happens before logs can actually be caught. This is the end of the file before a crash:

00:04:16 - SDL Info (0): IDR frame request sent
00:04:16 - SDL Info (0): Waiting for IDR frame
00:04:16 - SDL Info (0): Waiting for IDR frame
00:04:16 - SDL Info (0): Waiting for IDR frame
00:05:45 - SDL Info (0): Unable to recover audio data block 57208 to 57211 (2+2=4 received < 4 needed)
00:05:45 - SDL Info (0): Network dropped audio data (expected 57204, but received 57208)
00:05:45 - SDL Info (0): Network dropped 2 frames (frames 16947 to 16948)
00:05:45 - SDL Info (0): Waiting for IDR frame
00:05:45 - SDL Info (0): IDR frame request sent
00:06:36 - SDL Info (0): Unrecoverable frame 19971: 1+0=1 received < 3 needed
00:06:36 - SDL Info (0): Network dropped 1 frame (frame 19971)
00:06:36 - SDL Info (0): Waiting for IDR frame
00:06:36 - SDL Info (0): IDR frame request sent
00:06:39 - SDL Info (0): Unrecoverable frame 20143: 4+0=4 received < 11 needed
00:06:39 - SDL Info (0): Network dropped 1 frame (frame 20143)
00:06:39 - SDL Info (0): Waiting for IDR frame
00:06:39 - SDL Info (0): IDR frame request sent
00:06:39 - SDL Info (0): Waiting for IDR frame
00:09:33 - SDL Info (0): Unable to recover audio data block 37256 to 37259 (2+0=2 received < 4 needed)
00:09:33 - SDL Info (0): Network dropped audio data (expected 37258, but received 37260)
00:11:05 - SDL Info (0): Network dropped 1 frame (frame 35898)
00:11:05 - SDL Info (0): Waiting for IDR frame
00:11:05 - SDL Info (0): IDR frame request sent
00:11:05 - SDL Info (0): Waiting for IDR frame
00:13:11 - SDL Info (0): Quit event received
00:13:11 - SDL Info (0): Global video stats
00:13:11 - SDL Info (0): ----------------------------------------------------------
Incoming frame rate from network: 59.21 FPS
Decoding frame rate: 59.21 FPS
Rendering frame rate: 59.21 FPS
Frames dropped by your network connection: 0.07%
Frames dropped due to network jitter: 0.00%
Average network latency: 2 ms (variance: 0 ms)
Average decoding time: 4.10 ms
Average frame queue delay: 0.02 ms
Average rendering time (including monitor V-sync latency): 0.10 ms

Additional context Anything else you think may be relevant to the issue

I've attached the lovely nonsense barfed out by macOS macos-crash.log

f1yn avatar Jun 29 '22 04:06 f1yn

I stopped using the macOS client as this issue persisted. 😔

f1yn avatar Jul 24 '22 14:07 f1yn

It looks like a null pointer dereference inside SDL. I can try updating SDL and give you a link to a CI build to test.

cgutman avatar Jul 24 '22 17:07 cgutman

Please try this build

https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/44345676/job/ndttnrh9jxms71kc/artifacts

cgutman avatar Aug 02 '22 06:08 cgutman

As much as I love the thrill of running freshly-pressed builds straight from CI - unfortunately in this case I'll need to be able to see the source lines that were modified before I can run the app on this specific machine.

@cgutman I checked the CI for that build - was the patch solely just bumping upstream dependancies? If so, is there a fork where I can inspect that?

f1yn avatar Aug 05 '22 01:08 f1yn

The specific change was https://github.com/moonlight-stream/moonlight-qt/commit/15852ccf81719123bd1350f0630a8b713b430f08 which adjusted the libs submodule to point to https://github.com/cgutman/moonlight-qt-prebuilts/commit/919567f5f4bba92408949f3ad26f2c745c72a211 which were built by this AppVeyor job using build scripts and submodules in this repo https://github.com/cgutman/moonlight-deps

cgutman avatar Aug 05 '22 01:08 cgutman

@cgutman I've been testing this for a day now and crashes seem to be gone 👍🏻

f1yn avatar Aug 12 '22 01:08 f1yn

Awesome, thanks for confirming!

cgutman avatar Aug 13 '22 03:08 cgutman