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

Editing Tileset Causes Crash to desktop #63534

Closed
winter5un opened this issue Jul 27, 2022 · 15 comments
Closed

Editing Tileset Causes Crash to desktop #63534

winter5un opened this issue Jul 27, 2022 · 15 comments

Comments

@winter5un
Copy link

winter5un commented Jul 27, 2022

Godot version

4.0-alpha12
Edit: and 4.0-alpha14

System information

Ubuntu 21.10 (screenshot with more info attached)

Issue description

image

Same as Title

Steps to reproduce

Attached is a minimal project which includes to log files and a short video showing how to reproduce. In the end of the video the editor becomes non-responsive followed by a long crash (edited out the crash as it took forever but the log is there)

Added a layer and messed with the names of the layers then it crashed. Might or might not be related to that..........

Steps:

  1. open project
  2. select tilemap
  3. add layer
  4. change name
  5. wait/mess around a bit, paint some tiles, Im not 100% on what triggers it.
  6. crash

Minimal reproduction project

tile_set_4.0a12_repro.zip

@KoBeWi
Copy link
Member

KoBeWi commented Jul 27, 2022

I'm able to trigger crash by randomly clicking things, but didn't get any stack trace. Might be related to disabling layers, I think I once triggered it during normal use.

@winter5un
Copy link
Author

winter5un commented Jul 28, 2022

After messing with it some more, it seems to be something to do with the update process of the tile set properties. If I add a physics layer for instance that regularly triggers the crash as well. But not every time, its intermittent. I can follow the same process 3 times and each time it crashes but at different steps. If I leave the scene open for a long time and do not edit the tile set, its fine, no crash. Something handling changes common to all the tileset properties is probably the culprit.

@HyenaGames
Copy link

HyenaGames commented Aug 16, 2022

I think I have a related bug. I created a new tileset and dropped my art in which was a large spritesheet. The system auto-detected the tiles at 16x16 and as soon as I clicked to change it to 32x32 I got a crash. But yes, changing the tileset properties crashed me. This was on Win10 64.

@schme
Copy link
Contributor

schme commented Oct 8, 2022

Getting a consistant crash when setting TileSet to a TileMap.

Steps:

  • Create new TileMap
  • Set test_tiles.tres as the TileSet
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta.custom_build (b150926cde1683667d3e725b2928a7a28765df0f)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f4406682520] (??:0)
[2] CowData<int>::_get_size() const (??:0)
[3] CowData<int>::size() const (??:0)
[4] Vector<int>::size() const (??:0)
[5] TileSet::get_source_count() const (??:0)
[6] TilesEditorPlugin::get_sorted_sources(Ref<TileSet>) const (??:0)
[7] TileMapEditorTilesPlugin::_update_tile_set_sources_list() (??:0)
[8] void call_with_variant_args_helper<TileMapEditorTilesPlugin>(TileMapEditorTilesPlugin*, void (TileMapEditorTilesPlugin::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (??:0)
[9] void call_with_variant_args<TileMapEditorTilesPlugin>(TileMapEditorTilesPlugin*, void (TileMapEditorTilesPlugin::*)(), Variant const**, int, Callable::CallError&) (??:0)
[10] CallableCustomMethodPointer<TileMapEditorTilesPlugin>::call(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[11] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[12] Object::emit_signalp(StringName const&, Variant const**, int) (??:0)
[13] Error Object::emit_signal<>(StringName const&) (??:0)
[14] TilesEditorPlugin::synchronize_sources_list(Object*, Object*) (??:0)
[15] void call_with_variant_args_helper<TilesEditorPlugin, Object*, Object*, 0ul, 1ul>(TilesEditorPlugin*, void (TilesEditorPlugin::*)(Object*, Object*), Variant const**, Callable::CallError&, IndexSequence<0ul, 1ul>) (??:0)
[16] void call_with_variant_args<TilesEditorPlugin, Object*, Object*>(TilesEditorPlugin*, void (TilesEditorPlugin::*)(Object*, Object*), Variant const**, int, Callable::CallError&) (??:0)
[17] CallableCustomMethodPointer<TilesEditorPlugin, Object*, Object*>::call(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[18] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[19] CallableCustomBind::call(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[20] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[21] Object::emit_signalp(StringName const&, Variant const**, int) (??:0)
[22] Error Object::emit_signal<>(StringName const&) (??:0)
[23] CanvasItem::_notification(int) (??:0)
[24] CanvasItem::_notificationv(int, bool) (??:0)
[25] Control::_notificationv(int, bool) (??:0)
[26] ItemList::_notificationv(int, bool) (??:0)
[27] Object::notification(int, bool) (??:0)
[28] CanvasItem::_handle_visibility_change(bool) (??:0)
[29] CanvasItem::_propagate_visibility_changed(bool) (??:0)
[30] CanvasItem::_handle_visibility_change(bool) (??:0)
[31] CanvasItem::_propagate_visibility_changed(bool) (??:0)
[32] CanvasItem::_handle_visibility_change(bool) (??:0)
[33] CanvasItem::_propagate_visibility_changed(bool) (??:0)
[34] CanvasItem::_handle_visibility_change(bool) (??:0)
[35] CanvasItem::set_visible(bool) (??:0)
[36] CanvasItem::show() (??:0)
[37] TileMapEditor::_update_bottom_panel() (??:0)
[38] TileMapEditor::_notification(int) (??:0)
[39] TileMapEditor::_notificationv(int, bool) (??:0)
[40] Object::notification(int, bool) (??:0)
[41] SceneTree::_notify_group_pause(StringName const&, int) (??:0)
[42] SceneTree::process(double) (??:0)
[43] Main::iteration() (??:0)
[44] OS_LinuxBSD::run() (??:0)
[45] /x/koodi/godot/bin/godot.linuxbsd.editor.dev.x86_64(main+0x18b) [0x55e8bc9e0a04] (??:0)
[46] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f4406669d90] (??:0)
[47] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f4406669e40] (??:0)
[48] /x/koodi/godot/bin/godot.linuxbsd.editor.dev.x86_64(_start+0x25) [0x55e8bc9e07b5] (??:0)
-- END OF BACKTRACE --
================================================================

TileMapSetCrash.zip

@KoBeWi
Copy link
Member

KoBeWi commented Oct 8, 2022

^ same crash as in #67049

@gongpha
Copy link
Contributor

gongpha commented Oct 14, 2022

The call stack that I get from a similar crash :
(doing something inside a tileset editor)

godot.windows.editor.dev.x86_32.exe!abort() Line 77
	at minkernel\crts\ucrt\src\appcrt\startup\abort.cpp(77)
[External Code]
godot.windows.editor.dev.x86_32.exe!Callable::operator<(const Callable & p_callable) Line 208
	at D:\Godot\Source\godot\core\variant\callable.cpp(208)
godot.windows.editor.dev.x86_32.exe!VMap<Callable,Object::SignalData::Slot>::_find(const Callable & p_val, bool & r_exact) Line 74
	at D:\Godot\Source\godot\core\templates\vmap.h(74)
godot.windows.editor.dev.x86_32.exe!VMap<Callable,Object::SignalData::Slot>::insert(const Callable & p_key, const Object::SignalData::Slot & p_val) Line 119
	at D:\Godot\Source\godot\core\templates\vmap.h(119)
godot.windows.editor.dev.x86_32.exe!VMap<Callable,Object::SignalData::Slot>::operator[](const Callable & p_key) Line 190
	at D:\Godot\Source\godot\core\templates\vmap.h(190)
godot.windows.editor.dev.x86_32.exe!Object::connect(const StringName & p_signal, const Callable & p_callable, unsigned int p_flags) Line 1286
	at D:\Godot\Source\godot\core\object\object.cpp(1286)
godot.windows.editor.dev.x86_32.exe!TileMap::set_tileset(const Ref<TileSet> & p_tileset) Line 533
	at D:\Godot\Source\godot\scene\2d\tile_map.cpp(533)
godot.windows.editor.dev.x86_32.exe!TilesEditorPlugin::_thread() Line 88
	at D:\Godot\Source\godot\editor\plugins\tiles\tiles_editor_plugin.cpp(88)
godot.windows.editor.dev.x86_32.exe!TilesEditorPlugin::_thread_func(void * ud) Line 61
	at D:\Godot\Source\godot\editor\plugins\tiles\tiles_editor_plugin.cpp(61)
godot.windows.editor.dev.x86_32.exe!Thread::callback(Thread * p_self, const Thread::Settings & p_settings, void(*)(void *) p_callback, void * p_userdata) Line 65
	at D:\Godot\Source\godot\core\os\thread.cpp(65)
[External Code]
godot.windows.editor.dev.x86_32.exe!thread_start<unsigned int (__stdcall*)(void *),1>(void * const parameter) Line 97
	at minkernel\crts\ucrt\src\appcrt\startup\thread.cpp(97)
[External Code]
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
godot.windows.editor.dev.x86_32.exe!TestTextEdit::DOCTEST_ANON_FUNC_5764() Line 797
	at D:\Godot\Source\godot\tests\scene\test_text_edit.h(797)
[External Code]

@groud
Copy link
Member

groud commented Jan 17, 2023

I cannot reproduce the bug. @winter5un could you confirm it is still here in the latest beta?
Otherwise it might have been already fixed.

@SaracenOne
Copy link
Member

@groud I was testing this and I got the same crash, still not sure what seems triggers it, basically the same stack trace as @gongpha.

@SaracenOne
Copy link
Member

SaracenOne commented Jan 24, 2023

To hazard a guess, it's probably all related to the fact that the TilesetEditor runs on its own thread. It might need a broader evaluation of thread safety, but my potential suggested fix for this might be connecting signal with the deferred flag. The tileset editor seems to have other warnings about parenting nodes too.

@groud
Copy link
Member

groud commented Jan 24, 2023

To hazard a guess, it's probably all related to the fact that the TilesetEditor runs on its own thread.

I don't think it does. I did not implemented that and, as far as I am aware, I don't think editors run outside the main thread.

Edit: I realized the TileSetEditor has indeed a thread, but it's only used to generate the thumbnails of the tilemap patterns. So well, yeah, hte problem might be here, as #72020 seems to suggest.

@KoBeWi KoBeWi modified the milestones: 4.0, 4.1 Feb 25, 2023
@akien-mga akien-mga changed the title [4.0a12] Editing Tileset Causes Crash to desktop Editing Tileset Causes Crash to desktop Jun 23, 2023
@akien-mga
Copy link
Member

Can you still reproduce this in 4.0.3 and 4.1-beta3 or later?

@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 23, 2023
@ShlomiRex
Copy link
Contributor

It also happens in macOS Macbook Pro M1
Godot Version: ba54c34

Trace:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.dev.custom_build (5f1e56ff26be4070496aa51095b9ac2f2b4f4ed8)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] 1   libsystem_platform.dylib            0x00000001a1476a24 _sigtramp + 56
[2] String::parse_utf8(char const*, int, bool) (in godot.macos.editor.arm64) + 1156
[3] String::parse_utf8(char const*, int, bool) (in godot.macos.editor.arm64) + 1156
[4] TextFile::load_text(String const&) (in godot.macos.editor.arm64) + 232
[5] ScriptEditor::_load_text_file(String const&, Error*) const (in godot.macos.editor.arm64) + 148
[6] ScriptEditor::open_file(String const&) (in godot.macos.editor.arm64) + 412
[7] EditorNode::load_resource(String const&, bool) (in godot.macos.editor.arm64) + 464
[8] FileSystemDock::_select_file(String const&, bool) (in godot.macos.editor.arm64) + 2052
[9] FileSystemDock::_tree_activate_file() (in godot.macos.editor.arm64) + 488
[10] Object::emit_signalp(StringName const&, Variant const**, int) (in godot.macos.editor.arm64) + 444
[11] Tree::gui_input(Ref<InputEvent> const&) (in godot.macos.editor.arm64) + 6548
[12] Control::_call_gui_input(Ref<InputEvent> const&) (in godot.macos.editor.arm64) + 656
[13] Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) (in godot.macos.editor.arm64) + 412
[14] Viewport::_gui_input_event(Ref<InputEvent>) (in godot.macos.editor.arm64) + 1500
[15] Viewport::push_input(Ref<InputEvent> const&, bool) (in godot.macos.editor.arm64) + 724
[16] Window::_window_input(Ref<InputEvent> const&) (in godot.macos.editor.arm64) + 728
[17] Input::~Input()
[18] DisplayServerMacOS::_dispatch_input_event(Ref<InputEvent> const&) (in godot.macos.editor.arm64) + 460
[19] Input::_parse_input_event_impl(Ref<InputEvent> const&, bool) (in godot.macos.editor.arm64) + 1488
[20] Input::flush_buffered_events() (in godot.macos.editor.arm64) + 136
[21] DisplayServerMacOS::process_events() (in godot.macos.editor.arm64) + 476
[22] OS_MacOS::run() (in godot.macos.editor.arm64) + 104
[23] main (in godot.macos.editor.arm64) + 304
[24] 24  dyld                                0x00000001a10eff28 start + 2236
-- END OF BACKTRACE --
================================================================

@ShlomiRex
Copy link
Contributor

ShlomiRex commented Sep 17, 2023

To reproduce: open godot_4_alpha_12_tileset_issue_2.log right after launching Godot editor.

Specificaly cowdata.h line 314:

*_get_size() = p_size;

Exception: EXC_BAD_ACCESS (code=1, address=0x0)
Stack:

CowData::resize<…>(int) cowdata.h:314
String::resize(int) ustring.h:218
String::parse_utf8(const char *, int, bool) ustring.cpp:1878
TextFile::load_text(const String &) text_file.cpp:67
ScriptEditor::_load_text_file(const String &, Error *) const script_editor_plugin.cpp:2208
ScriptEditor::open_file(const String &) script_editor_plugin.cpp:2673
EditorNode::load_resource(const String &, bool) editor_node.cpp:1178
FileSystemDock::_select_file(const String &, bool) filesystem_dock.cpp:1230
FileSystemDock::_tree_activate_file() filesystem_dock.cpp:1247
call_with_variant_args_helper<…>(FileSystemDock *, void (FileSystemDock::*)(), const Variant **, Callable::CallError &, IndexSequence<…>) binder_common.h:303
call_with_variant_args<…>(FileSystemDock *, void (FileSystemDock::*)(), const Variant **, int, Callable::CallError &) binder_common.h:417
CallableCustomMethodPointer::call(const Variant **, int, Variant &, Callable::CallError &) const callable_method_pointer.h:104
Callable::callp(const Variant **, int, Variant &, Callable::CallError &) const callable.cpp:50
Object::emit_signalp(const StringName &, const Variant **, int) object.cpp:1113
Node::emit_signalp(const StringName &, const Variant **, int) node.cpp:3587
Object::emit_signal<…>(const StringName &) object.h:899
Tree::gui_input(const Ref<…> &) tree.cpp:3825
Control::_call_gui_input(const Ref<…> &) control.cpp:1809
Viewport::_gui_call_input(Control *, const Ref<…> &) viewport.cpp:1586
Viewport::_gui_input_event(Ref<…>) viewport.cpp:1818
Viewport::push_input(const Ref<…> &, bool) viewport.cpp:3182
Window::_window_input(const Ref<…> &) window.cpp:1547
call_with_variant_args_helper<…>(Window *, void (Window::*)(const Ref<…> &), const Variant **, Callable::CallError &, IndexSequence<…>) binder_common.h:303
call_with_variant_args<…>(Window *, void (Window::*)(const Ref<…> &), const Variant **, int, Callable::CallError &) binder_common.h:417
CallableCustomMethodPointer::call(const Variant **, int, Variant &, Callable::CallError &) const callable_method_pointer.h:104
Callable::callp(const Variant **, int, Variant &, Callable::CallError &) const callable.cpp:50
DisplayServerMacOS::_dispatch_input_event(const Ref<…> &) display_server_macos.mm:423
DisplayServerMacOS::_dispatch_input_events(const Ref<…> &) display_server_macos.mm:389
Input::_parse_input_event_impl(const Ref<…> &, bool) input.cpp:750
Input::flush_buffered_events() input.cpp:1012
DisplayServerMacOS::process_events() display_server_macos.mm:3764
OS_MacOS::run() os_macos.mm:762
main godot_main_macos.mm:77
start 0x00000001a10eff28

It appears _FORCE_INLINE_ uint32_t *_get_size() const returns nullptr and that is the reason.

@AThousandShips
Copy link
Member

Can someone confirm this on latest? Should be fixed by:

@akien-mga
Copy link
Member

akien-mga commented Jan 19, 2024

It seems this issue included multiple reports of possible different crashes, but not a lot of clear reproduction projects.

I tested the MRP from the OP: #63534 (comment)
And couldn't reproduce a crash in the current master branch, but the steps to reproduce are also unclear. This may well have been fixed years ago. Possibly by #72020.

I tested the MRP from #63534 (comment) but it seems to be a different bug that was already fixed. Apparently duplicate of #67049.

And finally @ShlomiRex's report in #63534 (comment) is not related to TileSet at all, but to a big log file causing a crash in the script editor. Indeed godot_4_alpha_12_tileset_issue_2.log in the OP's MRP is 805 MiB uncompressed, which causes a crash in master, fixed in #81917. So that last part was a duplicate of #80533.

@akien-mga akien-mga removed this from the 4.3 milestone Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Status: Done
Development

No branches or pull requests