Skip to content
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 crash when exit app, notifyChange will be invalid when Watchman be deleted, but uv_close is an async call and notifyChange will be access in libuv later #15

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

TitusQian
Copy link
Contributor

fix crash when exit app, notifyChange will be invalid when Watchman be deleted, but uv_close is an async call and notifyChange will be access in libuv later
see below crash callstack crash at libuv uv__process_endgames,

Child-SP RetAddr Call Site

00 000000a7463fc6c8 00007ffd759da1ae ntdll!NtDelayExecution+0x14
01 000000a7463fc6d0 00007ff79454e197 KERNELBASE!SleepEx+0x9e
02 000000a7463fc770 00007ffd75abd827 Electron!crashpad::anonymous namespace'::UnhandledExceptionHandler+0xe7 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\crashpad\crashpad\client\crashpad_client_win.cc @ 186] 03 000000a7463fc8f0 00007ffd77d95570 KERNELBASE!UnhandledExceptionFilter+0x1e7 04 000000a7463fca10 00007ffd77d7ca06 ntdll!RtlUserThreadStart$filt$0+0xa2 05 000000a7463fca50 00007ffd77d9247f ntdll!_C_specific_handler+0x96 06 000000a7463fcac0 00007ffd77d414b4 ntdll!RtlpExecuteHandlerForException+0xf 07 000000a7463fcaf0 00007ffd77d90f8e ntdll!RtlDispatchException+0x244 08 000000a7463fd200 00007ff79024190b ntdll!KiUserExceptionDispatch+0x2e 09 (Inline Function) ---------------- Electron!uv__process_endgames+0x62 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\electron_node\deps\uv\src\win\handle-inl.h @ 103]
0a 000000a7463fd930 00007ff79020d33b Electron!uv_run+0x2db [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\electron_node\deps\uv\src\win\core.c @ 643]
0b 000000a7463fe9d0 00007ff79020dc9f Electron!node::Environment::CleanupHandles+0x15b [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\electron_node\src\env.cc @ 961]
0c 000000a7463fea40 00007ff790239eba Electron!node::Environment::RunCleanup+0x1bf [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\electron_node\src\env.cc @ 1018]
0d 000000a7463fece0 00007ff78e3c9d85 Electron!node::FreeEnvironment+0xba [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\electron_node\src\api\environment.cc @ 451]
0e (Inline Function) ---------------- Electron!electron::NodeBindings::CreateEnvironment::<lambda_0>::operator()+0x5a [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\electron\shell\common\node_bindings.cc @ 685] 0f 000000a7463fedb0 00007ff78e321de2 Electron!std::__Cr::__shared_ptr_pointer<node::Environment *,lambda at ....\electron\shell\common\node_bindings.cc:674:22',std::__Cr::allocatornode::Environment >::__on_zero_shared+0x85 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\libc++\src\include__memory\shared_ptr.h @ 261]
10 (Inline Function) ---------------- Electron!std::__Cr::__shared_count::__release_shared+0x1e [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\libc++\src\include\__memory\shared_ptr.h @ 172] 11 (Inline Function) ---------------- Electron!std::__Cr::__shared_weak_count::__release_shared+0x1e [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\libc++\src\include__memory\shared_ptr.h @ 213]
12 (Inline Function) ---------------- Electron!std::__Cr::shared_ptr<node::Environment>::~shared_ptr+0x23 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\libc++\src\include\__memory\shared_ptr.h @ 760] 13 (Inline Function) ---------------- Electron!std::__Cr::shared_ptrnode::Environment::reset+0x2e [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\third_party\libc++\src\include__memory\shared_ptr.h @ 827]
14 000000a7463fee10 00007ff78f303d64 Electron!electron::ElectronBrowserMainParts::PostMainMessageLoopRun+0x222 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\electron\shell\browser\electron_browser_main_parts.cc @ 597]
15 000000a7463fef00 00007ff78f30599e Electron!content::BrowserMainLoop::ShutdownThreadsAndCleanUp+0x1c4 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\content\browser\browser_main_loop.cc @ 1128]
16 000000a7463ff010 00007ff78f300c17 Electron!content::BrowserMainRunnerImpl::Shutdown+0x8e [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\content\browser\browser_main_runner_impl.cc @ 178]
17 000000a7463ff0b0 00007ff78e4dca01 Electron!content::BrowserMain+0xf7 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\content\browser\browser_main.cc @ 46]
18 000000a7463ff180 00007ff78e4de048 Electron!content::RunBrowserProcessMain+0xe1 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\content\app\content_main_runner_impl.cc @ 708]
19 000000a7463ff2e0 00007ff78e4dda67 Electron!content::ContentMainRunnerImpl::RunBrowser+0x518 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\content\app\content_main_runner_impl.cc @ 1292]
1a 000000a7463ff470 00007ff78e4d9eb4 Electron!content::ContentMainRunnerImpl::Run+0x307 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\content\app\content_main_runner_impl.cc @ 1142]
1b 000000a7463ff620 00007ff78e4da02d Electron!content::RunContentProcess+0x524 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\content\app\content_main.cc @ 330]
1c 000000a7463ff880 00007ff78e21aee7 Electron!content::ContentMain+0x7d [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\content\app\content_main.cc @ 347]
1d 000000a7463ff910 00007ff79272c5e2 Electron!wWinMain+0x377 [D:\jenkins\workspace\RPM-Electron27-Custom-Builder\label\rcv-ce-win\electron-build\electron\src\electron\shell\app\electron_main_win.cc @ 239]
1e (Inline Function) ---------------- Electron!invoke_main+0x21 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 118] 1f 000000a7463ffb20 00007ffd76377344 Electron!__scrt_common_main_seh+0x106 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 20 000000a7463ffb60 00007ffd77d426b1 KERNEL32!BaseThreadInitThunk+0x14 21 000000a7463ffb90 00000000`00000000 ntdll!RtlUserThreadStart+0x21

…e deleted, but uv_close is an async call and notifyChange will be access in libuv later
Copy link
Contributor

@cb1kenobi cb1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! This is an awesome find! I just pulled the changes, gave it a test, and things look good!

Before this PR can be merged, we kindly ask you to sign TiDev Contributor License Agreement (CLA): https://tidev.io/contribute. It's super quick and easy.

Once it's signed, I'll merge this and publish a new version for ya. Thanks!

@TitusQian
Copy link
Contributor Author

@cb1kenobi thanks for your quick response, I have signed CLA just now, do I need to attach the CLA pdf? or is it all done?

@cb1kenobi
Copy link
Contributor

@TitusQian No need to attach the CLA. Super easy. :) Let's publish this bad boy.

Copy link
Contributor

@cb1kenobi cb1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! APPROVED!

@cb1kenobi cb1kenobi merged commit 799daf2 into tidev:main Jul 2, 2024
1 check passed
@cb1kenobi
Copy link
Contributor

@TitusQian [email protected] has been published! GH release: https://github.com/tidev/winreglib/releases/tag/v2.0.4.

I had to clean up some things just to get this to publish. Sigh. What a pain. Please give it a shot.

Heads up, I'm working on updating winreglib to support the latest Node.js versions, switch to ESM and TypeScript, update dependencies, support arm and arm64, and do some general housekeeping. The API should stay the same.

Again, HUGE thanks for the pull request!

@TitusQian TitusQian deleted the fix/crash branch July 3, 2024 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants