electron: [Bug]: Electron crashes under Wayland

Preflight Checklist

Electron Version

25.4.0

What operating system are you using?

Other Linux

Operating System Version

6.3.11

What arch are you using?

x64

Last Known Working Electron version

22

Expected Behavior

  • Run electron-fiddle --enable-features=UseOzonePlatform --ozone-platform=wayland.
  • Electron fiddle editor shows up.

Actual Behavior

Electron fiddle crashed after creating the main window.

Testcase Gist URL

No response

Additional Information

I’m using Sway as the compositor.

Attached is the gdb core dump file: core.zip

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 76
  • Comments: 28 (4 by maintainers)

Most upvoted comments

This crash is the upstream issue of https://github.com/microsoft/vscode/issues/184124. If we look at the data there, >20 users have reported this electron crash. This implies possibly there are hundreds of unreported instances. Is there a chance this bug can be prioritized?

Can we get someone assigned to this? (@codebytere?)

Sorry for the delayed response and thanks for testing the builds, it is good to know that startup crash is avoided. Based on the traces from https://github.com/electron/electron/issues/39449#issuecomment-1793113439 there is one crash when rebuilding the menu and another crash when window title changes, both happens on opening new window. I will continue working on this issue next week, if someone else is interested in the mean time feel free to look into it.

I compiled electron-25.9.6 with C*FLAGS=-O0 -g and got the stack trace of startup crash with value of variables:

startup crash
* thread #1, name = 'electron', stop reason = signal SIGSEGV: address not mapped to object
  * frame #0: 0x000055d50c290350 electron`ui::Layer::parent() const [inlined] base::raw_ptr<ui::Layer, (base::RawPtrTraits)0>::GetForExtraction(this=0x0000000001010129) const at raw_ptr.h:1029:47
    frame #1: 0x000055d50c290350 electron`ui::Layer::parent() const [inlined] base::raw_ptr<ui::Layer, (base::RawPtrTraits)0>::operator ui::Layer*(this=0x0000000001010129) const at raw_ptr.h:802:59
    frame #2: 0x000055d50c290350 electron`ui::Layer::parent(this=0x0000000001010101) const at layer.h:166:40
    frame #3: 0x000055d50c6026aa electron`ui::(anonymous namespace)::GetRoot(layer=0x0000000001010101) at layer.cc:60:17
    frame #4: 0x000055d50c604b05 electron`ui::Layer::ConvertPointToLayer(source=0x0000357c00df3b80, target=0x0000357c00df1500, use_target_transform=true, point=0x00007ffcdb0ce130) at layer.cc:820:29
    frame #5: 0x000055d50c211ed2 electron`aura::Window::ConvertPointToTarget(source=0x0000357c009c8600, target=0x0000357c00353400, point=0x00007ffcdb0ce130) at window.cc:614:5
    frame #6: 0x000055d50c211f1d electron`aura::Window::ConvertPointToTarget(source=0x0000357c009c8600, target=0x0000357c00353400, point=0x00007ffcdb0ce160) at window.cc:624:3
    frame #7: 0x000055d50c20f5b0 electron`aura::Window::ConvertRectToTarget(source=0x0000357c009c8600, target=0x0000357c00353400, rect=0x00007ffcdb0ce1fc) at window.cc:634:3
    frame #8: 0x000055d50c23508b electron`aura::WindowEventDispatcher::OnWindowBoundsChanged(this=0x0000357c0028df00, window=0x0000357c00c46600, old_bounds=0x00007ffcdb0ce45c, new_bounds=0x0000357c00c466e8, reason=NOT_FROM_ANIMATION) at window_event_dispatcher.cc:732:5
    frame #9: 0x000055d50c21602d electron`aura::Window::OnLayerBoundsChanged(this=0x0000357c00c46600, old_bounds=0x00007ffcdb0ce45c, reason=NOT_FROM_ANIMATION) at window.cc:1430:14
    frame #10: 0x000055d50c607ba1 electron`ui::Layer::SetBoundsFromAnimation(this=0x0000357c00df6580, bounds=0x00007ffcdb0ce5a8, reason=NOT_FROM_ANIMATION) at layer.cc:1519:16
    frame #11: 0x000055d50c64970e electron`ui::LayerAnimator::SetBounds(this=0x0000357c00b27980, value=0x00007ffcdb0ce5a8) at layer_animator.cc:113:1
    frame #12: 0x000055d50c6004e6 electron`ui::Layer::SetBounds(this=0x0000357c00df6580, bounds=0x00007ffcdb0ce5a8) at layer.cc:507:18
    frame #13: 0x000055d50c20fe94 electron`aura::Window::SetBoundsInternal(this=0x0000357c00c46600, new_bounds=0x00007ffcdb0ce5a8) at window.cc:974:12
    frame #14: 0x000055d50c20fe35 electron`aura::Window::SetBounds(this=0x0000357c00c46600, new_bounds=0x00007ffcdb0ce6c8) at window.cc:469:5
    frame #15: 0x000055d5052b35b6 electron`content::RenderWidgetHostViewAura::InternalSetBounds(this=0x0000357c00f4a900, rect=0x00007ffcdb0ce6c8) at render_widget_host_view_aura.cc:2499:14
    frame #16: 0x000055d5052b3553 electron`content::RenderWidgetHostViewAura::SetSize(this=0x0000357c00f4a900, size=0x0000357c009c86f0) at render_widget_host_view_aura.cc:413:3
    frame #17: 0x000055d50569b282 electron`content::WebContentsViewAura::OnBoundsChanged(this=0x0000357c00b3ce00, old_bounds=0x00007ffcdb0ce8fc, new_bounds=0x0000357c009c86e8) at web_contents_view_aura.cc:1286:11
    frame #18: 0x000055d50c215ec3 electron`aura::Window::OnLayerBoundsChanged(this=0x0000357c009c8600, old_bounds=0x00007ffcdb0ce8fc, reason=NOT_FROM_ANIMATION) at window.cc:1428:16
    frame #19: 0x000055d50c607ba1 electron`ui::Layer::SetBoundsFromAnimation(this=0x0000357c00df3b80, bounds=0x00007ffcdb0cea48, reason=NOT_FROM_ANIMATION) at layer.cc:1519:16
    frame #20: 0x000055d50c64970e electron`ui::LayerAnimator::SetBounds(this=0x0000357c013170c0, value=0x00007ffcdb0cea48) at layer_animator.cc:113:1
    frame #21: 0x000055d50c6004e6 electron`ui::Layer::SetBounds(this=0x0000357c00df3b80, bounds=0x00007ffcdb0cea48) at layer.cc:507:18
    frame #22: 0x000055d50c20fe94 electron`aura::Window::SetBoundsInternal(this=0x0000357c009c8600, new_bounds=0x00007ffcdb0cea48) at window.cc:974:12
    frame #23: 0x000055d50c20fe35 electron`aura::Window::SetBounds(this=0x0000357c009c8600, new_bounds=0x00007ffcdb0ceb08) at window.cc:469:5
    frame #24: 0x000055d514c7bf62 electron`views::NativeViewHostAura::ShowWidget(this=0x0000357c00a47b00, x=0, y=0, w=421, h=517, native_w=421, native_h=517) at native_view_host_aura.cc:238:25
    frame #25: 0x000055d514c79070 electron`views::NativeViewHost::Layout(this=0x0000357c00df4d00) at native_view_host.cc:144:22
    frame #26: 0x000055d514a7b4fe electron`views::View::SetBoundsRect(this=0x0000357c00df4d00, bounds=0x00007ffcdb0cf080) at view.cc:435:5
    frame #27: 0x000055d514c76a3f electron`views::WebView::OnBoundsChanged(this=0x0000357c00df4980, previous_bounds=0x00007ffcdb0cf31c) at webview.cc:188:14
    frame #28: 0x000055d514a7b373 electron`views::View::SetBoundsRect(this=0x0000357c00df4980, bounds=0x00007ffcdb0cf3f8) at view.cc:428:3
    frame #29: 0x000055d4fb0e0465 electron`electron::InspectableWebContentsViewViews::Layout(this=0x0000357c00df3f00) at inspectable_web_contents_view_views.cc:218:25
    frame #30: 0x000055d514a7b4fe electron`views::View::SetBoundsRect(this=0x0000357c00df3f18, bounds=0x00007ffcdb0cf6b8) at view.cc:435:5
    frame #31: 0x000055d4fb0e9982 electron`electron::RootView::Layout(this=0x0000357c01259048) at root_view.cc:187:28
    frame #32: 0x000055d514a7b4fe electron`views::View::SetBoundsRect(this=0x0000357c01259048, bounds=0x0000357c013f6bec) at view.cc:435:5
    frame #33: 0x000055d514a3a40d electron`views::LayoutManagerBase::ApplyLayout(this=0x0000357c0127e700, layout=0x00007ffcdb0cfa30) at layout_manager_base.cc:187:21
    frame #34: 0x000055d514a3a1f5 electron`views::LayoutManagerBase::LayoutImpl(this=0x0000357c0127e700) at layout_manager_base.cc:162:3
    frame #35: 0x000055d514a39ab8 electron`views::LayoutManagerBase::Layout(this=0x0000357c0127e700, host=0x0000357c00df3480) at layout_manager_base.cc:86:3
    frame #36: 0x000055d514a7e686 electron`views::View::Layout(this=0x0000357c00df3480) at view.cc:858:25
    frame #37: 0x000055d514a7b4fe electron`views::View::SetBoundsRect(this=0x0000357c00df3480, bounds=0x00007ffcdb0cfe20) at view.cc:435:5
    frame #38: 0x000055d514b18e77 electron`views::NonClientFrameView::Layout(this=0x0000357c00df3800) at non_client_view.cc:125:16
    frame #39: 0x000055d514a7b4fe electron`views::View::SetBoundsRect(this=0x0000357c00df3800, bounds=0x00007ffcdb0d00e8) at view.cc:435:5
    frame #40: 0x000055d514b1a202 electron`views::NonClientView::Layout(this=0x0000357c00df3100) at non_client_view.cc:271:16
    frame #41: 0x000055d514a7b4fe electron`views::View::SetBoundsRect(this=0x0000357c00df3100, bounds=0x00007ffcdb0d03c0) at view.cc:435:5
    frame #42: 0x000055d514a8a709 electron`views::View::DefaultFillLayout::Layout(this=0x0000357c01308198, host=0x0000357c01308000) at view.cc:3631:14
    frame #43: 0x000055d514a7e686 electron`views::View::Layout(this=0x0000357c01308000) at view.cc:858:25
    frame #44: 0x000055d514a7b4fe electron`views::View::SetBoundsRect(this=0x0000357c01308000, bounds=0x00007ffcdb0d0738) at view.cc:435:5
    frame #45: 0x000055d514a7adbc electron`views::View::SetBounds(this=0x0000357c01308000, x=0, y=0, width=421, height=517) at view.cc:377:3
    frame #46: 0x000055d514a7c086 electron`views::View::SetSize(this=0x0000357c01308000, size=0x00007ffcdb0d08b8) at view.cc:465:3
    frame #47: 0x000055d514ac3ed6 electron`views::Widget::OnNativeWidgetSizeChanged(this=0x0000357c01096580, new_size=0x00007ffcdb0d08b8) at widget.cc:1641:11
    frame #48: 0x000055d514b6c567 electron`views::DesktopNativeWidgetAura::OnHostResized(this=0x0000357c01299240, host=0x0000357c00319f00) at desktop_native_widget_aura.cc:1460:28
    frame #49: 0x000055d50c2a5a8f electron`aura::WindowTreeHost::OnHostResizedInPixels(this=0x0000357c00319f00, new_size_in_pixels=0x00007ffcdb0d0c90) at window_tree_host.cc:689:14
    frame #50: 0x000055d50c5d45d0 electron`aura::WindowTreeHostPlatform::OnBoundsChanged(this=0x0000357c00319f00, change=0x00007ffcdb0d0d7e) at window_tree_host_platform.cc:218:5
    frame #51: 0x000055d4fb0b0ec1 electron`electron::ElectronDesktopWindowTreeHostLinux::OnBoundsChanged(this=0x0000357c00319f00, change=0x00007ffcdb0d0d7e) at electron_desktop_window_tree_host_linux.cc:57:38
    frame #52: 0x000055d50c5d4ece electron`aura::WindowTreeHostPlatform::OnStateUpdate(this=0x0000357c00319f00, old=0x00007ffcdb0d0dc0, latest=0x0000357c00b3cb98) at window_tree_host_platform.cc:309:5
    frame #53: 0x000055d4fd545e4a electron`ui::WaylandWindow::MaybeApplyLatestStateRequest(this=0x0000357c00df2d80, force=false) at wayland_window.cc:1254:32
    frame #54: 0x000055d4fd5459e3 electron`ui::WaylandWindow::RequestState(this=0x0000357c00df2d80, state=State @ 0x00007ffcdb0d0ff0, serial=74844, force=false) at wayland_window.cc:1110:3
    frame #55: 0x000055d4fd545658 electron`ui::WaylandWindow::RequestStateFromServer(this=0x0000357c00df2d80, state=State @ 0x00007ffcdb0d1050, serial=74844) at wayland_window.cc:1057:3
    frame #56: 0x000055d4fd54559d electron`ui::WaylandWindow::ProcessPendingConfigureState(this=0x0000357c00df2d80, serial=74844) at wayland_window.cc:1049:3
    frame #57: 0x000055d4fd53bbeb electron`ui::WaylandToplevelWindow::HandleSurfaceConfigure(this=0x0000357c00df2d80, serial=74844) at wayland_toplevel_window.cc:527:3
    frame #58: 0x000055d4fd5949b7 electron`ui::XDGSurfaceWrapperImpl::Configure(data=0x0000357c013f6ca0, xdg_surface=0x0000357c00a67f70, serial=74844) at xdg_surface_wrapper_impl.cc:93:16
    frame #59: 0x00007f3f792314fa libffi.so.8`___lldb_unnamed_symbol80 + 82
    frame #60: 0x00007f3f79235cf0 libffi.so.8`___lldb_unnamed_symbol98 + 832
    frame #61: 0x00007f3f79235984 libffi.so.8`ffi_call + 244
    frame #62: 0x000055d50aeea6eb electron`wl_closure_invoke(closure=0x0000357c022bf3a0, flags=1, target=0x0000357c00a67f70, opcode=0, data=0x0000357c013f6ca0) at connection.c:1172:2
    frame #63: 0x000055d50aee78e6 electron`dispatch_event(display=0x0000357c00286580, queue=0x0000357c00a2a460) at wayland-client.c:1595:3
    frame #64: 0x000055d50aee667b electron`dispatch_queue(display=0x0000357c00286580, queue=0x0000357c00a2a460) at wayland-client.c:1741:3
    frame #65: 0x000055d50aee6464 electron`wl_display_dispatch_queue_pending(display=0x0000357c00286580, queue=0x0000357c00a2a460) at wayland-client.c:1983:8
    frame #66: 0x000055d4fd5dddf6 electron`ui::WaylandEventWatcher::WlDisplayDispatchPendingQueue(this=0x0000357c00a2c940) at wayland_event_watcher.cc:183:7
    frame #67: 0x000055d4fd5df7d5 electron`ui::WaylandEventWatcherGlib::HandleDispatch(this=0x0000357c00a2c940) at wayland_event_watcher_glib.cc:123:3
    frame #68: 0x000055d4fd5df9e0 electron`ui::(anonymous namespace)::WatchSourceDispatch(source=0x0000357c012a07e0, unused_func=0x0000000000000000, data=0x0000000000000000) at wayland_event_watcher_glib.cc:53:23
    frame #69: 0x00007f3f7b3382a3 libglib-2.0.so.0`g_main_context_dispatch_unlocked at gmain.c:3476:27
    frame #70: 0x00007f3f7b33815d libglib-2.0.so.0`g_main_context_dispatch_unlocked(context=0x0000357c00230f00) at gmain.c:4284:7
    frame #71: 0x00007f3f7b338773 libglib-2.0.so.0`g_main_context_iterate_unlocked(context=0x0000357c00230f00, block=1, dispatch=1, self=<unavailable>) at gmain.c:4349:5
    frame #72: 0x00007f3f7b3388dd libglib-2.0.so.0`g_main_context_iteration(context=0x0000357c00230f00, may_block=1) at gmain.c:4414:12
    frame #73: 0x000055d50843a05c electron`base::MessagePumpGlib::Run(this=0x0000357c0021af80, delegate=0x0000357c00328110) at message_pump_glib.cc:659:30
    frame #74: 0x000055d508313cf5 electron`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(this=0x0000357c00328000, application_tasks_allowed=true, timeout=TimeDelta @ 0x00007ffcdb0d1b28) at thread_controller_with_message_pump_impl.cc:651:12
    frame #75: 0x000055d50825f197 electron`base::RunLoop::Run(this=0x0000357c00d87f00, location=0x00007ffcdb0d1c78) at run_loop.cc:134:14
    frame #76: 0x000055d5042824f0 electron`content::BrowserMainLoop::RunMainMessageLoop(this=0x0000357c00290dc0) at browser_main_loop.cc:1072:18
    frame #77: 0x000055d50428ddd5 electron`content::BrowserMainRunnerImpl::Run(this=0x0000357c003358f0) at browser_main_runner_impl.cc:158:15
    frame #78: 0x000055d50427e515 electron`content::BrowserMain(parameters=MainFunctionParams @ 0x00007ffcdb0d1da8) at browser_main.cc:34:28
    frame #79: 0x000055d4fb8847e3 electron`content::RunBrowserProcessMain(main_function_params=MainFunctionParams @ 0x00007ffcdb0d1ed8, delegate=0x00007ffcdb0d2518) at content_main_runner_impl.cc:710:10
    frame #80: 0x000055d4fb886b2c electron`content::ContentMainRunnerImpl::RunBrowser(this=0x0000357c00228200, main_params=MainFunctionParams @ 0x00007ffcdb0d2138, start_minimal_browser=false) at content_main_runner_impl.cc:1280:10
    frame #81: 0x000055d4fb88626f electron`content::ContentMainRunnerImpl::Run(this=0x0000357c00228200) at content_main_runner_impl.cc:1134:12
    frame #82: 0x000055d4fb882925 electron`content::RunContentProcess(params=ContentMainParams @ 0x00007ffcdb0d24c0, content_main_runner=0x0000357c00228200) at content_main.cc:330:36
    frame #83: 0x000055d4fb882df6 electron`content::ContentMain(params=ContentMainParams @ 0x00007ffcdb0d25b8) at content_main.cc:347:10
    frame #84: 0x000055d4fab0db0e electron`main(argc=3, argv=0x00007ffcdb0d2668) at electron_main_linux.cc:40:10
    frame #85: 0x00007f3f7b993057 ld-musl-x86_64.so.1`libc_start_main_stage2(main=(electron`main at electron_main_linux.cc:21), argc=<unavailable>, argv=0x00007ffcdb0d2668) at __libc_start_main.c:99:7
    frame #86: 0x000055d4faae3016 electron`_start + 22

With patch from @deepak1556, electron didn’t crash at startup or opening a new window, but when I closed one window, both crashed.

crash when close window
* thread #1, name = 'electron', stop reason = signal SIGSEGV: address not mapped to object
  * frame #0: 0x0000557aa21843d0 electron`ui::Layer::parent() const [inlined] base::raw_ptr<ui::Layer, (base::RawPtrTraits)0>::GetForExtraction(this=0x0000000001010129) const at raw_ptr.h:1029:47
    frame #1: 0x0000557aa21843d0 electron`ui::Layer::parent() const [inlined] base::raw_ptr<ui::Layer, (base::RawPtrTraits)0>::operator ui::Layer*(this=0x0000000001010129) const at raw_ptr.h:802:59
    frame #2: 0x0000557aa21843d0 electron`ui::Layer::parent(this=0x0000000001010101) const at layer.h:166:40
    frame #3: 0x0000557aa24f672a electron`ui::(anonymous namespace)::GetRoot(layer=0x0000000001010101) at layer.cc:60:17
    frame #4: 0x0000557aa24f66a5 electron`ui::Layer::GetCompositor(this=0x000018e800e3fb80) const at layer.cc:354:10
    frame #5: 0x0000557aa210edd5 electron`ui::Layer::GetCompositor(this=0x000018e800e3fb80) at layer.h:118:41
    frame #6: 0x0000557aa24f295d electron`ui::Layer::Remove(this=0x000018e800e3fb80, child=0x000018e800e42580) at layer.cc:421:28
    frame #7: 0x0000557aa21054c1 electron`aura::Window::RemoveChildImpl(this=0x000018e80127a400, child=0x000018e800c4e800, new_parent=0x0000000000000000) at window.cc:1050:14
    frame #8: 0x0000557aa2102536 electron`aura::Window::RemoveChild(this=0x000018e80127a400, child=0x000018e800c4e800) at window.cc:566:3
    frame #9: 0x0000557aa21014b9 electron`aura::Window::~Window(this=0x000018e800c4e800) at window.cc:227:14
    frame #10: 0x0000557aa2102689 electron`aura::Window::~Window(this=0x000018e800c4e800) at window.cc:185:19
    frame #11: 0x0000557a9b1a91b1 electron`content::RenderWidgetHostViewAura::Destroy(this=0x000018e800e13300) at render_widget_host_view_aura.cc:844:5
    frame #12: 0x0000557a9b1581ee electron`content::RenderWidgetHostImpl::Destroy(this=0x000018e800d24800, also_delete=false) at render_widget_host_impl.cc:2421:12
    frame #13: 0x0000557a9b1598e0 electron`content::RenderWidgetHostImpl::ShutdownAndDestroyWidget(this=0x000018e800d24800, also_delete=false) at render_widget_host_impl.cc:794:3
    frame #14: 0x0000557a9b14276f electron`content::RenderViewHostImpl::~RenderViewHostImpl(this=0x000018e801343340) at render_view_host_impl.cc:371:16
    frame #15: 0x0000557a9b142db9 electron`content::RenderViewHostImpl::~RenderViewHostImpl(this=0x000018e801343340) at render_view_host_impl.cc:364:43
    frame #16: 0x0000557a9ad6f318 electron`void base::RefCounted<content::RenderViewHostImpl, base::DefaultRefCountedTraits<content::RenderViewHostImpl>>::DeleteInternal<content::RenderViewHostImpl>(x=0x000018e801343340) at ref_counted.h:367:5
    frame #17: 0x0000557a9ad6f2e5 electron`base::DefaultRefCountedTraits<content::RenderViewHostImpl>::Destruct(x=0x000018e801343340) at ref_counted.h:331:5
    frame #18: 0x0000557a9ad6f2c3 electron`base::RefCounted<content::RenderViewHostImpl, base::DefaultRefCountedTraits<content::RenderViewHostImpl>>::Release(this=0x000018e801343378) const at ref_counted.h:356:7
    frame #19: 0x0000557a9ad6f282 electron`scoped_refptr<content::RenderViewHostImpl>::Release(ptr=0x000018e801343340) at scoped_refptr.h:382:8
    frame #20: 0x0000557a9ad69c5a electron`scoped_refptr<content::RenderViewHostImpl>::~scoped_refptr(this=0x00007ffe59b933e0) at scoped_refptr.h:280:7
    frame #21: 0x0000557a9b038713 electron`scoped_refptr<content::RenderViewHostImpl>::reset(this=0x000018e8008310d0) at scoped_refptr.h:310:18
    frame #22: 0x0000557a9aff5ac6 electron`content::RenderFrameHostImpl::~RenderFrameHostImpl(this=0x000018e800831000) at render_frame_host_impl.cc:1858:21
    frame #23: 0x0000557a9aff8019 electron`content::RenderFrameHostImpl::~RenderFrameHostImpl(this=0x000018e800831000) at render_frame_host_impl.cc:1681:45
    frame #24: 0x0000557a9b0c2d0c electron`std::__1::default_delete<content::RenderFrameHostImpl>::operator()[abi:un170005](this=0x00007ffe59b93c28, __ptr=0x000018e800831000) const at unique_ptr.h:68:5
    frame #25: 0x0000557a9b0bbdba electron`std::__1::unique_ptr<content::RenderFrameHostImpl, std::__1::default_delete<content::RenderFrameHostImpl>>::reset[abi:un170005](this=0x00007ffe59b93c28, __p=0x0000000000000000) at unique_ptr.h:300:7
    frame #26: 0x0000557a9b0bb799 electron`std::__1::unique_ptr<content::RenderFrameHostImpl, std::__1::default_delete<content::RenderFrameHostImpl>>::~unique_ptr[abi:un170005](this=0x00007ffe59b93c28) at unique_ptr.h:266:75
    frame #27: 0x0000557a9b0a7a2c electron`content::RenderFrameHostManager::~RenderFrameHostManager(this=0x000018e80088bfe0) at render_frame_host_manager.cc:420:3
    frame #28: 0x0000557a9adc64cc electron`content::FrameTreeNode::~FrameTreeNode(this=0x000018e80088bbb8) at frame_tree_node.cc:311:1
    frame #29: 0x0000557a9adb6959 electron`content::FrameTree::~FrameTree(this=0x000018e80088b980) at frame_tree.cc:227:1
    frame #30: 0x0000557a9b500ad4 electron`content::WebContentsImpl::~WebContentsImpl(this=0x000018e80088b800) at web_contents_impl.cc:1184:1
    frame #31: 0x0000557a9b501249 electron`content::WebContentsImpl::~WebContentsImpl(this=0x000018e80088b800) at web_contents_impl.cc:1073:37
    frame #32: 0x0000557a90c5532c electron`std::__1::default_delete<content::WebContents>::operator()[abi:un170005](this=0x000018e800f56108, __ptr=0x000018e80088b800) const at unique_ptr.h:68:5
    frame #33: 0x0000557a90c552fa electron`std::__1::unique_ptr<content::WebContents, std::__1::default_delete<content::WebContents>>::reset[abi:un170005](this=0x000018e800f56108, __p=0x0000000000000000) at unique_ptr.h:300:7
    frame #34: 0x0000557a90c31739 electron`std::__1::unique_ptr<content::WebContents, std::__1::default_delete<content::WebContents>>::~unique_ptr[abi:un170005](this=0x000018e800f56108) at unique_ptr.h:266:75
    frame #35: 0x0000557a90e260e0 electron`electron::InspectableWebContents::~InspectableWebContents(this=0x000018e800f56080) at inspectable_web_contents.cc:390:1
    frame #36: 0x0000557a90e26209 electron`electron::InspectableWebContents::~InspectableWebContents(this=0x000018e800f56080) at inspectable_web_contents.cc:384:51
    frame #37: 0x0000557a90c5475c electron`std::__1::default_delete<electron::InspectableWebContents>::operator()[abi:un170005](this=0x000018e800e11e20, __ptr=0x000018e800f56080) const at unique_ptr.h:68:5
    frame #38: 0x0000557a90c546ea electron`std::__1::unique_ptr<electron::InspectableWebContents, std::__1::default_delete<electron::InspectableWebContents>>::reset[abi:un170005](this=0x000018e800e11e20, __p=0x0000000000000000) at unique_ptr.h:300:7
    frame #39: 0x0000557a90c333f9 electron`std::__1::unique_ptr<electron::InspectableWebContents, std::__1::default_delete<electron::InspectableWebContents>>::~unique_ptr[abi:un170005](this=0x000018e800e11e20) at unique_ptr.h:266:75
    frame #40: 0x0000557a90c190fc electron`electron::api::WebContents::~WebContents(this=0x000018e800e11a00) at electron_api_web_contents.cc:1123:1
    frame #41: 0x0000557a90c194f9 electron`electron::api::WebContents::~WebContents(this=0x000018e800e11a00) at electron_api_web_contents.cc:1091:29
    frame #42: 0x0000557a90c196f9 electron`electron::api::WebContents::DeleteThisIfAlive(this=0x000018e800e11a00) at electron_api_web_contents.cc:1135:3
    frame #43: 0x0000557a90c574df electron`void base::internal::FunctorTraits<void (electron::api::WebContents::*)(), void>::Invoke<void (electron::api::WebContents::*)(), base::WeakPtr<electron::api::WebContents> const&>(method=(electron`electron::api::WebContents::DeleteThisIfAlive() at electron_api_web_contents.cc:1125), receiver_ptr=0x000018e801bbaaf0) at bind_internal.h:746:12
    frame #44: 0x0000557a90c5740d electron`void base::internal::InvokeHelper<true, void, 0ul>::MakeItSo<void (electron::api::WebContents::*)(), std::__1::tuple<base::WeakPtr<electron::api::WebContents>>>(functor=0x000018e801bbaae0, bound=size=1) at bind_internal.h:953:5
    frame #45: 0x0000557a90c5738d electron`void base::internal::Invoker<base::internal::BindState<void (electron::api::WebContents::*)(), base::WeakPtr<electron::api::WebContents>>, void ()>::RunImpl<void (electron::api::WebContents::*)(), std::__1::tuple<base::WeakPtr<electron::api::WebContents>>, 0ul>(functor=0x000018e801bbaae0, bound=size=1, seq=std::__1::index_sequence<0UL> @ 0x00007ffe59b94abf) at bind_internal.h:1025:12
    frame #46: 0x0000557a90c57317 electron`base::internal::Invoker<base::internal::BindState<void (electron::api::WebContents::*)(), base::WeakPtr<electron::api::WebContents>>, void ()>::RunOnce(base=0x000018e801bbaac0) at bind_internal.h:976:12
    frame #47: 0x0000557a90a0f6e1 electron`base::OnceCallback<void ()>::Run(this=0x000018e800b3b000) && at callback.h:152:12
    frame #48: 0x0000557a9e1ba6d3 electron`base::TaskAnnotator::RunTaskImpl(this=0x000018e800328218, pending_task=0x000018e800b3b000) at task_annotator.cc:186:34
    frame #49: 0x0000557a9e2076c0 electron`void base::TaskAnnotator::RunTask<base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*)::$_0>(this=0x000018e800328218, event_name=(value = ""), pending_task=0x000018e800b3b000, args=0x00007ffe59b94cd8) at task_annotator.h:89:5
    frame #50: 0x0000557a9e2072a6 electron`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(this=0x000018e800328000, continuation_lazy_now=0x00007ffe59b95118) at thread_controller_with_message_pump_impl.cc:486:23
    frame #51: 0x0000557a9e20647c electron`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork(this=0x000018e800328000) at thread_controller_with_message_pump_impl.cc:351:41
    frame #52: 0x0000557a9e207643 electron`non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() at thread_controller_with_message_pump_impl.cc:0
    frame #53: 0x0000557a9e32dbba electron`base::MessagePumpGlib::HandleDispatch(this=0x000018e80021af80) at message_pump_glib.cc:625:46
    frame #54: 0x0000557a9e32f20c electron`base::(anonymous namespace)::WorkSourceDispatch(source=0x000018e8002aa610, unused_func=0x0000000000000000, unused_data=0x0000000000000000) at message_pump_glib.cc:274:43
    frame #55: 0x00007f15419b32a3 libglib-2.0.so.0`g_main_context_dispatch_unlocked at gmain.c:3476:27
    frame #56: 0x00007f15419b315d libglib-2.0.so.0`g_main_context_dispatch_unlocked(context=0x000018e800230f00) at gmain.c:4284:7
    frame #57: 0x00007f15419b3773 libglib-2.0.so.0`g_main_context_iterate_unlocked(context=0x000018e800230f00, block=0, dispatch=1, self=<unavailable>) at gmain.c:4349:5
    frame #58: 0x00007f15419b38dd libglib-2.0.so.0`g_main_context_iteration(context=0x000018e800230f00, may_block=0) at gmain.c:4414:12
    frame #59: 0x0000557a9e32e05c electron`base::MessagePumpGlib::Run(this=0x000018e80021af80, delegate=0x000018e800328110) at message_pump_glib.cc:659:30
    frame #60: 0x0000557a9e207cf5 electron`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(this=0x000018e800328000, application_tasks_allowed=true, timeout=TimeDelta @ 0x00007ffe59b95788) at thread_controller_with_message_pump_impl.cc:651:12
    frame #61: 0x0000557a9e153197 electron`base::RunLoop::Run(this=0x000018e800db7f30, location=0x00007ffe59b958d8) at run_loop.cc:134:14
    frame #62: 0x0000557a9a1764f0 electron`content::BrowserMainLoop::RunMainMessageLoop(this=0x000018e800290dc0) at browser_main_loop.cc:1072:18
    frame #63: 0x0000557a9a181dd5 electron`content::BrowserMainRunnerImpl::Run(this=0x000018e8003358f0) at browser_main_runner_impl.cc:158:15
    frame #64: 0x0000557a9a172515 electron`content::BrowserMain(parameters=MainFunctionParams @ 0x00007ffe59b95a08) at browser_main.cc:34:28
    frame #65: 0x0000557a917787e3 electron`content::RunBrowserProcessMain(main_function_params=MainFunctionParams @ 0x00007ffe59b95b38, delegate=0x00007ffe59b96178) at content_main_runner_impl.cc:710:10
    frame #66: 0x0000557a9177ab2c electron`content::ContentMainRunnerImpl::RunBrowser(this=0x000018e800228200, main_params=MainFunctionParams @ 0x00007ffe59b95d98, start_minimal_browser=false) at content_main_runner_impl.cc:1280:10
    frame #67: 0x0000557a9177a26f electron`content::ContentMainRunnerImpl::Run(this=0x000018e800228200) at content_main_runner_impl.cc:1134:12
    frame #68: 0x0000557a91776925 electron`content::RunContentProcess(params=ContentMainParams @ 0x00007ffe59b96120, content_main_runner=0x000018e800228200) at content_main.cc:330:36
    frame #69: 0x0000557a91776df6 electron`content::ContentMain(params=ContentMainParams @ 0x00007ffe59b96218) at content_main.cc:347:10
    frame #70: 0x0000557a90a01b0e electron`main(argc=3, argv=0x00007ffe59b962c8) at electron_main_linux.cc:40:10
    frame #71: 0x00007f154200e057 ld-musl-x86_64.so.1`libc_start_main_stage2(main=(electron`main at electron_main_linux.cc:21), argc=<unavailable>, argv=0x00007ffe59b962c8) at __libc_start_main.c:99:7
    frame #72: 0x0000557a909d7016 electron`_start + 22
another process crashed
* thread #1, name = 'electron', stop reason = signal SIGSEGV: address not mapped to object
  * frame #0: 0x000055a7830b7dec electron`mojo::Handle::is_valid(this=0x000000000000001f) const at handle.h:167:41
    frame #1: 0x000055a7830bbd45 electron`mojo::ScopedHandleBase<mojo::MessagePipeHandle>::is_valid(this=0x000000000000001f) const at handle.h:128:42
    frame #2: 0x000055a7831cd949 electron`mojo::Connector::is_valid(this=0x000000000000000f) const at connector.h:184:26
    frame #3: 0x000055a7832a0457 electron`electron::MessagePort::IsNeutered(this=0x00002a18002ab6b0) const at message_port.h:44:64
    frame #4: 0x000055a7832a061c electron`electron::MessagePort::IsEntangled(this=0x00002a18002ab6b0) const at message_port.h:43:50
    frame #5: 0x000055a78329e129 electron`electron::MessagePort::PostMessage(this=0x00002a18002ab6b0, args=0x00007ffd7059eeb0) at message_port.cc:66:8
    frame #6: 0x000055a7832a6d35 electron`void base::internal::FunctorTraits<void (electron::MessagePort::*)(gin::Arguments*), void>::Invoke<void (electron::MessagePort::*)(gin::Arguments*), electron::MessagePort*, gin::Arguments*>(method=(electron`electron::MessagePort::PostMessage(gin::Arguments*) at message_port.cc:65), receiver_ptr=0x00007ffd7059ed80, args=0x00007ffd7059ed78) at bind_internal.h:746:12
    frame #7: 0x000055a7832a6ca0 electron`void base::internal::InvokeHelper<false, void>::MakeItSo<void (electron::MessagePort::* const&)(gin::Arguments*), std::__1::tuple<> const&, electron::MessagePort*, gin::Arguments*>(functor=0x00002a180021ace0, bound=size=0, args=0x00007ffd7059ed80, args=0x00007ffd7059ed78) at bind_internal.h:925:12
    frame #8: 0x000055a7832a6c4d electron`void base::internal::Invoker<base::internal::BindState<void (electron::MessagePort::*)(gin::Arguments*)>, void (electron::MessagePort*, gin::Arguments*)>::RunImpl<void (electron::MessagePort::* const&)(gin::Arguments*), std::__1::tuple<> const&>(functor=0x00002a180021ace0, bound=size=0, seq=std::__1::index_sequence<> @ 0x00007ffd7059ed4f, unbound_args=0x00007ffd7059ed80, unbound_args=0x00007ffd7059ed78) at bind_internal.h:1025:12
    frame #9: 0x000055a7832a6ba7 electron`base::internal::Invoker<base::internal::BindState<void (electron::MessagePort::*)(gin::Arguments*)>, void (electron::MessagePort*, gin::Arguments*)>::Run(base=0x00002a180021acc0, unbound_args=0x00002a18002ab6b0, unbound_args=0x00007ffd7059eeb0) at bind_internal.h:989:12
    frame #10: 0x000055a7832a6af5 electron`base::RepeatingCallback<void (electron::MessagePort*, gin::Arguments*)>::Run(this=0x00007ffd7059edf8, args=0x00002a18002ab6b0, args=0x00007ffd7059eeb0) const & at callback.h:333:12
    frame #11: 0x000055a7832a61a4 electron`gin::internal::Invoker<std::__1::integer_sequence<unsigned long, 0ul, 1ul>, electron::MessagePort*, gin::Arguments*>::DispatchToCallback(this=0x00007ffd7059ee70, callback=RepeatingCallback @ 0x00007ffd7059edf8) at function_template.h:181:14
    frame #12: 0x000055a7832a5fd4 electron`gin::internal::Dispatcher<void (electron::MessagePort*, gin::Arguments*)>::DispatchToCallbackImpl(args=0x00007ffd7059eeb0) at function_template.h:213:15
    frame #13: 0x000055a7832a5df3 electron`gin::internal::Dispatcher<void (electron::MessagePort*, gin::Arguments*)>::DispatchToCallback(info=0x00007ffd7059f010) at function_template.h:219:5
    frame #14: 0x000055a787e20259 electron`v8::internal::FunctionCallbackArguments::Call(this=0x00007ffd7059f7b0, handler=CallHandlerInfo @ 0x00007ffd7059ef38) at api-arguments-inl.h:99:3
    frame #15: 0x000055a787e1e3f8 electron`v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(isolate=0x00002a1800378000, new_target=Handle @ 0x00007ffd7059f288, fun_data=Handle @ 0x00007ffd7059f280, receiver=Handle @ 0x00007ffd7059f278, argv=0x00007ffd7059fe60, argc=1) at builtins-api.cc:113:36
    frame #16: 0x000055a787e1b166 electron`v8::internal::Builtin_Impl_HandleApiCall(args=BuiltinArguments @ 0x00007ffd7059f970, isolate=0x00002a1800378000) at builtins-api.cc:144:5
    frame #17: 0x000055a787e1abc4 electron`v8::internal::Builtin_HandleApiCall(args_length=6, args_object=0x00007ffd7059fe60, isolate=0x00002a1800378000) at builtins-api.cc:135:1
    frame #18: 0x000055a78a867876 electron`Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit + 54
    frame #19: 0x000055a7e01bdf81
    frame #20: 0x000055a7e015135f
    frame #21: 0x000055a7e01515e8
    frame #22: 0x000055a7e0127bc8
    frame #23: 0x000055a78a8cfff0 electron`Builtins_PromiseFulfillReactionJob + 48
    frame #24: 0x000055a78a7fb65f electron`Builtins_RunMicrotasks + 735
    frame #25: 0x000055a78a7ce5c7 electron`Builtins_JSRunMicrotasksEntry + 135
    frame #26: 0x000055a7881fb3c6 electron`v8::internal::GeneratedCode<unsigned long, unsigned long, v8::internal::MicrotaskQueue*>::Call(this=0x00007ffd705a0280, args=46282571219072, args=0x00002a18002aafb0) at simulator.h:154:12
    frame #27: 0x000055a7881f74b6 electron`v8::internal::(anonymous namespace)::Invoke(isolate=0x00002a1800378000, params=0x00007ffd705a0ef8) at execution.cc:443:33
    frame #28: 0x000055a7881f7f58 electron`v8::internal::(anonymous namespace)::InvokeWithTryCatch(isolate=0x00002a1800378000, params=0x00007ffd705a0ef8) at execution.cc:490:20
    frame #29: 0x000055a7881f850c electron`v8::internal::Execution::TryRunMicrotasks(isolate=0x00002a1800378000, microtask_queue=0x00002a18002aafb0) at execution.cc:601:10
    frame #30: 0x000055a7882c86d7 electron`v8::internal::MicrotaskQueue::RunMicrotasks(this=0x00002a18002aafb0, isolate=0x00002a1800378000) at microtask-queue.cc:174:22
    frame #31: 0x000055a7882c8294 electron`v8::internal::MicrotaskQueue::PerformCheckpointInternal(this=0x00002a18002aafb0, v8_isolate=0x00002a1800378000) at microtask-queue.cc:126:3
    frame #32: 0x000055a787d5de67 electron`v8::internal::MicrotaskQueue::PerformCheckpoint(this=0x00002a18002aafb0, isolate=0x00002a1800378000) at microtask-queue.h:46:5
    frame #33: 0x000055a79d3ba4e2 electron`node::InternalCallbackScope::Close(this=0x00002a1800b781b0) at callback.cc:133:35
    frame #34: 0x000055a79d3ba1f9 electron`node::InternalCallbackScope::~InternalCallbackScope(this=0x00002a1800b781b0) at callback.cc:92:3
    frame #35: 0x000055a79d3b9e24 electron`node::CallbackScope::~CallbackScope(this=0x00007ffd705a1570) at callback.cc:37:3
    frame #36: 0x000055a783361cde electron`electron::MicrotasksRunner::DidProcessTask(this=0x00002a1800223cc0, pending_task=0x00002a1800370000) at microtasks_runner.cc:35:3
    frame #37: 0x000055a7907a1861 electron`base::sequence_manager::internal::SequenceManagerImpl::NotifyDidProcessTask(this=0x00002a180027d500, executing_task=0x00002a1800370000, time_after_task=0x00007ffd705a1920) at sequence_manager_impl.cc:920:16
    frame #38: 0x000055a7907a0f9c electron`base::sequence_manager::internal::SequenceManagerImpl::DidRunTask(this=0x00002a180027d500, lazy_now=0x00007ffd705a1920) at sequence_manager_impl.cc:675:3
    frame #39: 0x000055a7907e1393 electron`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(this=0x00002a18002d0280, continuation_lazy_now=0x00007ffd705a1d78) at thread_controller_with_message_pump_impl.cc:502:37
    frame #40: 0x000055a7907e047c electron`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork(this=0x00002a18002d0280) at thread_controller_with_message_pump_impl.cc:351:41
    frame #41: 0x000055a7907e1643 electron`non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() at thread_controller_with_message_pump_impl.cc:0
    frame #42: 0x000055a7906a0e6f electron`base::MessagePumpDefault::Run(this=0x00002a18002ad340, delegate=0x00002a18002d0390) at message_pump_default.cc:40:55
    frame #43: 0x000055a7907e1cf5 electron`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(this=0x00002a18002d0280, application_tasks_allowed=true, timeout=TimeDelta @ 0x00007ffd705a1ec8) at thread_controller_with_message_pump_impl.cc:651:12
    frame #44: 0x000055a79072d197 electron`base::RunLoop::Run(this=0x00007ffd705a20a8, location=0x00007ffd705a2068) at run_loop.cc:134:14
    frame #45: 0x000055a78e89504b electron`content::UtilityMain(parameters=MainFunctionParams @ 0x00007ffd705a23b8) at utility_main.cc:352:12
    frame #46: 0x000055a783d52a12 electron`content::RunOtherNamedProcessTypeMain(process_type="utility", main_function_params=MainFunctionParams @ 0x00007ffd705a24b8, delegate=0x00007ffd705a28c8) at content_main_runner_impl.cc:770:14
    frame #47: 0x000055a783d542f7 electron`content::ContentMainRunnerImpl::Run(this=0x00002a1800228200) at content_main_runner_impl.cc:1136:10
    frame #48: 0x000055a783d50925 electron`content::RunContentProcess(params=ContentMainParams @ 0x00007ffd705a2870, content_main_runner=0x00002a1800228200) at content_main.cc:330:36
    frame #49: 0x000055a783d50df6 electron`content::ContentMain(params=ContentMainParams @ 0x00007ffd705a2968) at content_main.cc:347:10
    frame #50: 0x000055a782fdbb0e electron`main(argc=21, argv=0x00007ffd705a2a18) at electron_main_linux.cc:40:10
    frame #51: 0x00007f7fd4638057 ld-musl-x86_64.so.1`libc_start_main_stage2(main=(electron`main at electron_main_linux.cc:21), argc=<unavailable>, argv=0x00007ffd705a2a18) at __libc_start_main.c:99:7
    frame #52: 0x000055a782fb1016 electron`_start + 22

I got multiple crash coredumps, and it seems the invalid pointer of ui::Layer is a constant value: 0x0000000001010101

I have struggled to reproduce this in a self-contained environment, but after spending a few minutes on it the other day, I somehow have ended up with something that causes code --user-data-dir=$(mktemp -d) (VSCode 1.85.1, which uses Electron 25.9.7) to crash before it ever shows me a window, most of the time.

It’s not perfect, but being able to do it with zero setup, repeatedly, means I can easily generate a dozen crashes in a row, whereas before, I only knew how to cause a crash with my own non-trivial ~/.config/Code data dir. (Now I suspect the only problem with my existing VSCode state is that it has maximized windows, themselves the problem)


While I could sometimes repro after spamming the “new window” keybind and mouse clicking (i.e. the double-click to maximize a window) for a while, KWin automation was way more effective. In ~/.config/kwinrulesrc I now have:

[2fd1b564-27d0-46f6-ae06-64a0470c8884]
Description=VSCode/Electron Wayland crash reproducer
maximizehoriz=true
maximizehorizrule=3
maximizevert=true
maximizevertrule=3
minimize=true
minimizerule=3
wmclass=code|electron
wmclasscomplete=true
wmclassmatch=3

And this is what it looks like in the UI (which is how I configured it, sadly I see no export/import): image


With that in place, I was able to reproduce startup crashes in Electron 26 apps as well. I’m on NixOS, so that gave me a relatively easy (if perhaps ridiculous-looking) way to try that:

env $(nix-build -E 'with import<nixpkgs>{}; pocket-casts.override { electron = electron_26; }' --no-out-link)/bin/pocket-casts \
    --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --user-data-dir=$(mktemp -d)

The electron binary from the electron_26 package itself crashed at least once, and both that and the pocket-cast-with-electron_26 were able to cause some spooky crashes in other processes (ignoring the weird GPU interactions, it looks like kwin_wayland crashed twice in QtWaylandServer::xdg_toplevel::handle_set_title calling KWin::Window::findWindowWithSameCaption which then iterates over windows - maybe that one is just a bad Wayland window state that kwin doesn’t handle correctly, hard to tell really).

One unmistakeable sign it was about to crash on startup, btw, was seeing the (minimized) window in more than one taskbar (I have per-monitor taskbars set to filter only to windows on that monitor, so the Electron window must be in a weird state for it to show up on multiple monitors’ taskbars like that).


However, repeating the same experiments with Electron 27 produced no crashes on startup (in line with e.g. https://github.com/electron/electron/issues/39449#issuecomment-1741330933). I’ve also tried VSCode Insiders (2023-12-20 build, which uses Electron 27.1.3), and I similarly couldn’t reproduce a startup crash, so if it still exists, it needs conditions I’m not accounting for (or is harder to hit).

Sadly, the exit/window close crashes are still there, but they’d be less disurptive to my VSCode experience than not being able to start it at all (without forcing XWayland and passing --disable-gpu).

After more experimentation, VSCode Insiders doesn’t even crash when closing a window (with both native and custom titlebars, even), there is a different crash when closing the whole app, not sure if related?


And of course, since auto-maximizing works to reproduce the bug, what about the opposite? Yupp, I can finally start my (non-Insiders) VSCode again on Wayland, with GPU acceleration, perfect crisp per-monitor fractional scaling (like I’ve been waiting for, for months), and even close/open windows, with no crashes, “just” by setting the “Maximized horizontally/vertically” states to “Force” and “No”.

It’s definitely weird to use, you can’t even attempt to maximize or edge-snap the windows, they feel very “floaty”. Fullscreening still seems to work though, so that’s a nice potential workaround.

My only regret is that I hadn’t picked up on the maximization connection sooner, and tried harder to repro the crash with a fresh --user-data-dir (instead of going with XWayland + --disable-gpu for months).

EDIT: the workaround also appears to fix Obsidian (the other app I use, still stuck on Electron 25).

I have been looking into this issue recently and was able to repro one of the crash scenarios with pointer focus into the application, debugging showed that an invalid layer is being passed into ui::Layer::ConvertPointToLayer. I haven’t confirmed yet why WebContentsViewAura becomes detached but added the following workaround

diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index dc490ab41303c..3e1af2eb1ed6e 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -52,6 +52,7 @@
 #include "ui/base/metadata/metadata_impl_macros.h"
 #include "ui/base/ui_base_features.h"
 #include "ui/compositor/compositor.h"
+#include "ui/compositor/debug_utils.h"
 #include "ui/compositor/layer.h"
 #include "ui/compositor/layer_animator.h"
 #include "ui/display/display.h"
@@ -611,6 +612,11 @@ void Window::ConvertPointToTarget(const Window* source,
     if (target_client)
       target_client->ConvertPointFromScreen(target, point);
   } else {
+    if (source->layer()->name() == "WebContentsViewAura" ||
+        target->layer()->name() == "WebContentsViewAura")
+      return;
     ui::Layer::ConvertPointToLayer(source->layer(), target->layer(),
                                    /*use_target_transform=*/true, point);
   }

which seems to address the crash on startup for VS Code and electron-fiddle. I verified this using sway version 1.8.1-68d620a8 (Sep 28 2023, branch 'HEAD'). Can affected users also test the following build with electron-fiddle and confirm if it addresses the crashes.

This crash is the upstream issue of microsoft/vscode#184124. If we look at the data there, >20 users have reported this electron crash. This implies possibly there are hundreds of unreported instances.

For visibility: On the downstream & other issues (microsoft/vscode#184124, electron/electron#37531) you can find stacktraces with debug symbols. All signs seem to point towards a race condition type of issue during startup & menu build.

Some example stacktraces (thanks to coredumpctl + gdb):

  • Build Views with Layers
    • VSCode Log error: ERROR:elf_dynamic_array_reader.h(64)] tag not found
    • Stacktrace Crashed in: #0 0x0000562d9cd48f77 _ZN5views12_GLOBAL__N_120BuildViewsWithLayersEPNS_4ViewEPSt6vectorIS2_SaIS2_EE (electron + 0x8da0f77)
    • Function: views::(anonymous namespace)::BuildViewsWithLayers(views::View*, std::vector<views::View*, std::allocator<views::View*> >*) ()
  • Update Child Layer Bounds
    • VSCode Log error: ERROR:elf_dynamic_array_reader.h(64)] tag not found
    • Stacktrace Crashed in: #0 0x000055c8c9767d69 _ZN5views4View22UpdateChildLayerBoundsERKNS0_15LayerOffsetDataE (electron + 0x8d83d69)
    • Function: views::View::UpdateChildLayerBounds(views::View::LayerOffsetData const&) ()

Reproduction case is pretty easy: Simply install & try to start VSCode on ArchLinux + Wayland desktop environment (e.g. Sway), Manjaro Sway edition, or other Arch-based distros with Wayland-based desktop environment (e.g. EndeavourOS, Garuda Linux, etc…).

I reproduced on Manjaro Sway Edition:

# For fresh OS install, best to use local repo mirrors...
sudo pacman-mirrors -f && sudo pacman -Syyu

# Install VSCode (a.k.a. "Code - OSS")
sudo pacman -Syu code

# Try to start VSCode under Wayland
#   + `"window.titleBarStyle": "native"
#   = Frequent Crash due to race condition during startup window & menu build
/usr/bin/code --ozone-platform-hint=wayland --enable-features=WaylandWindowDecorations --enable-features=WebRTCPipeWireCapturer --force-dark-mode  --verbose

# Crash + coredump visible via: coredumpctl list

Note: Manjaro does not yet ship debuginfod debug symbols for code, nor electron25, so these must be built manually. You may have better out-of-the-box support for debuginfod debug symbols on “vanilla” Arch Linux. Although, first-time installation of ArchLinux in general requires a bit of *nix knowledge & time. The crash should be easily reproducible on Wayland + Sway, and probably other similar desktop environments (e.g. Hyprland, River, Wayfire, etc…)

Is there a chance this bug can be prioritized?

+1 to this! Many appear to be affected. Please & Thank You 🙏

The settings.json workaround fixed it for my case.

@3liasP Can you open multiple windows without a crash with this work-around? For me this only works for the first window.

In older versions I could retry 3-10 times until multiple windows open successful, now all attempts lead to a crash.

Thanks for more in depth explanations, this makes more sense now! I’ll follow your instructions and update if it resolves this. 👍

@3liasP: Hope it helps! You might try checking whether other Xwayland applications are blurry also. There are some reports of other IDEs including JetBrains being blurry under XWayland

I’m seeing the same behavior on my end as well with Wayland and was able to reproduce it with electron-fiddle with the same arguments as @tengyifei - In my case the window show up, but crashes when I maximize it. It works fine when not run under Wayland.

System details:

OS: Ubuntu 23.04 x86_64 
Kernel: 6.2.0-27-generic 
Resolution: 3840x2160 
DE: GNOME 44.3 
WM: Mutter 
WM Theme: Adwaita 
CPU: Intel i5-8250U (8) @ 3.400GHz 
GPU: Intel UHD Graphics 620 
Memory: 11674MiB / 23782MiB 

Looks like this is affecting other Electron users on Wayland not just VSCode: Signal: https://github.com/signalapp/Signal-Desktop/issues/6247 Element Matrix Client: https://github.com/vector-im/element-desktop/issues/1026

This also seems to have some history with 22.x as well: https://github.com/electron/electron/issues/37531