godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.15k stars 20.21k forks source link

Editor crashes on start on invalid RenderingServer RID free #55895

Closed xsellier closed 2 years ago

xsellier commented 2 years ago

Godot version

7f9a82b944724c0228301ded5fbb8efee12eac4d

System information

Linux binogure 5.15.0-2-amd64 #1 SMP Debian 5.15.5-1 (2021-11-26) x86_64 GNU/Linux

Issue description

When launching godot it crashes. Then I open it again, it crashes another time. I have to open it like 4 or 5 times before it opens.

Godot Engine v4.0.dev.custom_build.7f9a82b94 - https://godotengine.org
Vulkan API 1.2.189 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 3070

ERROR: Creating buffers with data is forbidden during creation of a draw list
   at: vertex_buffer_create (drivers/vulkan/rendering_device_vulkan.cpp:4013)
ERROR: Creating buffers with data is forbidden during creation of a draw list
   at: index_buffer_create (drivers/vulkan/rendering_device_vulkan.cpp:4144)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning: RID()
   at: index_array_create (drivers/vulkan/rendering_device_vulkan.cpp:4198)
ERROR: Creating buffers with data is forbidden during creation of a draw list
   at: index_buffer_create (drivers/vulkan/rendering_device_vulkan.cpp:4144)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning: RID()
   at: index_array_create (drivers/vulkan/rendering_device_vulkan.cpp:4198)
ERROR: Creating buffers with data is forbidden during creation of a draw list
   at: vertex_buffer_create (drivers/vulkan/rendering_device_vulkan.cpp:4013)
ERROR: Creating buffers with data is forbidden during creation of a draw list
   at: vertex_buffer_create (drivers/vulkan/rendering_device_vulkan.cpp:4013)
ERROR: Creating buffers with data is forbidden during creation of a draw list
   at: index_buffer_create (drivers/vulkan/rendering_device_vulkan.cpp:4144)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning: RID()
   at: index_array_create (drivers/vulkan/rendering_device_vulkan.cpp:4198)
ERROR: Creating buffers with data is forbidden during creation of a draw list
   at: index_buffer_create (drivers/vulkan/rendering_device_vulkan.cpp:4144)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning: RID()
   at: index_array_create (drivers/vulkan/rendering_device_vulkan.cpp:4198)
ERROR: Attempted to free invalid ID: 0
   at: _free_internal (drivers/vulkan/rendering_device_vulkan.cpp:8445)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.dev.custom_build (7f9a82b944724c0228301ded5fbb8efee12eac4d)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x3cef0) [0x7f7205affef0] (??:0)
-- END OF BACKTRACE --
================================================================

Steps to reproduce

cd ~
git clone https://github.com/binogure-studio/real-estate-online
cd ~/real-estate-online
godot4 --path game/ -e

Workaround

It does not every time. I have to do it 4 or 5 times.

rm -rf game/.godot/uid_cache.bin
godot4 --path game/ -e
Calinou commented 2 years ago

I can confirm this on commit master 2a9dd654b.

Backtrace (from gdb, as the crash handler does not work here):

(gdb) bt
#0  0x00007ffff7a4fcfb in __vfprintf_internal () from /lib64/libc.so.6
#1  0x00007ffff7a5237c in buffered_vfprintf () from /lib64/libc.so.6
#2  0x00000000088867d8 in StdLogger::logv (this=0x98dce20, p_format=0x1f1b629 "%sERROR:%s %s\n", p_list=0x7fffff801520, p_err=true)
    at core/io/logger.cpp:235
#3  0x0000000008885893 in Logger::logf_error (this=0x98dce20, p_format=0x1f1b629 "%sERROR:%s %s\n") at core/io/logger.cpp:113
#4  0x00000000057cd6bb in UnixTerminalLogger::log_error (this=0x98dce20, p_function=0x1da380f "material_set_shader", 
    p_file=0x1f82523 "servers/rendering/renderer_rd/renderer_storage_rd.cpp", p_line=1654, 
    p_code=0x1f5acc7 "Condition \"!material\" is true.", p_rationale=0x1fa0349 "", p_editor_notify=false, p_type=Logger::ERR_ERROR)
    at drivers/unix/os_unix.cpp:573
#5  0x00000000088869e5 in CompositeLogger::log_error (this=0x98dce60, p_function=0x1da380f "material_set_shader", 
    p_file=0x1f82523 "servers/rendering/renderer_rd/renderer_storage_rd.cpp", p_line=1654, 
    p_code=0x1f5acc7 "Condition \"!material\" is true.", p_rationale=0x1fa0349 "", p_editor_notify=false, p_type=Logger::ERR_ERROR)
    at core/io/logger.cpp:269
#6  0x000000000875cf2b in OS::print_error (this=0x7fffffffc588, p_function=0x1da380f "material_set_shader", 
    p_file=0x1f82523 "servers/rendering/renderer_rd/renderer_storage_rd.cpp", p_line=1654, 
    p_code=0x1f5acc7 "Condition \"!material\" is true.", p_rationale=0x1fa0349 "", p_editor_notify=false, p_type=Logger::ERR_ERROR)
    at core/os/os.cpp:83
#7  0x0000000008d857ee in _err_print_error (p_function=0x1da380f "material_set_shader", 
    p_file=0x1f82523 "servers/rendering/renderer_rd/renderer_storage_rd.cpp", p_line=1654, 
    p_error=0x1f5acc7 "Condition \"!material\" is true.", p_message=0x1fa0349 "", p_editor_notify=false, p_type=ERR_HANDLER_ERROR)
    at core/error/error_macros.cpp:79
#8  0x0000000008d85783 in _err_print_error (p_function=0x1da380f "material_set_shader", 
    p_file=0x1f82523 "servers/rendering/renderer_rd/renderer_storage_rd.cpp", p_line=1654, 
    p_error=0x1f5acc7 "Condition \"!material\" is true.", p_editor_notify=false, p_type=ERR_HANDLER_ERROR)
    at core/error/error_macros.cpp:70
#9  0x0000000008388349 in RendererStorageRD::material_set_shader (this=0xa44f860, p_material=..., p_shader=...)
    at servers/rendering/renderer_rd/renderer_storage_rd.cpp:1654
#10 0x00000000081b1a73 in CommandQueueMT::Command2<RendererStorage, void (RendererStorage::*)(RID, RID), RID, RID>::call (
    this=0x7fff4c23caa8) at ./core/templates/command_queue_mt.h:322
#11 0x0000000007e6b6dc in CommandQueueMT::_flush (this=0xa4017e8) at ./core/templates/command_queue_mt.h:373
#12 0x0000000007e6b909 in CommandQueueMT::flush_if_pending (this=0xa4017e8) at ./core/templates/command_queue_mt.h:404
#13 0x00000000081ac17c in RenderingServerDefault::canvas_item_set_modulate (this=0xa401660, p1=..., p2=...)
    at servers/rendering/rendering_server_default.h:762
#14 0x0000000006cdfd72 in CanvasItem::set_modulate (this=0x1c0f2530, p_modulate=...) at scene/main/canvas_item.cpp:388
#15 0x0000000005ea8bad in EditorToaster::popup (this=0x120fd750, p_control=0x1c0f1d80, p_severity=EditorToaster::SEVERITY_ERROR, p_time=5, 
    p_tooltip=...) at editor/editor_toaster.cpp:351
#16 0x0000000005ea72b6 in EditorToaster::popup_str (this=0x120fd750, p_message=..., p_severity=EditorToaster::SEVERITY_ERROR, 
    p_tooltip=...) at editor/editor_toaster.cpp:403
#17 0x0000000005ea6eea in EditorToaster::_error_handler (p_self=0x0, p_func=0x1da380f "material_set_shader", 
    p_file=0x1f82523 "servers/rendering/renderer_rd/renderer_storage_rd.cpp", p_line=1654, 
    p_error=0x1f5acc7 "Condition \"!material\" is true.", p_errorexp=0x1fa0349 "", p_editor_notify=false, p_type=ERR_HANDLER_ERROR)
    at editor/editor_toaster.cpp:179
#18 0x0000000008d85847 in _err_print_error (p_function=0x1da380f "material_set_shader", 
    p_file=0x1f82523 "servers/rendering/renderer_rd/renderer_storage_rd.cpp", p_line=1654, 
    p_error=0x1f5acc7 "Condition \"!material\" is true.", p_message=0x1fa0349 "", p_editor_notify=false, p_type=ERR_HANDLER_ERROR)
    at core/error/error_macros.cpp:84
#19 0x0000000008d85783 in _err_print_error (p_function=0x1da380f "material_set_shader", 
    p_file=0x1f82523 "servers/rendering/renderer_rd/renderer_storage_rd.cpp", p_line=1654, 
    p_error=0x1f5acc7 "Condition \"!material\" is true.", p_editor_notify=false, p_type=ERR_HANDLER_ERROR)
    at core/error/error_macros.cpp:70
#20 0x0000000008388349 in RendererStorageRD::material_set_shader (this=0xa44f860, p_material=..., p_shader=...)
    at servers/rendering/renderer_rd/renderer_storage_rd.cpp:1654
#21 0x00000000081b1a73 in CommandQueueMT::Command2<RendererStorage, void (RendererStorage::*)(RID, RID), RID, RID>::call (
    this=0x7fff4c23caa8) at ./core/templates/command_queue_mt.h:322
#22 0x0000000007e6b6dc in CommandQueueMT::_flush (this=0xa4017e8) at ./core/templates/command_queue_mt.h:373
#23 0x0000000007e6b909 in CommandQueueMT::flush_if_pending (this=0xa4017e8) at ./core/templates/command_queue_mt.h:404
#24 0x00000000081ac17c in RenderingServerDefault::canvas_item_set_modulate (this=0xa401660, p1=..., p2=...)
    at servers/rendering/rendering_server_default.h:762
#25 0x0000000006cdfd72 in CanvasItem::set_modulate (this=0x1c0f06a0, p_modulate=...) at scene/main/canvas_item.cpp:388
xsellier commented 2 years ago

I don't have the same stacktrace as @Calinou

(gdb) bt
#0  0x00007ffff7886e71 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7870536 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x000055555775cd97 in handle_crash (sig=11) at platform/linuxbsd/crash_handler_linuxbsd.cpp:130
#3  <signal handler called>
#4  0x0000000000000000 in ?? ()
#5  0x00005555579eb5e5 in CommandQueueMT::_flush (this=0x55556018f788) at ./core/templates/command_queue_mt.h:373
#6  0x000055555acffe92 in CommandQueueMT::flush_if_pending (this=0x55556018f788) at ./core/templates/command_queue_mt.h:404
#7  0x000055555ad1245e in RenderingServerDefault::canvas_item_set_modulate (this=0x55556018f600, p1=..., p2=...) at servers/rendering/rendering_server_default.h:762
#8  0x0000555559bd7a70 in CanvasItem::set_modulate (this=0x5555647f27f0, p_modulate=...) at scene/main/canvas_item.cpp:388
#9  0x0000555558ee6b54 in EditorToaster::popup (this=0x555568c3c3f0, p_control=0x555562d27030, p_severity=EditorToaster::SEVERITY_ERROR, p_time=5, p_tooltip=...) at editor/editor_toaster.cpp:351
#10 0x0000555558ee74f5 in EditorToaster::popup_str (this=0x555568c3c3f0, p_message=..., p_severity=EditorToaster::SEVERITY_ERROR, p_tooltip=...) at editor/editor_toaster.cpp:403
#11 0x0000555558ee5430 in EditorToaster::_error_handler (p_self=0x0, p_func=0x55555ca3d707 "_free_internal", p_file=0x55555ca32880 "drivers/vulkan/rendering_device_vulkan.cpp", p_line=8445, p_error=0x555569edf890 "Attempted to free invalid ID: 0", 
    p_errorexp=0x55555dd3e7da "", p_editor_notify=false, p_type=ERR_HANDLER_ERROR) at editor/editor_toaster.cpp:179
#12 0x000055555b8079a9 in _err_print_error (p_function=0x55555ca3d707 "_free_internal", p_file=0x55555ca32880 "drivers/vulkan/rendering_device_vulkan.cpp", p_line=8445, p_error=0x555569edf890 "Attempted to free invalid ID: 0", 
    p_message=0x55555dd3e7da "", p_editor_notify=false, p_type=ERR_HANDLER_ERROR) at core/error/error_macros.cpp:84
#13 0x000055555b8078db in _err_print_error (p_function=0x55555ca3d707 "_free_internal", p_file=0x55555ca32880 "drivers/vulkan/rendering_device_vulkan.cpp", p_line=8445, p_error=..., p_editor_notify=false, p_type=ERR_HANDLER_ERROR)
    at core/error/error_macros.cpp:74
#14 0x0000555558ab3cb1 in RenderingDeviceVulkan::_free_internal (this=0x55555fd270d0, p_id=...) at drivers/vulkan/rendering_device_vulkan.cpp:8445
#15 0x0000555558ab3d5f in RenderingDeviceVulkan::free (this=0x55555fd270d0, p_id=...) at drivers/vulkan/rendering_device_vulkan.cpp:8453
#16 0x000055555ae09836 in RendererStorageRD::mesh_clear (this=0x5555601e5a60, p_mesh=...) at servers/rendering/renderer_rd/renderer_storage_rd.cpp:3569
#17 0x000055555ae266f3 in RendererStorageRD::free (this=0x5555601e5a60, p_rid=...) at servers/rendering/renderer_rd/renderer_storage_rd.cpp:9367
#18 0x000055555acfd93b in RenderingServerDefault::_free (this=0x55556018f600, p_rid=...) at servers/rendering/rendering_server_default.cpp:51
#19 0x000055555ad3ba41 in CommandQueueMT::Command1<RenderingServerDefault, void (RenderingServerDefault::*)(RID), RID>::call (this=0x7fff94297cc0) at ./core/templates/command_queue_mt.h:322
#20 0x00005555579eb5e5 in CommandQueueMT::_flush (this=0x55556018f788) at ./core/templates/command_queue_mt.h:373
#21 0x000055555acffe92 in CommandQueueMT::flush_if_pending (this=0x55556018f788) at ./core/templates/command_queue_mt.h:404
#22 0x000055555ad13e8e in RenderingServerDefault::canvas_item_clear (this=0x55556018f600, p1=...) at servers/rendering/rendering_server_default.h:792
#23 0x0000555559bd5d4c in CanvasItem::_update_callback (this=0x55556ee3deb0) at scene/main/canvas_item.cpp:143
#24 0x0000555557a44f08 in call_with_variant_args_helper<__UnexistingClass>(__UnexistingClass*, void (__UnexistingClass::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (p_instance=0x55556ee3deb0, 
    p_method=(void (__UnexistingClass::*)(__UnexistingClass * const)) 0x555559bd5ce2 <CanvasItem::_update_callback()>, p_args=0x7fffffffd448, r_error=...) at ./core/variant/binder_common.h:226
--Type <RET> for more, q to quit, c to continue without paging--
#25 0x0000555557a44413 in call_with_variant_args_dv<__UnexistingClass> (p_instance=0x55556ee3deb0, p_method=(void (__UnexistingClass::*)(__UnexistingClass * const)) 0x555559bd5ce2 <CanvasItem::_update_callback()>, p_args=0x0, p_argcount=0, r_error=..., 
    default_values=...) at ./core/variant/binder_common.h:373
#26 0x0000555557a41fe6 in MethodBindT<>::call(Object*, Variant const**, int, Callable::CallError&) (this=0x555561907930, p_object=0x55556ee3deb0, p_args=0x0, p_arg_count=0, r_error=...) at ./core/object/method_bind.h:280
#27 0x000055555b790020 in Object::call (this=0x55556ee3deb0, p_method=..., p_args=0x0, p_argcount=0, r_error=...) at core/object/object.cpp:837
#28 0x000055555b4f1459 in Callable::call (this=0x7ffff660a020, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at core/variant/callable.cpp:62
#29 0x000055555b7889bf in MessageQueue::_call_function (this=0x55555f850a30, p_callable=..., p_args=0x7ffff660a038, p_argcount=0, p_show_error=false) at core/object/message_queue.cpp:258
#30 0x000055555b788cea in MessageQueue::flush (this=0x55555f850a30) at core/object/message_queue.cpp:304
#31 0x0000555559c4ca1e in SceneTree::process (this=0x555561abbd90, p_time=0.01388888888888889) at scene/main/scene_tree.cpp:456
#32 0x00005555577a58c1 in Main::iteration () at main/main.cpp:2662
#33 0x000055555775fd1d in OS_LinuxBSD::run (this=0x7fffffffddd0) at platform/linuxbsd/os_linuxbsd.cpp:342
#34 0x000055555775c0e3 in main (argc=4, argv=0x7fffffffe2f8) at platform/linuxbsd/godot_linuxbsd.cpp:58
xsellier commented 2 years ago

So, I tried to reproduce the issue with master (ie this commit: 15aea89868d16d0310a229d831e4a347a38dc1c3 ) and it doesn't crash anymore.

However, I tried to find via git bisect the commit that introduced that crash, and it started happening with this commit 8310d40646a1421809bcd46381d7a503c6781db3 .

Anyway since the crash doesn't happen anymore, I'm closing this ticket.