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

Godot crashes on project load in QuickHull::build #16560

Closed
danielwray opened this issue Feb 11, 2018 · 8 comments · Fixed by #21202
Closed

Godot crashes on project load in QuickHull::build #16560

danielwray opened this issue Feb 11, 2018 · 8 comments · Fixed by #21202

Comments

@danielwray
Copy link

Godot version:
3.0.stable.official
Godot_v3.0-stable_x11.64

OS/device including version:
Fedora 27 x64
Linux 4.14.16-300.fc27.x86_64 #1 SMP Wed Jan 31 19:24:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Issue description:
Loading Godot project returns several errors and crashes out with the following:

./Godot_v3.0-stable_x11.64 -v
No touch devices found
PulseAudio: detected 2 channels
PulseAudio: audio buffer frames: 512 calculated latency: 11ms
Using GLES3 video driver
OpenGL ES 3.0 Renderer: AMD TAHITI (DRM 2.50.0 / 4.14.16-300.fc27.x86_64, LLVM 5.0.0)
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
CORE API HASH: -5322839590168703562
EDITOR API HASH: 1130500531728179788
load resource: /home/xxx/.config/godot/editor_settings-3.tres
EditorSettings: Load OK!
EditorSettings Save OK!
FPS: 1
FPS: 79
OPENING: /home/xxx/game_development/physics_demos (::home::xxx::game_development::physics_demos)
EditorSettings Save OK!
OpenGL ES 3.0 Renderer: AMD TAHITI (DRM 2.50.0 / 4.14.16-300.fc27.x86_64, LLVM 5.0.0)
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F ' is true. Continuing..:
At: core/math/quick_hull.cpp:399.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F ' is true. Continuing..:
At: core/math/quick_hull.cpp:399.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' !F ' is true. Continuing..:
At: core/math/quick_hull.cpp:399.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F ' is true. Continuing..:
At: core/math/quick_hull.cpp:399.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
At: core/math/quick_hull.cpp:430.
ERROR: operator[]: FATAL: Index p_index=2 out of size (size()=0)
At: core/vector.h:138.
handle_crash: Program crashed with signal 4
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x376f0) [0x7f48ba4bf6f0] (??:0)
[2] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x493ba7] (??:?)
[3] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x1af8adf] (??:?)
[4] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0xaccca4] (??:?)
[5] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x108c808] (??:?)
[6] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0xcc5849] (:?)
[7] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x4f03e8] (??:?)
[8] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x1a06c29] (??:?)
[9] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x1b4550a] (??:?)
[10] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x176374f] (??:?)
[11] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0xec75b3] (??:?)
[12] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x4c3c78] (??:?)
[13] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x452dad] (??:?)
[14] /lib64/libc.so.6(__libc_start_main+0xea) [0x7f48ba4a900a] (??:0)
[15] /home/xxx/godot/Godot_v3.0-stable_x11.64() [0x45e5ff] (??:?)
-- END OF BACKTRACE --

Steps to reproduce:
Load scene file (see attached)

physics_demos.zip

@akien-mga akien-mga added this to the 3.1 milestone Feb 13, 2018
@akien-mga
Copy link
Member

Thanks for the report, I can reproduce the crash with the attached project, and go this backtrace (with debug symbols):

$ godot-git -e
OpenGL ES 3.0 Renderer: GeForce GTX 670MX/PCIe/SSE2
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
ERROR: build: Condition ' O == __null ' is true. Continuing..:
   At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' O == __null ' is true. Continuing..:
   At: core/math/quick_hull.cpp:403.
ERROR: build: Condition ' !F ' is true. Continuing..:
   At: core/math/quick_hull.cpp:399.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
   At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
   At: core/math/quick_hull.cpp:430.
ERROR: build: Condition ' !F2 ' is true. Continuing..:
   At: core/math/quick_hull.cpp:430.
ERROR: operator[]: FATAL: Index p_index=2 out of size (size()=0)
   At: core/vector.h:138.
handle_crash: Program crashed with signal 4
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x338a0) [0x7f72b48df8a0] (??:0)
[2] Vector<int>::operator[](int) (/home/akien/Projects/godot/godot.git/core/vector.h:138 (discriminator 7))
[3] QuickHull::build(Vector<Vector3> const&, Geometry::MeshData&) (/home/akien/Projects/godot/godot.git/core/math/quick_hull.cpp:416)
[4] CollisionShapeSpatialGizmo::redraw() (/home/akien/Projects/godot/godot.git/editor/spatial_editor_gizmos.cpp:2135 (discriminator 3))
[5] Spatial::set_gizmo(Ref<SpatialGizmo> const&) (/home/akien/Projects/godot/godot.git/scene/3d/spatial.cpp:414)
[6] SpatialEditor::_request_gizmo(Object*) (/home/akien/Projects/godot/godot.git/editor/plugins/spatial_editor_plugin.cpp:4815 (discriminator 3))
[7] MethodBind1<Object*>::call(Object*, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/core/method_bind.gen.inc:729 (discriminator 12))
[8] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/core/object.cpp:914 (discriminator 1))
[9] MessageQueue::_call_function(Object*, StringName const&, Variant const*, int, bool) (/home/akien/Projects/godot/godot.git/core/message_queue.cpp:260)
[10] MessageQueue::flush() (/home/akien/Projects/godot/godot.git/core/message_queue.cpp:307)
[11] SceneTree::idle(float) (/home/akien/Projects/godot/godot.git/scene/main/scene_tree.cpp:514)
[12] Main::iteration() (/home/akien/Projects/godot/godot.git/main/main.cpp:1737)
[13] OS_X11::run() (/home/akien/Projects/godot/godot.git/platform/x11/os_x11.cpp:2410)
[14] godot-git(main+0xb5) [0xeac81b] (/home/akien/Projects/godot/godot.git/platform/x11/godot_x11.cpp:56)
[15] /lib64/libc.so.6(__libc_start_main+0xf0) [0x7f72b48cc600] (??:0)
[16] godot-git(_start+0x29) [0xeac699] (/home/iurt/rpmbuild/BUILD/glibc-2.22/csu/../sysdeps/x86_64/start.S:121)
-- END OF BACKTRACE --

@akien-mga
Copy link
Member

akien-mga commented Feb 13, 2018

It seems that here:

#1  0x0000000002919a06 in QuickHull::build (p_points=..., r_mesh=...) at core/math/quick_hull.cpp:416
416                                                             int idx = O->get().indices[(k + j) % ois];

(k + j) % ois is (1 + 1) % 7 so 2, while O->get().indices is empty (who names variables 0‽).

Won't debug further in the coming days, so anyone is free to pick it from there.

There's likely something invalid in the attached project which triggers the crash, so two things need to be fixed:

  • The crash should be prevented by adding the relevant check further up the stacktrace to identify the invalid data and skip it cleanly after printing an error
  • The reason why this crash is happening should be investigated and ideally fixed

@danielwray Can you give more details regarding how you built this demo project?

@danielwray
Copy link
Author

Hi Akien,

I received errors in the debug console while setting up the scene and this appears to be due to exporting a OBJ mesh from Blender with 'n-gons', and then applying a convex static body via the Mesh drop-down in the 3D view. I do not know if this is the root cause, however the errors do appear to be reference a similar part of the code that I would assume is responsible for creating a mesh hull.

When converting the obj to a triangulated mesh this appears to resolve the error scene in the image, however I cannot get the scene to fail to load like the original setup.

ngon-with-tri-mesh-shape

@akien-mga
Copy link
Member

See also #17069 for an additional scene that reproduces the issue.

@czarnota
Copy link
Contributor

czarnota commented Feb 28, 2018

I have the same problem with my scene

Started digging deeper with gdb and found that at the moment of crash (line 416)

407|                                 int ois = O->get().indices.size();
408|                                 int merged = 0;
409|
410|                                 for (int j = 0; j < ois; j++) {
411|                                         //search a
412|                                         if (O->get().indices[j] == a) {
413|                                                 //append the rest
414|                                                 for (int k = 0; k < ois; k++) {
415|
416+>                                                        int idx = O->get().indices[(k + j) % ois];
417|                                                         int idxn = O->get().indices[(k + j + 1) % ois];

And the values of ois and O->get().indices.size() are:

(gdb) p ois
$25 = 9
(gdb) p O->get().indices.size()
$26 = 0

which is weird because at the start of the loop

int ois = O->get().indices.size();

Looks like O->get().indices is modified inside the loop but I can't tell where exactly and why.

@Nutriz
Copy link
Contributor

Nutriz commented Apr 22, 2018

Still happening ! Lost 1 hour during the ludum dare :(

@akien-mga akien-mga changed the title Godot crashes on project load Godot crashes on project load in QuickHull::build May 1, 2018
@akien-mga
Copy link
Member

See also #17569 for detailed steps to reproduce this crash (at least it looks related).

@kiiada
Copy link

kiiada commented May 3, 2018

In the meantime, and if your project still loads, I recommend roughing out collisionshapes with cubes on anything cylindrical.

hpvb added a commit to hpvb/godot that referenced this issue Aug 19, 2018
We delete the faces for consideration in this loop but we can still
sometimes find an edge that connects to this face. We now interate over
all edges and disconnect edges connecting to this face.

This fixes godotengine#16560 and fixes godotengine#17569
dragmz pushed a commit to dragmz/godot that referenced this issue Aug 20, 2018
We delete the faces for consideration in this loop but we can still
sometimes find an edge that connects to this face. We now interate over
all edges and disconnect edges connecting to this face.

This fixes godotengine#16560 and fixes godotengine#17569
akien-mga pushed a commit to akien-mga/godot that referenced this issue Jul 3, 2019
We delete the faces for consideration in this loop but we can still
sometimes find an edge that connects to this face. We now interate over
all edges and disconnect edges connecting to this face.

This fixes godotengine#16560 and fixes godotengine#17569

(cherry picked from commit 33669a8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants