Hoimar / Planet-Generator

A procedural planet generator addon for Godot with terrain LOD.
Other
196 stars 23 forks source link

Occasional multithreading related crashes (especially benchmark scene) #9

Closed Hoimar closed 3 years ago

Hoimar commented 3 years ago

When running the benchmark scene, it sometimes crashes it's running Godot process. This happens with one worker thread but is amplified when using more. It also seems to happen independently from using or not using the "feeder thread" in JobQueue.

Next steps would be to make a minimal reproduction project to narrow down what makes it crash. Perhaps it's a missing mutex or something else that could lead to memory corruption, or even an engine bug.

Edit: This also sometimes happens when launching the editor and when saving scripts in the editor (hot reloading related). I also had a crash once in the running solar system demo scene that may be related.

The crash usually looks like this:

Iteration 1 finished in 12.598ms.
Iteration 2 finished in 488.927ms.
Iteration 3 finished in 5.576ms.
Iteration 4 finished in 19.339ms.
Iteration 5 finished in 284.263ms.
Iteration 6 finished in 15.944ms.
Iteration 7 finished in 299.750ms.
ERROR: _ref: Condition "!success" is true.
   At: core/array.cpp:55.
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
Iteration 8 finished in 17.251ms.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f7cb12d3210] (??:0)
Iteration 9 finished in 299.121ms.
[2] /path/to/Godot() [0x1fc9233] (/godot-source/./core/cowdata.h:138)
Iteration 10 finished in 250.297ms.
Generated 10 times in 1693.066ms.
[3] /path/to/Godot() [0x20e384c] (/godot-source/core/variant_op.cpp:2991)
[4] /path/to/Godot() [0x4ee2bf] (/godot-source/modules/gdscript/gdscript_function.cpp:1442 (discriminator 3))
[5] /path/to/Godot() [0x49d740] (/godot-source/modules/gdscript/gdscript.cpp:1208)
[6] /path/to/Godot() [0x202eae6] (/godot-source/core/object.cpp:898 (discriminator 1))
[7] /path/to/Godot() [0x20984b8] (/godot-source/core/variant_call.cpp:1149 (discriminator 1))
[8] /path/to/Godot() [0x4e8400] (/godot-source/modules/gdscript/gdscript_function.cpp:1089)
[9] /path/to/Godot() [0x49d740] (/godot-source/modules/gdscript/gdscript.cpp:1208)
[10] /path/to/Godot() [0x202eae6] (/godot-source/core/object.cpp:898 (discriminator 1))
[11] /path/to/Godot() [0x20984b8] (/godot-source/core/variant_call.cpp:1149 (discriminator 1))
[12] /path/to/Godot() [0x4e8400] (/godot-source/modules/gdscript/gdscript_function.cpp:1089)
[13] /path/to/Godot() [0x49d740] (/godot-source/modules/gdscript/gdscript.cpp:1208)
[14] /path/to/Godot() [0x202eae6] (/godot-source/core/object.cpp:898 (discriminator 1))
[15] /path/to/Godot() [0x20984b8] (/godot-source/core/variant_call.cpp:1149 (discriminator 1))
[16] /path/to/Godot() [0x4e8400] (/godot-source/modules/gdscript/gdscript_function.cpp:1089)
[17] /path/to/Godot() [0x49d740] (/godot-source/modules/gdscript/gdscript.cpp:1208)
[18] /path/to/Godot() [0x202eae6] (/godot-source/core/object.cpp:898 (discriminator 1))
[19] /path/to/Godot() [0x21dea93] (/godot-source/core/bind/core_bind.cpp:2758)
[20] /path/to/Godot() [0x2124d4d] (/godot-source/core/os/thread.cpp:76)
[21] /path/to/Godot() [0x23804d4] (thread.o:?)
[22] /lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7f7cb15dd609] (??:0)
[23] /lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f7cb13af293] (??:0)
-- END OF BACKTRACE --
Hoimar commented 3 years ago

This should be fixed in a5c922f0837b3321a7720516b9e597b03c43a2d0, was able to identify and fix the issue, no crashes so far anymore.

Closing.