godotengine / godot

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

GPUParticle3D crash Godot when changing certain settings or running game #70421

Closed elvisish closed 1 year ago

elvisish commented 1 year ago

Godot version

4.0 beta 9

System information

Windows 10, Vulkan, RTX 3060 (466.81)

Issue description

Non-stop crashes using GPUParticles3D.

Steps to reproduce

Honestly, this could go for almost every possible adjustment for shapes in GPUParticles3D.

Minimal reproduction project

GPUParticlesBrokenNoTB.zip

qarmin commented 1 year ago
core/object/undo_redo.h:54:9: runtime error: load of value 2, which is not a valid value for type 'bool'
=================================================================
==9098==ERROR: AddressSanitizer: heap-use-after-free on address 0x611003cc1b70 at pc 0x00001acf83ab bp 0x7fff177e34b0 sp 0x7fff177e34a0
READ of size 4 at 0x611003cc1b70 thread T0
    #0 0x1acf83aa in RendererRD::MeshStorage::mesh_surface_has_lod(void*) const (/usr/bin/godot4s+0x1acf83aa)
    #1 0x1ae20e8f in RendererSceneRenderImplementation::RenderForwardMobile::_fill_render_list(RendererSceneRenderImplementation::RenderForwardMobile::RenderListType, RenderDataRD const*, RendererSceneRenderImplementation::RenderForwardMobile::PassMode, bool) servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp:1820
    #2 0x1aded28f in RendererSceneRenderImplementation::RenderForwardMobile::_render_scene(RenderDataRD*, Color const&) servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp:681
    #3 0x1a90cd11 in RendererSceneRenderRD::render_scene(Ref<RenderSceneBuffers> const&, RendererSceneRender::CameraData const*, RendererSceneRender::CameraData const*, PagedArray<RenderGeometryInstance*> const&, PagedArray<RID> const&, PagedArray<RID> const&, PagedArray<RID> const&, PagedArray<RID> const&, PagedArray<RID> const&, PagedArray<RID> const&, RID, RID, RID, RID, RID, RID, int, float, RendererSceneRender::RenderShadowData const*, int, RendererSceneRender::RenderSDFGIData const*, int, RendererSceneRender::RenderSDFGIUpdateData const*, RenderingMethod::RenderInfo*) servers/rendering/renderer_rd/renderer_scene_render_rd.cpp:1171
    #4 0x1c9dc5f3 in RendererSceneCull::_render_scene(RendererSceneRender::CameraData const*, Ref<RenderSceneBuffers> const&, RID, RID, unsigned int, RID, RID, RID, RID, int, float, bool, RenderingMethod::RenderInfo*) servers/rendering/renderer_scene_cull.cpp:3270
    #5 0x1c9b4253 in RendererSceneCull::render_camera(Ref<RenderSceneBuffers> const&, RID, RID, RID, Vector2, bool, float, RID, Ref<XRInterface>&, RenderingMethod::RenderInfo*) servers/rendering/renderer_scene_cull.cpp:2551
    #6 0x1cb09573 in RendererViewport::_draw_3d(RendererViewport::Viewport*) servers/rendering/renderer_viewport.cpp:211
    #7 0x1cb0c6fc in RendererViewport::_draw_viewport(RendererViewport::Viewport*) servers/rendering/renderer_viewport.cpp:266
    #8 0x1cb201d2 in RendererViewport::draw_viewports() servers/rendering/renderer_viewport.cpp:711
    #9 0x1a2cf036 in RenderingServerDefault::_draw(bool, double) servers/rendering/rendering_server_default.cpp:91
    #10 0x1a2da00a in RenderingServerDefault::draw(bool, double) servers/rendering/rendering_server_default.cpp:391
    #11 0x29415ea in Main::iteration() main/main.cpp:3203
    #12 0x271db89 in OS_LinuxBSD::run() platform/linuxbsd/os_linuxbsd.cpp:878
    #13 0x26fab44 in main platform/linuxbsd/godot_linuxbsd.cpp:73
    #14 0x7f5c2222350f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #15 0x7f5c222235c8 in __libc_start_main_impl ../csu/libc-start.c:381
    #16 0x26fa4f4 in _start (/usr/bin/godot4s+0x26fa4f4)

0x611003cc1b70 is located 112 bytes inside of 232-byte region [0x611003cc1b00,0x611003cc1be8)
freed by thread T0 here:
    #0 0x7f5c22eb4537 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127
    #1 0x1d3e345b in Memory::free_static(void*, bool) core/os/memory.cpp:168
    #2 0x1b07bd05 in void memdelete<RendererRD::MeshStorage::Mesh::Surface>(RendererRD::MeshStorage::Mesh::Surface*) core/os/memory.h:112
    #3 0x1b036867 in RendererRD::MeshStorage::mesh_clear(RID) servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp:774
    #4 0x1a2f7517 in RenderingServerDefault::mesh_clear(RID) servers/rendering/rendering_server_default.h:312
    #5 0x17ae73e4 in PrimitiveMesh::_update() const scene/resources/primitive_meshes.cpp:123
    #6 0x17ae8c0f in PrimitiveMesh::_request_update() scene/resources/primitive_meshes.cpp:138
    #7 0x17b2f6b5 in PrismMesh::set_left_to_right(float) scene/resources/primitive_meshes.cpp:1706
    #8 0x4a85c79 in void call_with_variant_args_helper<__UnexistingClass, float, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(float), Variant const**, Callable::CallError&, IndexSequence<0ul>) core/variant/binder_common.h:262
    #9 0x4a725b2 in void call_with_variant_args_dv<__UnexistingClass, float>(__UnexistingClass*, void (__UnexistingClass::*)(float), Variant const**, int, Callable::CallError&, Vector<Variant> const&) core/variant/binder_common.h:409
    #10 0x4a5c74c in MethodBindT<float>::call(Object*, Variant const**, int, Callable::CallError&) const core/object/method_bind.h:320
    #11 0x1ebf17d9 in ClassDB::set_property(Object*, StringName const&, Variant const&, bool*) core/object/class_db.cpp:1077
    #12 0x1ec6645f in Object::set(StringName const&, Variant const&, bool*) core/object/object.cpp:249
    #13 0x1ed7c3d6 in UndoRedo::_process_operation_list(List<UndoRedo::Operation, DefaultAllocator>::Element*) core/object/undo_redo.cpp:351
    #14 0x1ed6ff59 in UndoRedo::_redo(bool) core/object/undo_redo.cpp:75
    #15 0x1ed79ce8 in UndoRedo::commit_action(bool) core/object/undo_redo.cpp:297
    #16 0xe0d1e4c in EditorUndoRedoManager::commit_action(bool) editor/editor_undo_redo_manager.cpp:234
    #17 0xd34b55e in EditorInspector::_edit_set(String const&, Variant const&, bool, String const&) editor/editor_inspector.cpp:3665
    #18 0xd34cb00 in EditorInspector::_property_changed(String const&, Variant const&, String const&, bool, bool) editor/editor_inspector.cpp:3682
    #19 0xd466b96 in void call_with_variant_args_helper<EditorInspector, String const&, Variant const&, String const&, bool, bool, 0ul, 1ul, 2ul, 3ul, 4ul>(EditorInspector*, void (EditorInspector::*)(String const&, Variant const&, String const&, bool, bool), Variant const**, Callable::CallError&, IndexSequence<0ul, 1ul, 2ul, 3ul, 4ul>) core/variant/binder_common.h:262
    #20 0xd45916d in void call_with_variant_args<EditorInspector, String const&, Variant const&, String const&, bool, bool>(EditorInspector*, void (EditorInspector::*)(String const&, Variant const&, String const&, bool, bool), Variant const**, int, Callable::CallError&) core/variant/binder_common.h:376
    #21 0xd43db7e in CallableCustomMethodPointer<EditorInspector, String const&, Variant const&, String const&, bool, bool>::call(Variant const**, int, Variant&, Callable::CallError&) const core/object/callable_method_pointer.h:104
    #22 0x1dff054c in Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const core/variant/callable.cpp:50
    #23 0x1e00154c in CallableCustomBind::call(Variant const**, int, Variant&, Callable::CallError&) const core/variant/callable_bind.cpp:99
    #24 0x1dff054c in Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const core/variant/callable.cpp:50
    #25 0x1ec82116 in Object::emit_signalp(StringName const&, Variant const**, int) core/object/object.cpp:1046
    #26 0xd253d91 in EditorProperty::emit_changed(StringName const&, Variant const&, StringName const&, bool) editor/editor_inspector.cpp:120
    #27 0xd95eba6 in EditorPropertyFloat::_value_changed(double) editor/editor_properties.cpp:1508
    #28 0xdc09a14 in void call_with_variant_args_helper<EditorPropertyFloat, double, 0ul>(EditorPropertyFloat*, void (EditorPropertyFloat::*)(double), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/usr/bin/godot4s+0xdc09a14)
    #29 0xdbf7407 in void call_with_variant_args<EditorPropertyFloat, double>(EditorPropertyFloat*, void (EditorPropertyFloat::*)(double), Variant const**, int, Callable::CallError&) (/usr/bin/godot4s+0xdbf7407)

previously allocated by thread T0 here:
    #0 0x7f5c22eb4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x1d3e237d in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:75
    #2 0x1d3e228e in operator new(unsigned long, char const*) core/os/memory.cpp:40
    #3 0x1b022f1f in RendererRD::MeshStorage::mesh_add_surface(RID, RenderingServer::SurfaceData const&) servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp:342
    #4 0x1a2f17a5 in RenderingServerDefault::mesh_add_surface(RID, RenderingServer::SurfaceData const&) servers/rendering/rendering_server_default.h:289
    #5 0x197bcb96 in RenderingServer::mesh_add_surface_from_arrays(RID, RenderingServer::PrimitiveType, Array const&, Array const&, Dictionary const&, unsigned int) servers/rendering_server.cpp:1058
    #6 0x17ae798c in PrimitiveMesh::_update() const scene/resources/primitive_meshes.cpp:124
    #7 0x17aeab3d in PrimitiveMesh::get_rid() const scene/resources/primitive_meshes.cpp:231
    #8 0x15542eba in GPUParticles3D::set_draw_pass_mesh(int, Ref<Mesh> const&) scene/3d/gpu_particles_3d.cpp:230
    #9 0x15594eee in void call_with_variant_args_helper<__UnexistingClass, int, Ref<Mesh> const&, 0ul, 1ul>(__UnexistingClass*, void (__UnexistingClass::*)(int, Ref<Mesh> const&), Variant const**, Callable::CallError&, IndexSequence<0ul, 1ul>) core/variant/binder_common.h:262
    #10 0x1558c9e7 in void call_with_variant_args_dv<__UnexistingClass, int, Ref<Mesh> const&>(__UnexistingClass*, void (__UnexistingClass::*)(int, Ref<Mesh> const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) core/variant/binder_common.h:409
    #11 0x15583c82 in MethodBindT<int, Ref<Mesh> const&>::call(Object*, Variant const**, int, Callable::CallError&) const core/object/method_bind.h:320
    #12 0x1ebf11c3 in ClassDB::set_property(Object*, StringName const&, Variant const&, bool*) core/object/class_db.cpp:1069
    #13 0x1ec6645f in Object::set(StringName const&, Variant const&, bool*) core/object/object.cpp:249
    #14 0x1797f5fa in SceneState::instantiate(SceneState::GenEditState) const scene/resources/packed_scene.cpp:331
    #15 0x179b78a0 in PackedScene::instantiate(PackedScene::GenEditState) const scene/resources/packed_scene.cpp:1802
    #16 0xd599492 in EditorNode::load_scene(String const&, bool, bool, bool, bool, bool) editor/editor_node.cpp:3835
    #17 0xd5e1780 in EditorNode::_load_open_scenes_from_config(Ref<ConfigFile>, String const&) editor/editor_node.cpp:4999
    #18 0xd5d3775 in EditorNode::_load_docks() editor/editor_node.cpp:4786
    #19 0xd4fb55f in EditorNode::_sources_changed(bool) editor/editor_node.cpp:1011
    #20 0xd7d7300 in void call_with_variant_args_helper<EditorNode, bool, 0ul>(EditorNode*, void (EditorNode::*)(bool), Variant const**, Callable::CallError&, IndexSequence<0ul>) core/variant/binder_common.h:262
    #21 0xd7cf0f0 in void call_with_variant_args<EditorNode, bool>(EditorNode*, void (EditorNode::*)(bool), Variant const**, int, Callable::CallError&) core/variant/binder_common.h:376
    #22 0xd7b4836 in CallableCustomMethodPointer<EditorNode, bool>::call(Variant const**, int, Variant&, Callable::CallError&) const core/object/callable_method_pointer.h:104
    #23 0x1dff054c in Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const core/variant/callable.cpp:50
    #24 0x1ec82116 in Object::emit_signalp(StringName const&, Variant const**, int) core/object/object.cpp:1046
    #25 0x81d4d19 in Error Object::emit_signal<bool>(StringName const&, bool) core/object/object.h:869
    #26 0xd076e3d in EditorFileSystem::_notification(int) editor/editor_file_system.cpp:1246
    #27 0xd0c13f7 in EditorFileSystem::_notificationv(int, bool) (/usr/bin/godot4s+0xd0c13f7)
    #28 0x1ec77a58 in Object::notification(int, bool) core/object/object.cpp:790
    #29 0x139aa703 in SceneTree::_notify_group_pause(StringName const&, int) scene/main/scene_tree.cpp:868

SUMMARY: AddressSanitizer: heap-use-after-free (/usr/bin/godot4s+0x1acf83aa) in RendererRD::MeshStorage::mesh_surface_has_lod(void*) const
elvisish commented 1 year ago

What's causing this? Currently I can't actually work with particles at all as everything I do just crashes it, is it some setting I need to change or is the project broken or something?

qarmin commented 1 year ago

Such crash not happens for me when using opengl 3 renderer

paruthidotexe commented 1 year ago

Also happening in G4.0 Beta 10 In Draw passes Changing the sphere radius, height, segments..Printing errors in console and crashes

Changing the sphere height from 0.2 to 0.3 Sometimes, On immediately increasing and reducing draw passes stops from crashing

Set height
  drivers/vulkan/rendering_device_vulkan.cpp:7238 - Condition "!vertex_array" is true.
  drivers/vulkan/rendering_device_vulkan.cpp:7262 - Condition "!index_array" is true.
  No vertex array was bound, and render pipeline expects vertices.
  drivers/vulkan/rendering_device_vulkan.cpp:7238 - Condition "!vertex_array" is true.
  drivers/vulkan/rendering_device_vulkan.cpp:7262 - Condition "!index_array" is true.
  No vertex array was bound, and render pipeline expects vertices.
.
.
.
drivers/vulkan/rendering_device_vulkan.cpp:7238 - Condition "!vertex_array" is true.
  drivers/vulkan/rendering_device_vulkan.cpp:7262 - Condition "!index_array" is true.
  drivers/vulkan/rendering_device_vulkan.cpp:6013 - Condition "!vertex_formats.has(p_vertex_format)" is true. Returning: RID()
  servers/rendering/renderer_rd/pipeline_cache_rd.cpp:61 - Condition "pipeline.is_null()" is true. Returning: RID()
  This render pipeline requires (0) bytes of push constant data, supplied: (128)
  No render pipeline was set before attempting to draw.
  drivers/vulkan/rendering_device_vulkan.cpp:4402 - Condition "!vertex_buffer_owner.owns(p_src_buffers[i])" is true. Returning: RID()
  drivers/vulkan/rendering_device_vulkan.cpp:7262 - Condition "!index_array" is true.
.
.
.
No vertex array was bound, and render pipeline expects vertices.
  No vertex array was bound, and render pipeline expects vertices.
  No vertex array was bound, and render pipeline expects vertices.
  No vertex array was bound, and render pipeline expects vertices.
  No vertex array was bound, and render pipeline expects vertices.
  No vertex array was bound, and render pipeline expects vertices.
  No vertex array was bound, and render pipeline expects vertices.
  No vertex array was bound, and render pipeline expects vertices.
  No vertex array was bound, and render pipeline expects vertices.
  No vertex array was bound, and render pipeline expects vertices.
Set draw_passes

Anyhow, for now moved to CPU particles in my project

elvisish commented 1 year ago

I'm thinking this might have been a mobile renderer issue as it doesn't appear to be happening on forward+, can anyone confirm this?

Alternalo commented 1 year ago

Happens to me also on Beta 10, PC, Forward+ renderer. Applied QuadMesh as Pass1, Standard material. Changing Billboard mode, Transparency or making it unshaded crashed Godot for me. Reproduced several times it is happening every time.

clayjohn commented 1 year ago

This is a duplicate of https://github.com/godotengine/godot/issues/69156. I will be closing this issue in favour of https://github.com/godotengine/godot/issues/69156 so we can track the issue in one place.