-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix shutdown when called from tray callback #1691
Merged
ReenigneArcher
merged 1 commit into
LizardByte:nightly
from
TheElixZammuto:fix-tray-quit-cb
Oct 4, 2023
Merged
Fix shutdown when called from tray callback #1691
ReenigneArcher
merged 1 commit into
LizardByte:nightly
from
TheElixZammuto:fix-tray-quit-cb
Oct 4, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cgutman
approved these changes
Oct 4, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
For future reference, the deadlock was the main thread:
0:000> k
# Child-SP RetAddr Call Site
00 0000008b`4effef28 00007ffe`36f17878 win32u!NtUserMessageCall+0x14
01 0000008b`4effef30 00007ffe`36f02de5 USER32!SendMessageWorker+0x2e8
02 0000008b`4effefe0 00007ffe`36f02d92 USER32!SendMessageInternal+0x39
03 0000008b`4efff020 00007ff7`15fdcfff USER32!SendMessageA+0x42
04 0000008b`4efff070 00007ff7`15fb3641 Sunshine!tray_update+0x64 [C:\Users\camer\moonlight-src\LB_Sunshine\third-party\tray\tray_windows.c @ 146]
05 0000008b`4efff0e0 00007ff7`15f7e892 Sunshine!update_tray_pausing+0x60 [C:\Users\camer\moonlight-src\LB_Sunshine\src\system_tray.cpp @ 315]
06 0000008b`4efff210 00007ff7`17490e11 Sunshine!join+0x8c0 [C:\Users\camer\moonlight-src\LB_Sunshine\src\stream.cpp @ 1738]
07 0000008b`4efff560 00007ff7`15f7252b Sunshine!clear+0x161 [C:\Users\camer\moonlight-src\LB_Sunshine\src\rtsp.cpp @ 348]
08 0000008b`4efff640 00007ff7`15f411dc Sunshine!rtpThread+0x4e3 [C:\Users\camer\moonlight-src\LB_Sunshine\src\rtsp.cpp @ 789]
09 0000008b`4efff890 00007ff7`15f312ee Sunshine!main+0x12d4 [C:\Users\camer\moonlight-src\LB_Sunshine\src\main.cpp @ 751]
0a 0000008b`4efffe80 00007ff7`15f31406 Sunshine!__tmainCRTStartup+0x16e [C:\M\B\src\mingw-w64\mingw-w64-crt\crt\crtexe.c @ 268]
0b 0000008b`4efffed0 00007ffe`36e4257d Sunshine!mainCRTStartup+0x16 [C:\M\B\src\mingw-w64\mingw-w64-crt\crt\crtexe.c @ 190]
0c 0000008b`4effff00 00007ffe`37ccaa78 KERNEL32!BaseThreadInitThunk+0x1d
0d 0000008b`4effff30 00000000`00000000 ntdll!RtlUserThreadStart+0x28
Sending a window message to the system tray thread, which was sleeping waiting for termination:
0:004> k
# Child-SP RetAddr Call Site
00 0000008b`4fdfedb8 00007ffe`35213fbe ntdll!NtWaitForSingleObject+0x14
01 0000008b`4fdfedc0 00007ff7`173aab59 KERNELBASE!WaitForSingleObjectEx+0x8e
02 0000008b`4fdfee60 00007ff7`173ad01a Sunshine!ff_init_desc_no_chr+0xbcc5e9
03 0000008b`4fdfeec0 00007ff7`173ae904 Sunshine!ff_init_desc_no_chr+0xbceaaa
04 0000008b`4fdfef00 00007ff7`17663991 Sunshine!ff_init_desc_no_chr+0xbd0394
05 0000008b`4fdfef70 00007ff7`15f3dcc5 Sunshine!sleep_for<long long int, std::ratio<1> >+0x91 [C:\msys64\mingw64\include\c++\13.2.0\bits\this_thread_sleep.h @ 80]
06 0000008b`4fdfefd0 00007ff7`15fb28da Sunshine!exit_sunshine+0xbc [C:\Users\camer\moonlight-src\LB_Sunshine\src\main.cpp @ 156]
07 0000008b`4fdff040 00007ff7`15fdcb7c Sunshine!tray_quit_cb+0xe7 [C:\Users\camer\moonlight-src\LB_Sunshine\src\system_tray.cpp @ 122]
08 0000008b`4fdff0d0 00007ffe`36f18241 Sunshine!_tray_wnd_proc+0x1ec [C:\Users\camer\moonlight-src\LB_Sunshine\third-party\tray\tray_windows.c @ 50]
09 0000008b`4fdff190 00007ffe`36f1776d USER32!UserCallWinProcCheckWow+0x2d1
0a 0000008b`4fdff2f0 00007ffe`36f02de5 USER32!SendMessageWorker+0x1dd
0b 0000008b`4fdff3a0 00007ffe`36f02d92 USER32!SendMessageInternal+0x39
0c 0000008b`4fdff3e0 00007ff7`15fdcab9 USER32!SendMessageA+0x42
0d 0000008b`4fdff430 00007ffe`36f18241 Sunshine!_tray_wnd_proc+0x129 [C:\Users\camer\moonlight-src\LB_Sunshine\third-party\tray\tray_windows.c @ 34]
0e 0000008b`4fdff4f0 00007ffe`36f17efc USER32!UserCallWinProcCheckWow+0x2d1
0f 0000008b`4fdff650 00007ffe`36f2302d USER32!DispatchClientMessage+0x9c
10 0000008b`4fdff6b0 00007ffe`37d132a4 USER32!_fnDWORD+0x3d
11 0000008b`4fdff710 00007ffe`359a1534 ntdll!KiUserCallbackDispatcherContinue
12 0000008b`4fdff798 00007ffe`36f21ed6 win32u!NtUserGetMessage+0x14
13 0000008b`4fdff7a0 00007ff7`15fdcf34 USER32!GetMessageA+0x46
14 0000008b`4fdff800 00007ff7`15fb3300 Sunshine!tray_loop+0x34 [C:\Users\camer\moonlight-src\LB_Sunshine\third-party\tray\tray_windows.c @ 128]
15 0000008b`4fdff870 00007ff7`177547fd Sunshine!system_tray+0x8cd [C:\Users\camer\moonlight-src\LB_Sunshine\src\system_tray.cpp @ 240]
16 0000008b`4fdffb60 00007ff7`17773375 Sunshine!__invoke_impl<int, int (*)()>+0x1d [C:\msys64\mingw64\include\c++\13.2.0\bits\invoke.h @ 61]
17 0000008b`4fdffb90 00007ff7`176d9bf8 Sunshine!__invoke<int (*)()>+0x25 [C:\msys64\mingw64\include\c++\13.2.0\bits\invoke.h @ 98]
18 0000008b`4fdffbd0 00007ff7`176d9c58 Sunshine!_M_invoke<0>+0x28 [C:\msys64\mingw64\include\c++\13.2.0\bits\std_thread.h @ 292]
19 0000008b`4fdffc00 00007ff7`176d87ec Sunshine!operator()+0x18 [C:\msys64\mingw64\include\c++\13.2.0\bits\std_thread.h @ 300]
1a 0000008b`4fdffc30 00007ff7`1778ff4f Sunshine!_M_run+0x1c [C:\msys64\mingw64\include\c++\13.2.0\bits\std_thread.h @ 244]
1b 0000008b`4fdffc60 00007ff7`173abe9b Sunshine!boost_asio_detail_posix_thread_function+0x4f
1c 0000008b`4fdffca0 00007ffe`3652e634 Sunshine!ff_init_desc_no_chr+0xbcd92b
1d 0000008b`4fdffce0 00007ffe`3652e70c msvcrt!_callthreadstartex+0x28
1e 0000008b`4fdffd10 00007ffe`36e4257d msvcrt!_threadstartex+0x7c
1f 0000008b`4fdffd40 00007ffe`37ccaa78 KERNEL32!BaseThreadInitThunk+0x1d
20 0000008b`4fdffd70 00000000`00000000 ntdll!RtlUserThreadStart+0x28
ReenigneArcher
force-pushed
the
fix-tray-quit-cb
branch
from
October 4, 2023 14:41
acd5c69
to
77b3998
Compare
KuleRucket
pushed a commit
to KuleRucket/Sunshine
that referenced
this pull request
Jun 6, 2024
e-dong
pushed a commit
to e-dong/Sunshine
that referenced
this pull request
Jul 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When sunshine is closed using the "Quit" button on the tray menu, the shutdown does deadlock, causing the 10s timeout to intervene. This change plans to fix this. Tested on Windows in foreground and service mode
Type of Change
.github/...
)Checklist
Branch Updates
LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.