Godot version: 3.2.2
OS/device including version: Linux 5.7.0-2-amd64 #1 SMP Debian 5.7.10-1 (2020-07-26) x86_64 GNU/Linux, KDE Plasma 5.17
Issue description: When starting godot --verbose on my machine, I get the following output. Godot does not start.
mark@mrh:~/Applications$ ./Godot_v3.2.2-stable_x11.64 --verbose
Godot Engine v3.2.2.stable.official - https://godotengine.org
XInput: Refreshing devices.
XInput: No touch devices found.
Input method doesn't support any styles
free(): invalid pointer
Aborted
Steps to reproduce: Not sure how to reproduce, as it seems like a potential kernel issue?
Minimal reproduction project: See above
Can you compile Godot with address sanitizer support and try to run it?
It should show stacktrace where exactly crashed.
scons p=x11 -j6 use_asan=yes
DRI_PRIME=0 bin/godot.x11.tools.64s
Compiled for v4.0.dev and it failed the same way - I can build with 3.2.2 also if you'd like
Godot Engine v4.0.dev.custom_build.ec9302cec - https://godotengine.org
Input method doesn't support any styles
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] ./bin/godot.linuxbsd.tools.64s() [0x19e475b] (/home/mark/Applications/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:54)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x3bd30) [0x7f67da977d30] (??:0)
[3] /lib/x86_64-linux-gnu/libasan.so.6(+0x28532) [0x7f67db33f532] (??:0)
[4] /lib/x86_64-linux-gnu/libasan.so.6(__interceptor_free+0x94) [0x7f67db3c0b44] (??:0)
[5] /lib/x86_64-linux-gnu/libX11.so.6(XFree+0x9) [0x7f67daffd7b9] (??:0)
[6] DisplayServerX11::DisplayServerX11(String const&, DisplayServer::WindowMode, unsigned int, Vector2i const&, Error&) (/home/mark/Applications/godot/platform/linuxbsd/display_server_x11.cpp:3461)
[7] DisplayServerX11::create_func(String const&, DisplayServer::WindowMode, unsigned int, Vector2i const&, Error&) (/home/mark/Applications/godot/platform/linuxbsd/display_server_x11.cpp:3127)
[8] DisplayServer::create(int, String const&, DisplayServer::WindowMode, unsigned int, Vector2i const&, Error&) (/home/mark/Applications/godot/servers/display_server.cpp:604)
[9] Main::setup2(unsigned long) (/home/mark/Applications/godot/main/main.cpp:1377 (discriminator 2))
[10] Main::setup(char const*, int, char**, bool) (/home/mark/Applications/godot/main/main.cpp:1299)
[11] ./bin/godot.linuxbsd.tools.64s(main+0x242) [0x19e3c44] (/home/mark/Applications/godot/platform/linuxbsd/godot_linuxbsd.cpp:51)
[12] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea) [0x7f67da962cca] (??:0)
[13] ./bin/godot.linuxbsd.tools.64s(_start+0x2a) [0x19e394a] (??:?)
-- END OF BACKTRACE --
Aborted
Edit: Here's 3.2.2
Godot Engine v3.2.2.stable.custom_build.6a9fbafcb - https://godotengine.org
Input method doesn't support any styles
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] ./bin/godot.x11.tools.64s() [0x143a671] (/home/mark/Applications/godot/platform/x11/crash_handler_x11.cpp:54)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x3bd30) [0x7f6e1bb8ed30] (??:0)
[3] /lib/x86_64-linux-gnu/libasan.so.6(+0x28532) [0x7f6e1c7e7532] (??:0)
[4] /lib/x86_64-linux-gnu/libasan.so.6(__interceptor_free+0x94) [0x7f6e1c868b44] (??:0)
[5] /lib/x86_64-linux-gnu/libX11.so.6(XFree+0x9) [0x7f6e1c29b7b9] (??:0)
[6] OS_X11::initialize(OS::VideoMode const&, int, int) (/home/mark/Applications/godot/platform/x11/os_x11.cpp:230)
[7] Main::setup2(unsigned long) (/home/mark/Applications/godot/main/main.cpp:1255 (discriminator 1))
[8] Main::setup(char const*, int, char**, bool) (/home/mark/Applications/godot/main/main.cpp:1199)
[9] ./bin/godot.x11.tools.64s(main+0x19c) [0x14369fe] (/home/mark/Applications/godot/platform/x11/godot_x11.cpp:49)
[10] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea) [0x7f6e1bb79cca] (??:0)
[11] ./bin/godot.x11.tools.64s(_start+0x2a) [0x14367aa] (??:?)
-- END OF BACKTRACE --
Aborted
You can try to comment this line, compile and check if works(it may leaks some memory, but I don't think so):
https://github.com/godotengine/godot/blob/be435608b0b1bb6ff3de10009ade5ec2017016d8/platform/linuxbsd/display_server_x11.cpp#L3461
On Github in all checked by me examples of usage XGetIMValues, returned value were used(or even not), but never freed.(example - https://github.com/Sly14/upp-mirror/blob/ed9bc6028a6eed422b7daa21139a5e7cbb5f1fb7/uppdev/IMTest/IMTest.cpp#L65-L70)
Thanks a lot, that seems to help. Still some errors in the startup, but I'm able to start and open projects now.
Godot Engine v4.0.dev.custom_build.ec9302cec - https://godotengine.org
Input method doesn't support any styles
ERROR: Can't find layer: VK_LAYER_KHRONOS_validation
at: _check_layers (drivers/vulkan/vulkan_context.cpp:157)
ERROR: Can't find layer: VK_LAYER_LUNARG_standard_validation
at: _check_layers (drivers/vulkan/vulkan_context.cpp:157)
ERROR: Can't find layer: VK_LAYER_GOOGLE_threading
at: _check_layers (drivers/vulkan/vulkan_context.cpp:157)
WARNING: XCreateIC couldn't create wd.xic
at: _create_window (platform/linuxbsd/display_server_x11.cpp:3229)
DisplayServer::_create_window 0 want rect: 448, 240, 1024, 600 got rect 448, 240, 1024, 600
WARNING: XCreateIC couldn't create wd.xic
at: _create_window (platform/linuxbsd/display_server_x11.cpp:3229)
DisplayServer::_create_window 1 want rect: 709, 491, 501, 97 got rect 709, 491, 501, 97
DisplayServer::_window_changed: 0 rect: 1062, 66, 1024, 600
DisplayServer::_window_changed: 0 rect: 1062, 66, 846, 1003
DisplayServer::_window_changed: 0 rect: 1062, 66, 846, 481
DisplayServer::_window_changed: 1 rect: 709, 491, 846, 481
DisplayServer::_window_changed: 1 rect: 1062, 587, 846, 481
DisplayServer::_window_changed: 0 rect: 1062, 66, 846, 1003
WARNING: XCreateIC couldn't create wd.xic
at: _create_window (platform/linuxbsd/display_server_x11.cpp:3229)
DisplayServer::_create_window 2 want rect: 610, 290, 700, 500 got rect 610, 290, 700, 500
DisplayServer::_window_changed: 2 rect: 1062, 587, 700, 500
DisplayServer::_window_changed: 0 rect: 1062, 66, 846, 481
DisplayServer::_window_changed: 2 rect: 1062, 587, 846, 481
Scanning projects at: /home/mark/Documents/Godot
Found 5 projects.
DisplayServer::_window_changed: 0 rect: 1062, 66, 846, 1003
Editing project: /home/mark/Documents/Godot/Coursera2D (::home::mark::Documents::Godot::Coursera2D)
Godot Engine v4.0.dev.custom_build.ec9302cec - https://godotengine.org
Input method doesn't support any styles
ERROR: Can't find layer: VK_LAYER_KHRONOS_validation
at: _check_layers (drivers/vulkan/vulkan_context.cpp:157)
ERROR: Can't find layer: VK_LAYER_LUNARG_standard_validation
at: _check_layers (drivers/vulkan/vulkan_context.cpp:157)
ERROR: Can't find layer: VK_LAYER_GOOGLE_threading
at: _check_layers (drivers/vulkan/vulkan_context.cpp:157)
ERROR: Some texture bindings were not properly freed (leaked CanvasItems?)
at: ~RasterizerCanvasRD (servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp:2500)
=================================================================
==36097==ERROR: LeakSanitizer: detected memory leaks
Looks like I can backport this workaround to 3.2.2 by making the same comment edit in platforms/x11/os_x11.cpp, trying now.
I have the same problem to start godot. I run godot in archlinux.
Godot Engine v3.2.2.stable.custom_build - https://godotengine.org
XInput: Refreshing devices.
XInput: No touch devices found.
Input method doesn't support any styles
free(): invalid pointer
[1] 6404 abort (core dumped) godot -v
On Github in all checked by me examples of usage XGetIMValues, returned value were used(or even not), but never freed.
Extract from man page for XGetIMValues:
This function returns NULL if it succeeds; otherwise, it returns the name of the first argument that could not be obtained.
If I get it correctly char *imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, nullptr); gonna return NULL if succeeded and pointer to the string constant XNQueryInputStyle otherwise (same pointer function received as argument).
Confirmed that commenting out this line in tags/3.2.2-stable also produces the workaround. Still lots of memory leak warnings.
https://github.com/godotengine/godot/blob/3.2.2-stable/platform/x11/os_x11.cpp#L228-230
What exactly leaks(you cut the last report in previous message)?
Some leaks exists in Godot due bugs in libraries like libx11 etc.
The 3.2.2 logs ended up being like 78k lines long just from opening the program and closing it quickly... here's the beginning:
Godot Engine v3.2.2.stable.custom_build.6a9fbafcb - https://godotengine.org
Input method doesn't support any styles
==45789==Running thread 45783 was not suspended. False leaks are possible.
=================================================================
==45784==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 9408 byte(s) in 1 object(s) allocated from:
#0 0x7fef0adb9e8f in malloc (/lib/x86_64-linux-gnu/libasan.so.6+0xa9e8f)
#1 0x7fef054de31b (/lib/x86_64-linux-gnu/libGLX_mesa.so.0+0x3031b)
Direct leak of 200 byte(s) in 1 object(s) allocated from:
#0 0x7fef0adb9e8f in malloc (/lib/x86_64-linux-gnu/libasan.so.6+0xa9e8f)
#1 0x6f875d9 in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:82
#2 0x6f874f8 in operator new(unsigned long, char const*) core/os/memory.cpp:42
#3 0x6cd39e4 in MethodBind* create_vararg_method_bind<Object>(Variant (Object::*)(Variant const**, int, Variant::CallError&), MethodInfo const&, bool) core/method_bind.h:394
#4 0x6ccd22a in MethodBind* ClassDB::bind_vararg_method<Variant (Object::*)(Variant const**, int, Variant::CallError&)>(unsigned int, StringName, Variant (Object::*)(Variant const**, int, Variant::CallError&), MethodInfo const&, Vector<Variant> const&, bool) core/class_db.h:314
#5 0x6cc0877 in Object::_bind_methods() core/object.cpp:1744
#6 0x6cbd4a2 in Object::initialize_class() core/object.cpp:1619
#7 0x157dc8e in Reference::initialize_class() core/reference.h:41
#8 0x15c516c in ResourceFormatLoader::initialize_class() core/io/resource_loader.h:62
#9 0x15c51ae in ResourceFormatLoader::_initialize_classv() core/io/resource_loader.h:62
#10 0x6ca9ef8 in Object::_postinitialize() core/object.cpp:396
#11 0x6cc78b0 in postinitialize_handler(Object*) core/object.cpp:2058
#12 0x6d24d3e in TranslationLoaderPO* _post_initialize<TranslationLoaderPO>(TranslationLoaderPO*) core/os/memory.h:91
#13 0x6d24d3e in Ref<TranslationLoaderPO>::instance() core/reference.h:285
#14 0x6d156b6 in register_core_types() core/register_core_types.cpp:116
#15 0x14b876c in Main::setup(char const*, int, char**, bool) main/main.cpp:355
#16 0x14369fd in main platform/x11/godot_x11.cpp:49
#17 0x7fef0a0cacc9 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26cc9)
Direct leak of 200 byte(s) in 1 object(s) allocated from:
#0 0x7fef0adb9e8f in malloc (/lib/x86_64-linux-gnu/libasan.so.6+0xa9e8f)
#1 0x6f875d9 in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:82
#2 0x6f874f8 in operator new(unsigned long, char const*) core/os/memory.cpp:42
#3 0x6cd39e4 in MethodBind* create_vararg_method_bind<Object>(Variant (Object::*)(Variant const**, int, Variant::CallError&), MethodInfo const&, bool) core/method_bind.h:394
#4 0x6ccd22a in MethodBind* ClassDB::bind_vararg_method<Variant (Object::*)(Variant const**, int, Variant::CallError&)>(unsigned int, StringName, Variant (Object::*)(Variant const**, int, Variant::CallError&), MethodInfo const&, Vector<Variant> const&, bool) core/class_db.h:314
#5 0x6cc055b in Object::_bind_methods() core/object.cpp:1736
#6 0x6cbd4a2 in Object::initialize_class() core/object.cpp:1619
#7 0x157dc8e in Reference::initialize_class() core/reference.h:41
#8 0x15c516c in ResourceFormatLoader::initialize_class() core/io/resource_loader.h:62
#9 0x15c51ae in ResourceFormatLoader::_initialize_classv() core/io/resource_loader.h:62
#10 0x6ca9ef8 in Object::_postinitialize() core/object.cpp:396
#11 0x6cc78b0 in postinitialize_handler(Object*) core/object.cpp:2058
#12 0x6d24d3e in TranslationLoaderPO* _post_initialize<TranslationLoaderPO>(TranslationLoaderPO*) core/os/memory.h:91
#13 0x6d24d3e in Ref<TranslationLoaderPO>::instance() core/reference.h:285
#14 0x6d156b6 in register_core_types() core/register_core_types.cpp:116
#15 0x14b876c in Main::setup(char const*, int, char**, bool) main/main.cpp:355
#16 0x14369fd in main platform/x11/godot_x11.cpp:49
#17 0x7fef0a0cacc9 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26cc9)
Direct leak of 200 byte(s) in 1 object(s) allocated from:
#0 0x7fef0adb9e8f in malloc (/lib/x86_64-linux-gnu/libasan.so.6+0xa9e8f)
#1 0x6f875d9 in Memory::alloc_static(unsigned long, bool) core/os/memory.cpp:82
#2 0x6f874f8 in operator new(unsigned long, char const*) core/os/memory.cpp:42
#3 0x6bcd146 in MethodBind* create_vararg_method_bind<FuncRef>(Variant (FuncRef::*)(Variant const**, int, Variant::CallError&), MethodInfo const&, bool) core/method_bind.h:394
#4 0x6bcc7dd in MethodBind* ClassDB::bind_vararg_method<Variant (FuncRef::*)(Variant const**, int, Variant::CallError&)>(unsigned int, StringName, Variant (FuncRef::*)(Variant const**, int, Variant::CallError&), MethodInfo const&, Vector<Variant> const&, bool) (/home/mark/Applications/godot/bin/godot.x11.tools.64s+0x6bcc7dd)
#5 0x6bcb0a4 in FuncRef::_bind_methods() core/func_ref.cpp:88
#6 0x6bcbb71 in FuncRef::initialize_class() core/func_ref.h:38
#7 0x6d29b50 in void ClassDB::register_class<FuncRef>() core/class_db.h:176
#8 0x6d15907 in register_core_types() core/register_core_types.cpp:155
#9 0x14b876c in Main::setup(char const*, int, char**, bool) main/main.cpp:355
#10 0x14369fd in main platform/x11/godot_x11.cpp:49
#11 0x7fef0a0cacc9 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26cc9)
You should run godot with DRI_PRIME=0 command before, like I wrote in my first post
Well, in that case the output is delightfully quiet. :)
Godot Engine v3.2.2.stable.custom_build.6a9fbafcb - https://godotengine.org
Input method doesn't support any styles
WARNING: initialize: XCreateIC couldn't create xic
At: platform/x11/os_x11.cpp:500.
OpenGL ES 3.0 Renderer: Mesa Intel(R) UHD Graphics (CML GT2)
It is a bug in libx11 1.6.10 you can fix it by downgrading to 1.6.9. (this fixed the issue for me)
Fixed with a quick update to libx11 on my machine. Based on this and the workaround I'm comfortable closing this.
hi im having this very same issue, Linux Deepinv20 (debian10 stable based), it worked just fine before, the other day i had a system update, and now godot won't start. libx11-dev is on version 1.6.7.1-1 which is what debian10 stable uses. DRI_PRIME=0 does not fix the issue either. only thing i installed lately (before the issue started) I did a system update like i said before, and a messeged poped at the end, looked for that on google and it said i had to install initramfs-tools so i did, everything works on my PC, except godot, it wont start. i decided to remove initramfs-tools but issue persist.
hi im having this very same issue, Linux Deepinv20 (debian10 stable based), it worked just fine before, the other day i had a system update, and now godot won't start. libx11-dev is on version 1.6.7.1-1 which is what debian10 stable uses. DRI_PRIME=0 does not fix the issue either. only thing i installed lately (before the issue started) I did a system update like i said before, and a messeged poped at the end, looked for that on google and it said i had to install initramfs-tools so i did, everything works on my PC, except godot, it wont start. i decided to remove initramfs-tools but issue persist.
I think it's a problem of libx11. Today i just upgrade libx11 from 1.6.7-1 to 1.6.12-1 by runing 'apt update && apt upgrade' and the issue fixed. I can start godot now.
Most helpful comment
It is a bug in libx11 1.6.10 you can fix it by downgrading to 1.6.9. (this fixed the issue for me)