godot icon indicating copy to clipboard operation
godot copied to clipboard

Crash when adding a scene to scene tree

Open unfa opened this issue 1 year ago • 0 comments
trafficstars

Tested versions

Reproducible in 4.2.2 stable and v4.3.beta.custom_build.[b97110cd3] (2024-07-05 14:38:10 UTC)

System information

Arch Linux + X11 + Radeon RX6800XT

Issue description

When the game is run with --headless --dedicated parameters Godot crashes seemingly as it's loading or spawning a game level.

--dedicated itself works fine, --headless also but combined they trigger the crash.

I've used prints to find out what exact line is executed when the crash happens and it's attaching the loaded and instantiated map scene to the scene tree:

@rpc("authority", "reliable", "call_remote")
func load_map():
	Logger.log(["Loading map packed scene from   ", game_config.map_scene_path], Logger.MessageType.INFO)
	if is_instance_valid(map): # refuse to load a map twice
		print("Map file already loaded, continuing")
		return

	print("1")
	var time_msec = Time.get_ticks_msec()
	print("2")
	var map_scene = load(game_config.map_scene_path)
	print("3")
	var map_instance = map_scene.instantiate()
	print("4")
	assert(map_instance is Map, "Game State loaded a map that is of type " + str(map_instance))
	print("5")
	map_instance.name = "Map"
	print("6")
	add_child(map_instance)
	print("7")
	map_instance.global_position = spatial_origin_position
	print("8")
	map = map_instance
	print("9")
	time_msec = Time.get_ticks_msec() - time_msec
	print("10")
	Logger.log(["Map loaded and spawned in", time_msec, "msec"], Logger.MessageType.SUCCESS)
	await get_tree().create_timer(REFLECTION_PROBE_RENDERING_TIMEOUT).timeout
	map_ready.emit()
	%LoadingScreen.hide()

Output:

Godot Engine v4.3.beta.custom_build.b97110cd3 (2024-07-05 14:38:10 UTC) - https://godotengine.org

Panku:<CanvasLayer#65531807086>
LynxWindowsManager:<Control#65598915955>
Booting Liblast
Found commandline arguments: ["--dedicated"]
[color=c71585]· SERVER Starting dedicated server
[color=c71585]· SERVER No map requested, using default: res://data/game/maps/city.tscn 
[color=c71585]✅ SERVER Server created
[color=c71585]ℹ SERVER Loading map packed scene from res://data/game/maps/city.tscn 
1
2
3
4
5
6

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.3.beta.custom_build (b97110cd307e4d78e20bfafe5de6c082194b2cd6)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x3cae0) [0x7a40b774eae0] (??:0)
[2] ./godot.linuxbsd.editor.x86_64(+0x465b8a1) [0x623f35a738a1] (/godot-git/./core/templates/hash_set.h:170)
[3] ./godot.linuxbsd.editor.x86_64(+0x46359ec) [0x623f35a4d9ec] (/godot-git/servers/rendering/renderer_scene_cull.cpp:1476)
[4] ./godot.linuxbsd.editor.x86_64(+0x302eb0f) [0x623f34446b0f] (/godot-git/./core/object/ref_counted.h:105)
[5] ./godot.linuxbsd.editor.x86_64(+0x4f84c00) [0x623f3639cc00] (/godot-git/core/object/object.cpp:873)
[6] ./godot.linuxbsd.editor.x86_64(+0x2a228f8) [0x623f33e3a8f8] (/godot-git/scene/main/node.cpp:264)
[7] ./godot.linuxbsd.editor.x86_64(+0x2a228d2) [0x623f33e3a8d2] (/godot-git/./core/templates/hash_map.h:456)
[8] ./godot.linuxbsd.editor.x86_64(+0x2a266f7) [0x623f33e3e6f7] (/godot-git/scene/main/node.cpp:3168)
[9] ./godot.linuxbsd.editor.x86_64(+0x2a3a636) [0x623f33e52636] (/godot-git/scene/main/node.cpp:1550)
[10] ./godot.linuxbsd.editor.x86_64(+0x2a5b804) [0x623f33e73804] (/godot-git/./core/variant/binder_common.h:304 (discriminator 3))
[11] ./godot.linuxbsd.editor.x86_64(+0xa5c994) [0x623f31e74994] (/godot-git/./core/variant/variant.h:308)
[12] ./godot.linuxbsd.editor.x86_64(+0x901324) [0x623f31d19324] (/godot-git/modules/gdscript/gdscript.cpp:2028 (discriminator 1))
[13] ./godot.linuxbsd.editor.x86_64(+0x4f85bac) [0x623f3639dbac] (/godot-git/core/object/object.cpp:786)
[14] ./godot.linuxbsd.editor.x86_64(+0x4ce7eaa) [0x623f360ffeaa] (/godot-git/core/variant/variant_call.cpp:1211 (discriminator 2))
[15] ./godot.linuxbsd.editor.x86_64(+0xa6e259) [0x623f31e86259] (/godot-git/./core/variant/variant.h:308)
[16] ./godot.linuxbsd.editor.x86_64(+0x901324) [0x623f31d19324] (/godot-git/modules/gdscript/gdscript.cpp:2028 (discriminator 1))
[17] ./godot.linuxbsd.editor.x86_64(+0x4f85bac) [0x623f3639dbac] (/godot-git/core/object/object.cpp:786)
[18] ./godot.linuxbsd.editor.x86_64(+0x4ce7eaa) [0x623f360ffeaa] (/godot-git/core/variant/variant_call.cpp:1211 (discriminator 2))
[19] ./godot.linuxbsd.editor.x86_64(+0xa6e259) [0x623f31e86259] (/godot-git/./core/variant/variant.h:308)
[20] ./godot.linuxbsd.editor.x86_64(+0x901324) [0x623f31d19324] (/godot-git/modules/gdscript/gdscript.cpp:2028 (discriminator 1))
[21] ./godot.linuxbsd.editor.x86_64(+0x4f85bac) [0x623f3639dbac] (/godot-git/core/object/object.cpp:786)
[22] ./godot.linuxbsd.editor.x86_64(+0x4ce7eaa) [0x623f360ffeaa] (/godot-git/core/variant/variant_call.cpp:1211 (discriminator 2))
[23] ./godot.linuxbsd.editor.x86_64(+0xa6e259) [0x623f31e86259] (/godot-git/./core/variant/variant.h:308)
[24] ./godot.linuxbsd.editor.x86_64(+0x901324) [0x623f31d19324] (/godot-git/modules/gdscript/gdscript.cpp:2028 (discriminator 1))
[25] ./godot.linuxbsd.editor.x86_64(+0x2a3616b) [0x623f33e4e16b] (/godot-git/./core/variant/variant.h:308)
[26] ./godot.linuxbsd.editor.x86_64(+0x4f84c00) [0x623f3639cc00] (/godot-git/core/object/object.cpp:873)
[27] ./godot.linuxbsd.editor.x86_64(+0x2a22938) [0x623f33e3a938] (/godot-git/scene/main/node.cpp:267 (discriminator 1))
[28] ./godot.linuxbsd.editor.x86_64(+0x2a266f7) [0x623f33e3e6f7] (/godot-git/scene/main/node.cpp:3168)
[29] ./godot.linuxbsd.editor.x86_64(+0x2a3a636) [0x623f33e52636] (/godot-git/scene/main/node.cpp:1550)
[30] ./godot.linuxbsd.editor.x86_64(+0x2a752e1) [0x623f33e8d2e1] (/godot-git/scene/main/scene_tree.cpp:1416)
[31] ./godot.linuxbsd.editor.x86_64(+0x2a7f518) [0x623f33e97518] (/godot-git/scene/main/scene_tree.cpp:535)
[32] ./godot.linuxbsd.editor.x86_64(+0x6a4a57) [0x623f31abca57] (/godot-git/main/main.cpp:4107)
[33] ./godot.linuxbsd.editor.x86_64(+0x60f881) [0x623f31a27881] (/godot-git/platform/linuxbsd/os_linuxbsd.cpp:962 (discriminator 1))
[34] ./godot.linuxbsd.editor.x86_64(+0x5e79a2) [0x623f319ff9a2] (/godot-git/platform/linuxbsd/godot_linuxbsd.cpp:85)
[35] /usr/lib/libc.so.6(+0x25c88) [0x7a40b7737c88] (??:0)
[36] /usr/lib/libc.so.6(__libc_start_main+0x8c) [0x7a40b7737d4c] (??:0)
[37] ./godot.linuxbsd.editor.x86_64(+0x60ce75) [0x623f31a24e75] (??:?)
-- END OF BACKTRACE --
================================================================

Steps to reproduce

  1. make sure you have git-lfs installed
  2. git clone [email protected]:Liblast/Liblast.git
  3. cd ./Liblast/src/game
  4. Open the project in Godot 4.2 or later: godot --editor
  5. After the import completes, run the project like this godot --headless --dedicated

Minimal reproduction project (MRP)

So far I can't produce one.

unfa avatar Jul 06 '24 20:07 unfa