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

Random crash when trying to open a scene #80255

Closed
KoBeWi opened this issue Aug 4, 2023 · 5 comments · Fixed by #80377
Closed

Random crash when trying to open a scene #80255

KoBeWi opened this issue Aug 4, 2023 · 5 comments · Fixed by #80377

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Aug 4, 2023

Godot version

4.2 eb4301b

System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 30.0.15.1403) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

Issue description

Sometimes when trying to open a scene from filesystem dock, the editor will crash. It happened 3 times to me already, but I don't know what exactly causes it.

[0] FileSystemDock::_select_file (C:\godot_source\editor\filesystem_dock.cpp:1115)
[1] FileSystemDock::_select_file (C:\godot_source\editor\filesystem_dock.cpp:1115)
[2] FileSystemDock::_tree_activate_file (C:\godot_source\editor\filesystem_dock.cpp:1187)
[3] call_with_variant_args_helper<FileSystemDock> (C:\godot_source\core\variant\binder_common.h:308)
[4] call_with_variant_args<FileSystemDock> (C:\godot_source\core\variant\binder_common.h:418)
[5] CallableCustomMethodPointer<FileSystemDock>::call (C:\godot_source\core\object\callable_method_pointer.h:105)
[6] Callable::callp (C:\godot_source\core\variant\callable.cpp:51)
[7] Object::emit_signalp (C:\godot_source\core\object\object.cpp:1073)
[8] Node::emit_signalp (C:\godot_source\scene\main\node.cpp:3577)
[9] Object::emit_signal<> (C:\godot_source\core\object\object.h:891)
[10] Tree::gui_input (C:\godot_source\scene\gui\tree.cpp:3867)
[11] Control::_call_gui_input (C:\godot_source\scene\gui\control.cpp:1806)
[12] Viewport::_gui_call_input (C:\godot_source\scene\main\viewport.cpp:1565)
[13] Viewport::_gui_input_event (C:\godot_source\scene\main\viewport.cpp:1794)
[14] Viewport::push_input (C:\godot_source\scene\main\viewport.cpp:3129)
[15] Window::_window_input (C:\godot_source\scene\main\window.cpp:1482)
[16] call_with_variant_args_helper<Window,Ref<InputEvent> const &,0> (C:\godot_source\core\variant\binder_common.h:303)
[17] call_with_variant_args<Window,Ref<InputEvent> const &> (C:\godot_source\core\variant\binder_common.h:418)
[18] CallableCustomMethodPointer<Window,Ref<InputEvent> const &>::call (C:\godot_source\core\object\callable_method_pointer.h:105)
[19] Callable::callp (C:\godot_source\core\variant\callable.cpp:51)
[20] DisplayServerWindows::_dispatch_input_event (C:\godot_source\platform\windows\display_server_windows.cpp:2612)
[21] DisplayServerWindows::_dispatch_input_events (C:\godot_source\platform\windows\display_server_windows.cpp:2577)
[22] Input::_parse_input_event_impl (C:\godot_source\core\input\input.cpp:722)
[23] Input::flush_buffered_events (C:\godot_source\core\input\input.cpp:979)
[24] DisplayServerWindows::process_events (C:\godot_source\platform\windows\display_server_windows.cpp:2296)
[25] OS_Windows::run (C:\godot_source\platform\windows\os_windows.cpp:1479)
[26] widechar_main (C:\godot_source\platform\windows\godot_windows.cpp:182)
[27] _main (C:\godot_source\platform\windows\godot_windows.cpp:204)
[28] main (C:\godot_source\platform\windows\godot_windows.cpp:218)
[29] WinMain (C:\godot_source\platform\windows\godot_windows.cpp:232)
[30] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[31] <couldn't map PC to fn name>

Steps to reproduce

  1. Open a project
  2. Open a scene

I think the scene needs to be opened early enough.

Minimal reproduction project

N/A

@YuriSizov
Copy link
Contributor

YuriSizov commented Aug 4, 2023

I've also experienced a crash today after trying to open a scene from the filesystem dock. It was a project that I hadn't touched in a bit, and the debugger pointed to some code related to ResourceImporterTexture. Happened only once.

Edit: I was mistaken, it's the scene importer.

image

@KoBeWi
Copy link
Member Author

KoBeWi commented Aug 4, 2023

Is this a sequel to #79999? 🤔

I looked at #79981 again. Apparently there can be multiple ResourceImporterTexture instances. So I guess this can trigger crash:

  1. ResourceImporterTexture A gets created
  2. Singleton is assigned to ResourceImporterTexture A
  3. ResourceImporterTexture B gets created
  4. ResourceImporterTexture A is destroyed
  5. There is no ResourceImporterTexture singleton anymore

If threading is involved it could probably happen, idk.

@YuriSizov
Copy link
Contributor

I haven't looked into the reasoning, but it feels very wrong that this class can have multiple instances (reasonably), but also has a singleton which can be assigned to any instance that was created first. Why do we need a singleton? If we really need it, then we should initialize (and destroy) one instance in main.cpp or something.

@aaronfranke
Copy link
Member

I am getting the same crash on macOS, here is the stack trace (I shortened godot.macos.editor.arm64 to godot):

0   ???   0x600003c42650 ???
1   godot    0x104421fd8 FileSystemDock::_tree_activate_file() + 388
2   godot    0x106edb57c Object::emit_signalp(StringName const&, Variant const**, int) + 492
3   godot    0x105329800 Tree::gui_input(Ref<InputEvent> const&) + 7004
4   godot    0x1050dce38 Control::_call_gui_input(Ref<InputEvent> const&) + 616
5   godot    0x104fd90e0 Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) + 484
6   godot    0x104fda018 Viewport::_gui_input_event(Ref<InputEvent>) + 1380
7   godot    0x104fe11e0 Viewport::push_input(Ref<InputEvent> const&, bool) + 756
8   godot    0x10501ed40 Window::_window_input(Ref<InputEvent> const&) + 608
9   godot    0x10503c6b0 0x102958000 + 40781488
10  godot    0x102cc81a4 DisplayServerMacOS::_dispatch_input_event(Ref<InputEvent> const&) + 448
11  godot    0x106abb2a4 Input::_parse_input_event_impl(Ref<InputEvent> const&, bool) + 3952
12  godot    0x106ab8718 Input::flush_buffered_events() + 136
13  godot    0x102cdc824 DisplayServerMacOS::process_events() + 472
14  godot    0x102cc20e4 OS_MacOS::run() + 104
15  godot    0x102ceb9b0 main + 304
16  dyld     0x183fdbf28 start + 2236

@YuriSizov
Copy link
Contributor

YuriSizov commented Aug 7, 2023

I was mistaken, it's the scene importer. scene_singleton is empty. Which is a valid possibility because that's the constructor:

ResourceImporterScene::ResourceImporterScene(bool p_animation_import) {
	if (p_animation_import) {
		animation_singleton = this;
	} else {
		scene_singleton = this;
	}
	animation_importer = p_animation_import;
}

image

Edit: Seems that both instances are created in the EditorNode constructor. However, these are reference counted instances, so I guess at some point we get into a state where nothing references them and they get destroyed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants