electron
electron copied to clipboard
[Bug]: Electron app will crash when loadURL or loadFile is called again
Preflight Checklist
- [X] I have read the Contributing Guidelines for this project.
- [X] I agree to follow the Code of Conduct that this project adheres to.
- [X] I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
28.0.0
What operating system are you using?
Windows
Operating System Version
Windows 10
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
Correctly load the page
Actual Behavior
In the gist will crash and report error
Electron exited with code 3221225477.
In my project the app will crash and report error
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'start:main'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart:main', 'start:main', 'poststart:main' ]
5 info lifecycle electron-react-boilerplate@~prestart:main: electron-react-boilerplate@
6 info lifecycle electron-react-boilerplate@~start:main: electron-react-boilerplate@
7 verbose lifecycle electron-react-boilerplate@~start:main: unsafe-perm in lifecycle true
8 verbose lifecycle electron-react-boilerplate@~start:main: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\yezm\designer\new_designer_electron@11\node_modules\.bin;C:\Users\sendi\AppData\Local\Temp\yarn--1703125317339-0.5654012141646507;D:\yezm\designer\new_designer_electron@11\node_modules\.bin;C:\Users\sendi\AppData\Local\Yarn\Data\link\node_modules\.bin;C:\Program Files\libexec\lib\node_modules\npm\bin\node-gyp-bin;C:\Program Files\lib\node_modules\npm\bin\node-gyp-bin;C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\sendi\AppData\Local\Temp\yarn--1703125315075-0.5507023412320058;D:\yezm\designer\new_designer_electron@11\node_modules\.bin;C:\Users\sendi\AppData\Local\Yarn\Data\link\node_modules\.bin;C:\Users\sendi\AppData\Local\Yarn\bin;C:\Program Files\libexec\lib\node_modules\npm\bin\node-gyp-bin;C:\Program Files\lib\node_modules\npm\bin\node-gyp-bin;C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\sendi\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\sendi\bin;C:\Python310\Scripts;C:\Python310;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Program Files\nodejs;C:\Program Files\TortoiseGit\bin;C:\Users\sendi\AppData\Local\Microsoft\WindowsApps;C:\Users\sendi\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\sendi\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle electron-react-boilerplate@~start:main: CWD: D:\yezm\designer\new_designer_electron@11
10 silly lifecycle electron-react-boilerplate@~start:main: Args: [
10 silly lifecycle '/d /s /c',
10 silly lifecycle 'cross-env NODE_ENV=development electron -r ./.erb/scripts/BabelRegister ./src/main.dev.ts'
10 silly lifecycle ]
11 silly lifecycle electron-react-boilerplate@~start:main: Returned: code: 3221225477 signal: null
12 info lifecycle electron-react-boilerplate@~start:main: Failed to exec start:main script
13 verbose stack Error: electron-react-boilerplate@ start:main: `cross-env NODE_ENV=development electron -r ./.erb/scripts/BabelRegister ./src/main.dev.ts`
13 verbose stack Exit status 3221225477
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:375:28)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:375:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid electron-react-boilerplate@
15 verbose cwd D:\yezm\designer\new_designer_electron@11
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start:main"
18 verbose node v14.17.1
19 verbose npm v6.14.13
20 error code ELIFECYCLE
21 error errno 3221225477
22 error electron-react-boilerplate@ start:main: `cross-env NODE_ENV=development electron -r ./.erb/scripts/BabelRegister ./src/main.dev.ts`
22 error Exit status 3221225477
23 error Failed at the electron-react-boilerplate@ start:main script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225477, true ]
Testcase Gist URL
https://gist.github.com/Yezhuming/1a52808131145d7db29f0db7a7910a32
Additional Information
When executing BrowserWindow.loadURL or loadFIle to load a file or web page and the loading has not been completed (success or failure), the Electron app will crash when loadURL or loadFile is called again.
In this gist you can click the test "click here twice quickly" to reproduce this error. Suggest trying when the network is slow or click fast.
#19847 I found a similar problem and it seems to have been solved, but why does it appear again?
const { BrowserWindow } = require('electron');
// Create a new BrowserWindow const win = new BrowserWindow();
// Track the loading state let isLoading = false;
// Function to load a URL with error handling function loadUrlWithRetry(url) { if (!isLoading) { isLoading = true; win.loadURL(url) .then(() => { isLoading = false; }) .catch((error) => { console.error('Error loading URL:', error); isLoading = false; // You can implement retry logic here if needed }); } }
// Example usage loadUrlWithRetry('https://example.com');
It looks like this is a new issue; here's the stacktrace:
Stacktrace
[84586:0102/140211.797258:FATAL:navigation_request.cc(2040)] Check failed: is_safe_to_delete_.
0 Electron Framework 0x00000001201043a0 base::debug::CollectStackTrace(void const**, unsigned long) + 28
1 Electron Framework 0x00000001200f3afc base::debug::StackTrace::StackTrace() + 24
2 Electron Framework 0x00000001200202f8 logging::LogMessage::~LogMessage() + 160
3 Electron Framework 0x000000012000930c logging::(anonymous namespace)::DCheckLogMessage::~DCheckLogMessage() + 60
4 Electron Framework 0x0000000120008ee8 logging::CheckError::~CheckError() + 40
5 Electron Framework 0x0000000120008f18 logging::CheckError::~CheckError() + 12
6 Electron Framework 0x000000011f0c63f8 content::NavigationRequest::~NavigationRequest() + 1140
7 Electron Framework 0x000000011f0c7638 content::NavigationRequest::~NavigationRequest() + 12
8 Electron Framework 0x000000011f00f92c content::FrameTreeNode::TakeNavigationRequest(std::__Cr::unique_ptr<content::NavigationRequest, std::__Cr::default_delete<content::NavigationRequest>>) + 208
9 Electron Framework 0x000000011f0fa474 content::Navigator::Navigate(std::__Cr::unique_ptr<content::NavigationRequest, std::__Cr::default_delete<content::NavigationRequest>>, content::ReloadType) + 584
10 Electron Framework 0x000000011f0a43ac content::NavigationControllerImpl::NavigateWithoutEntry(content::NavigationController::LoadURLParams const&) + 3180
11 Electron Framework 0x000000011f0a3614 content::NavigationControllerImpl::LoadURLWithParams(content::NavigationController::LoadURLParams const&) + 224
12 Electron Framework 0x000000011af3db2c electron::api::WebContents::LoadURL(GURL const&, gin_helper::Dictionary const&) + 984
13 Electron Framework 0x000000011ae623f4 base::RepeatingCallback<void (base::CommandLine const&, base::FilePath const&, std::__Cr::vector<unsigned char const, std::__Cr::allocator<unsigned char const>>)>::Run(base::CommandLine const&, base::FilePath const&, std::__Cr::vector<unsigned char const, std::__Cr::allocator<unsigned char const>>) const & + 108
14 Electron Framework 0x000000011af5a618 gin_helper::Invoker<gin_helper::IndicesHolder<0ul, 1ul, 2ul>, electron::api::WebContents*, GURL const&, gin_helper::Dictionary const&>::DispatchToCallback(base::RepeatingCallback<void (electron::api::WebContents*, GURL const&, gin_helper::Dictionary const&)>) + 388
15 Electron Framework 0x000000011af5a344 gin_helper::Dispatcher<void (electron::api::WebContents*, GURL const&, gin_helper::Dictionary const&)>::DispatchToCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 236
16 ??? 0x0000000157dd3ce0 0x0 + 5769084128
17 ??? 0x0000000157dd14bc 0x0 + 5769073852
18 ??? 0x0000000157dd14bc 0x0 + 5769073852
19 ??? 0x0000000157dd14bc 0x0 + 5769073852
20 ??? 0x0000000157dd14bc 0x0 + 5769073852
21 ??? 0x0000000157f20908 0x0 + 5770447112
22 ??? 0x0000000157e029fc 0x0 + 5769275900
23 ??? 0x0000000157dce578 0x0 + 5769061752
24 Electron Framework 0x000000011ca04a90 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 3140
25 Electron Framework 0x000000011ca061a8 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 156
26 Electron Framework 0x000000011ca06890 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) + 108
27 Electron Framework 0x000000011ca5df84 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) + 752
28 Electron Framework 0x000000011ca5dc3c v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) + 116
29 Electron Framework 0x0000000124e9b234 node::InternalCallbackScope::Close() + 248
30 Electron Framework 0x0000000124e9b59c node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) + 484
31 Electron Framework 0x0000000124e9b93c node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) + 268
32 Electron Framework 0x000000011b059768 gin_helper::internal::CallMethodWithArgs(v8::Isolate*, v8::Local<v8::Object>, char const*, std::__Cr::vector<v8::Local<v8::Value>, std::__Cr::allocator<v8::Local<v8::Value>>>*) + 116
33 Electron Framework 0x000000011af559f8 v8::Local<v8::Value> gin_helper::EmitEvent<std::__Cr::basic_string_view<char, std::__Cr::char_traits<char>>, gin::Handle<gin_helper::internal::Event>&, GURL&, bool&, bool&, int&, int&>(v8::Isolate*, v8::Local<v8::Object>, std::__Cr::basic_string_view<char, std::__Cr::char_traits<char>> const&, gin::Handle<gin_helper::internal::Event>&, GURL&, bool&, bool&, int&, int&) + 228
34 Electron Framework 0x000000011af39c58 electron::api::WebContents::EmitNavigationEvent(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, content::NavigationHandle*) + 692
35 Electron Framework 0x000000011af3b18c non-virtual thunk to electron::api::WebContents::DidStartNavigation(content::NavigationHandle*) + 92
36 Electron Framework 0x000000011f351874 void content::WebContentsImpl::WebContentsObserverList::NotifyObservers<void (content::WebContentsObserver::*)(base::TimeTicks), base::TimeTicks&>(void (content::WebContentsObserver::*)(base::TimeTicks), base::TimeTicks&) + 428
37 Electron Framework 0x000000011f363378 content::WebContentsImpl::DidStartNavigation(content::NavigationHandle*) + 100
38 Electron Framework 0x000000011f0c0bf0 content::NavigationRequest::StartNavigation() + 2200
39 Electron Framework 0x000000011f0c86d0 content::NavigationRequest::BeginNavigationImpl() + 144
40 Electron Framework 0x000000011f0c7aac content::NavigationRequest::BeginNavigation() + 912
41 Electron Framework 0x000000011f0fb444 content::Navigator::BeforeUnloadCompleted(content::FrameTreeNode*, bool, base::TimeTicks const&) + 248
42 Electron Framework 0x000000011f159cbc _ZN4base8internal7InvokerINS0_9BindStateIZN7content19RenderFrameHostImpl37ProcessBeforeUnloadCompletedFromFrameEbbPS4_bRKNS_9TimeTicksES8_bE3$_0JNS_7WeakPtrIS4_EES6_bbEEEFvvEE7RunOnceEPNS0_13BindStateBaseE + 144
43 Electron Framework 0x000000011ae56780 base::OnceCallback<void ()>::Run() && + 68
44 Electron Framework 0x000000011f1124cc content::RenderFrameHostImpl::ProcessBeforeUnloadCompletedFromFrame(bool, bool, content::RenderFrameHostImpl*, bool, base::TimeTicks const&, base::TimeTicks const&, bool) + 896
45 Electron Framework 0x000000011f15c08c _ZN4base8internal7InvokerINS0_9BindStateIZN7content19RenderFrameHostImpl16SendBeforeUnloadEbNS_7WeakPtrIS4_EEbE3$_0JS6_bEEEFvbNS_9TimeTicksES9_EE7RunOnceEPNS0_13BindStateBaseEbOS9_SE_ + 220
46 Electron Framework 0x000000011c345e00 base::OnceCallback<void (bool, base::TimeTicks, base::TimeTicks)>::Run(bool, base::TimeTicks, base::TimeTicks) && + 88
47 Electron Framework 0x000000011f15c158 _ZN4base8internal7InvokerINS0_9BindStateIZN7content19RenderFrameHostImpl16SendBeforeUnloadEbNS_7WeakPtrIS4_EEbE3$_1JNS_12OnceCallbackIFvbNS_9TimeTicksES9_EEES9_S9_EEEFvvEE7RunOnceEPNS0_13BindStateBaseE + 48
48 Electron Framework 0x000000011ae56780 base::OnceCallback<void ()>:
Electron exited with signal SIGTRAP.
In my project, it happens when loadUrl(1.html) -> location.replace(2.html) -> location.replace(1.html) => crashed! But when i set plugin false, this problem disappeares(the flash plugin is set)
It looks very much like this also happens with Electron 27. I used Electron fiddle with https://gist.github.com/trungutt/411a6b6161273367f5aee598d9585770