godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

[GDExtension] updating library during editor opened, crashes the engine

Open nonunknown opened this issue 4 years ago • 3 comments

Godot version

v4.0.dev.custom_build [ac7505e27]

System information

manjaro 21, AMD Radeon r7 200 series, Vulkan, 8GB Memory

Issue description

editor throws this and closes when updating the .so file:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.dev.custom_build (ac7505e27730a800c9167ab940216c3980257b5b)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x3cda0) [0x7fc9666e7da0] (??:0)
[2] /lib64/ld-linux-x86-64.so.2(+0xa322) [0x7fc966c79322] (??:0)
[3] /lib64/ld-linux-x86-64.so.2(+0xa86f) [0x7fc966c7986f] (??:0)
[4] /lib64/ld-linux-x86-64.so.2(+0xb1d1) [0x7fc966c7a1d1] (??:0)
[5] /usr/lib/libc.so.6(+0x1385f5) [0x7fc9667e35f5] (??:0)
[6] /usr/lib/libdl.so.2(+0x24d8) [0x7fc9669bf4d8] (??:0)
[7] /usr/lib/libc.so.6(_dl_catch_exception+0x88) [0x7fc9667e3ce8] (??:0)
[8] /usr/lib/libc.so.6(_dl_catch_error+0x33) [0x7fc9667e3db3] (??:0)
[9] /usr/lib/libdl.so.2(+0x2b99) [0x7fc9669bfb99] (??:0)
[10] /usr/lib/libdl.so.2(dlsym+0x64) [0x7fc9669bf544] (??:0)
[11] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x17dcbe2) [0x55eb761f5be2] (??:0)
[12] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x41f32c9) [0x55eb78c0c2c9] (??:0)
[13] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x41f4f5c) [0x55eb78c0df5c] (??:0)
[14] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x3ef3ced) [0x55eb7890cced] (??:0)
[15] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x3efa6a0) [0x55eb789136a0] (??:0)
[16] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x3ed0dd7) [0x55eb788e9dd7] (??:0)
[17] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x1a0e31c) [0x55eb7642731c] (??:0)
[18] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x1a6dce9) [0x55eb76486ce9] (??:0)
[19] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x422efae) [0x55eb78c47fae] (??:0)
[20] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x422fdb3) [0x55eb78c48db3] (??:0)
[21] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x197b7ac) [0x55eb763947ac] (??:0)
[22] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x197d356) [0x55eb76396356] (??:0)
[23] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x4220524) [0x55eb78c39524] (??:0)
[24] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x28169f2) [0x55eb7722f9f2] (??:0)
[25] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x281829f) [0x55eb7723129f] (??:0)
[26] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x9518cf) [0x55eb7536a8cf] (??:0)
[27] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x928841) [0x55eb75341841] (??:0)
[28] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x917522) [0x55eb75330522] (??:0)
[29] /usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7fc9666d2b25] (??:0)
[30] /run/media/nonunknown/3a1f3657-ce4a-4ffa-8f65-f41e1dfcaf68/4godot.64(+0x9271ae) [0x55eb753401ae] (??:0)
-- END OF BACKTRACE --
================================================================

Steps to reproduce

  • Create a gdextension project with the .gdextension and .so files
  • run the game and test the library
  • now with editor opened
  • modify the .so file with an updated version
  • editor will complain and crash

Minimal reproduction project

N/a

nonunknown avatar Oct 03 '21 00:10 nonunknown

GDExtensions doesn't have the ability to unload and reload libraries like the old GDNative had, it's was dangerous to do so back then and would fail in many cases. With extensions this is even harder if not impossible to do as you're literally pulling the rug from underneath your code base. The moment the library is unloaded you loose all class definitions you've added while loaded scenes and cached objects all still rely on that information.

So unfortunately with extensions you will have to exit and re-start Godot between compiling.

BastiaanOlij avatar Nov 16 '21 23:11 BastiaanOlij

interesting, in this case, can you tell me @BastiaanOlij if its possible to restart the engine via gdscript? or should a bash/bat file to do so! the problem is, how to make the engine restart and go back where it was...

nonunknown avatar Nov 17 '21 09:11 nonunknown

if its possible to restart the engine via gdscript?

Not yet, see https://github.com/godotengine/godot/pull/54738.

Calinou avatar Nov 17 '21 14:11 Calinou

Hot reloading was implemented in https://github.com/godotengine/godot/pull/80284 / #1200.

So this can be closed I'd say, no?

MJacred avatar Jan 22 '24 10:01 MJacred