godot: TileMap randomly freezes the editor while editing patterns

Godot version

v4.0.beta10.official [d0398f62f]

System information

Windows 10, Vulkan

Issue description

I got the same error as in #58039, but while I was editing the patterns.

ERROR: Disconnecting nonexistent signal 'changed', callable: TileDataEditor::_tile_set_changed_plan_update.
   at: (core/object/object.cpp:1331)

Then I started getting a few other errors just by opening and closing the TileMap/TileSet tab.

ERROR: Already in group: _viewports.
   at: (scene/main/scene_tree.cpp:148)
ERROR: Index p_index = 8 is out of bounds (size() = 8).
   at: set (./core/templates/cowdata.h:143)
ERROR: Condition "!data.inside_tree" is true. Returning: false
   at: is_greater_than (scene/main/node.cpp:1473)
ERROR: Condition "ugc_locked" is true.
   at: call_group_flagsp (scene/main/scene_tree.cpp:235)

When closing, such an errors could appear

ERROR: Attempt to disconnect a nonexistent connection from '<TileSet#-9223369742989857500>'. Signal: 'changed', callable: 'TileSetAtlasSourceEditor::_tile_set_changed'.
ERROR: Parent node is busy setting up children, `add_child()` failed. Consider using `add_child.call_deferred(child)` instead.
   at: (scene/main/node.cpp:1133)

Also, some patterns may not be displayed… image

The editor can simply crash without errors. For me, this happened when switching TileMap tabs, and when trying to open Editor Settings after a few errors.

Steps to reproduce

Sometimes this happens on the first click…

https://user-images.githubusercontent.com/7782218/210423637-23780663-1547-4ea5-bd1b-b156c1595cce.mp4

Or just delete a few patterns

https://user-images.githubusercontent.com/7782218/210424355-1c3c5d80-c1da-4d02-b6ea-d9f0a6f1ec7b.mp4

  • Open MRP
  • Open node_2d.tscn
  • Select TileMap node
  • Switch to the Pattern tab on the bottom panel
  • Click the TileMap tab several times to hide and show the bottom panel
  • – or –
  • Delete a few patterns
  • A lot of different errors should appear in the console

Minimal reproduction project

TileMap freeze.zip

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 6
  • Comments: 24 (14 by maintainers)

Most upvoted comments

As I mentioned in Godot Contributors Chat, this bug may be surfaced by a compiler option, i.e. it only crashes with optimize=speed which official builds use. Different levels (optimize=none, optimize=debug, optimize=speed_trace, optimize=speed) will behave differently depending on the compiler optimization level when uninitialized data is involved. Sanitizers can help diagnose the source of the uninitialized data.

KoBeWi is looking into this as I write this.

This issue is making it almost impossible to work on Tilemaps in Godot 4.0.2. I’ve encountered it when:

  • Clicking on a Tilemap node in the scene editor
  • Adding or changing collision for a tile in the TileSet editor
  • Adding or changing z-index for a tile in the TileSet editor
  • Selecting a placed tile and dragging it to the patterns box

My workflow currently consists of running godot console from a terminal and saving after each and every change to my tilemap, because each change brings about a 50% chance of the infinite loop starting and me having to ctrl+c/restart in my terminal.

v4.0.2.stable.official [7a0977ce2] Windows 10 x64

Random build from Actions v4.1.dev.custom_build [90d34f401] The editor works without freezes when adding and removing templates.

4.0.2 froze on the third template addition.

I was able to get this issue with the latest version of Godot from Steam on Windows. I was trying to add a new terrain in the tile set, change its name, and color, and it would freeze. If I look up the task, it keeps taking more of the system’s RAM. Godot Engine v4.0.2.stable.official.7a0977ce2 Vulkan API 1.3.194 - Forward+

I have the same issue as described in #58039 Using both Beta4 RC1 & RC2 on Linux. Adding a terrain to a terrain set that isn’t the last in the list. When trying to add tiles to it, it will span the logs with:

ERROR: Disconnecting nonexistent signal 'changed', callable: TileMap::_tile_set_changed.
   at: _disconnect (core/object/object.cpp:1331)

Until I force quit the godot editor process. If I don’t force quit the Godot process fast enough my system will start swapping to disk as it’s running out of memory.

I was able to have the same bug today on latest master. I’ll try to investigate it.