You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Closing Node file watcher just before removing iframe throws illegal access errors #40607
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
27.1.2
What operating system are you using?
Windows
Operating System Version
Windows 11 Pro 22H2
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
Removing an iframe after closing a file watcher should not throw any errors.
Actual Behavior
When you close a file watcher just before removing an iframe you see 2 or 3 Uncaught illegal access errors in the console. A workaround is to do the iframe removal first and then close the file watcher.
This is also happening on Mac as well and also on all Electron versions!
Seems there is some fundamental error in cleaning up the node environment in from js contexts when file system is involved. So watchers and save actions seems to trigger in node additional calls while the js environment is been destroyed by Electron.
@codebytere any progress here? The issue seems to be even bigger as we experience the same illegal access errors also on file system actions directly after closing of a native browser popup window, when another file system action like file write has been done in the window just before close.
It seems like node file system actions are still pending and loosing context, so this makes them very unreliable in combination with browser windows.
I am also quite often seeing a splurge of "Uncaught illegal access" errors in the console after closing a popup window opened using window.open. It sometimes coincides with other failures, at least in one case it caused an fs.readFile to hang, but for the most part the app continues running.
@codebytere this is becoming really an urgent and very dangerous issue as user files are getting empty, while those are being written in the browser window that is closed afterwards.
Please add more priority to this issue as our users are losing data!
Yes, this has actually turned into a serious issue here too. It doesn't just log errors, but often crashes the renderer too just after a window opened via window.open is closed. We get a render-process-gone event with exit code 6 on Mac and 134 on Windows.
I've only been able to get a stack trace on Mac so far, which looks like this:
Thread 4336980 Crashed:
0 libsystem_kernel.dylib 0x188a6a0dc __pthread_kill
1 libsystem_pthread.dylib 0x188aa1cbc pthread_kill
2 libsystem_c.dylib 0x1889ada3c abort
3 Electron Framework 0x1131cb68c node::Abort (node_errors.cc:329)
4 Electron Framework 0x1131cb308 node::Assert (node_errors.cc:344)
5 Electron Framework 0x113125bfc node::InternalCallbackScope::InternalCallbackScope (callback.cc:74)
6 Electron Framework 0x1131259c0 node::CallbackScope::CallbackScope (callback.cc:55)
7 Electron Framework 0x11318feec (anonymous namespace)::uvimpl::Work::AfterThreadPoolWork (node_api.cc:1134)
8 Electron Framework 0x113190488 node::ThreadPoolWork::ScheduleWork::'lambda'::operator() (threadpoolwork-inl.h:57)
9 Electron Framework 0x11319033c node::ThreadPoolWork::ScheduleWork::'lambda'::__invoke (threadpoolwork-inl.h:48)
10 Electron Framework 0x10cd60fec uv__work_done (threadpool.c:318)
11 Electron Framework 0x10cd64404 uv__async_io (async.c:162)
12 Electron Framework 0x10cd753c4 uv__io_poll (kqueue.c:390)
13 Electron Framework 0x10cd64848 uv_run (core.c:406)
14 Electron Framework 0x1131744bc node::Environment::CleanupHandles (env.cc:963)
15 Electron Framework 0x113174b50 node::Environment::RunCleanup (env.cc:1016)
16 Electron Framework 0x113128bd0 node::FreeEnvironment (environment.cc:449)
17 Electron Framework 0x10cf06910 electron::ElectronRendererClient::WillReleaseScriptContext (electron_renderer_client.cc:145)
18 Electron Framework 0x112f1476c content::RenderFrameImpl::WillReleaseScriptContext (render_frame_impl.cc:4450)
19 Electron Framework 0x111054fe0 blink::LocalWindowProxy::DisposeContext (local_window_proxy.cc:109)
20 Electron Framework 0x111058124 blink::WindowProxyManager::ClearForClose (window_proxy_manager.cc:23)
21 Electron Framework 0x11148fc0c blink::Frame::Detach (frame.cc:136)
22 Electron Framework 0x1119c9d38 blink::Page::WillBeDestroyed (page.cc:987)
23 Electron Framework 0x1120eca4c blink::WebViewImpl::Close (web_view_impl.cc:1131)
24 Electron Framework 0x10fb23e84 base::TaskAnnotator::RunTaskImpl (callback.h:152)
25 Electron Framework 0x10fb3c920 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork (task_annotator.h:88)
26 Electron Framework 0x10fae652c base::MessagePumpDefault::Run (message_pump_default.cc:40)
27 Electron Framework 0x10fb3d358 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run (thread_controller_with_message_pump_impl.cc:651)
28 Electron Framework 0x10fb098dc base::RunLoop::Run (run_loop.cc:134)
29 Electron Framework 0x112f31ba0 content::RendererMain (renderer_main.cc:339)
30 Electron Framework 0x10d0545f0 content::RunOtherNamedProcessTypeMain (content_main_runner_impl.cc:749)
31 Electron Framework 0x10d055024 content::ContentMainRunnerImpl::Run (content_main_runner_impl.cc:1122)
32 Electron Framework 0x10d053c60 content::RunContentProcess (content_main.cc:330)
33 Electron Framework 0x10d053d70 content::ContentMain (content_main.cc:347)
34 Electron Framework 0x10cd75c0c ElectronMain (electron_library_main.mm:26)
35 Fileside Helper (Renderer) 0x10411cc24 <unknown>
36 dyld 0x1887210dc start
This issue looks likely to be just a more specific instance of #36858.
Activity
gpetrov commentedon Nov 24, 2023
This is also happening on Mac as well and also on all Electron versions!
Seems there is some fundamental error in cleaning up the node environment in from js contexts when file system is involved. So watchers and save actions seems to trigger in node additional calls while the js environment is been destroyed by Electron.
@codebytere could you have a look?
gpetrov commentedon Jan 24, 2024
@codebytere any progress here? The issue seems to be even bigger as we experience the same illegal access errors also on file system actions directly after closing of a native browser popup window, when another file system action like file write has been done in the window just before close.
It seems like node file system actions are still pending and loosing context, so this makes them very unreliable in combination with browser windows.
erikjalevik commentedon Feb 6, 2024
I am also quite often seeing a splurge of "Uncaught illegal access" errors in the console after closing a popup window opened using
window.open. It sometimes coincides with other failures, at least in one case it caused anfs.readFileto hang, but for the most part the app continues running.Very much looks like the same issue.
gpetrov commentedon Mar 1, 2024
@codebytere this is becoming really an urgent and very dangerous issue as user files are getting empty, while those are being written in the browser window that is closed afterwards.
Please add more priority to this issue as our users are losing data!
erikjalevik commentedon Mar 22, 2024
Yes, this has actually turned into a serious issue here too. It doesn't just log errors, but often crashes the renderer too just after a window opened via
window.openis closed. We get arender-process-goneevent with exit code 6 on Mac and 134 on Windows.I've only been able to get a stack trace on Mac so far, which looks like this:
This issue looks likely to be just a more specific instance of #36858.
gpetrov commentedon Sep 4, 2024
@codebytere any further developments? The issue still happens on Electron 32 and 33 alpha 1
fix: illegal access errors when a same-process child window or subfra…
fix: illegal access errors when a same-process child window or subfra…
fix: illegal access errors when a same-process child window or subfra…
fix: illegal access errors when a same-process child window or subfra…
fix: illegal access errors when a same-process child window or subfra…