Closed Amatrelan closed 1 year ago
CC @Razoric480
Hrm... Looks like it is crashing converting a datatype from StringName to String with the datatypes in the parameters, statements, or return type.
I'm honestly unsure what could cause it.
@Amatrelan It seems to be related to type hints. If you can narrow down a pattern based on what you're working on when the crash occurs next time (what kind of variable you're editing, are you hovering over something, trying to access docs, is it return type, variables, in the parameters or somewhere in the function body, etc.), that'd be helpful. Or even a sample of the script you were working on when it happens (ideally in the state it was left in while crashing, even if unfinished.)
As it is, though, it's not obvious to me.
Hmm crashed right away again now I opened project again to investigate this
This is error message what came after previous crash, and now MainScene.tscn seems to be Scene file 'MainScene.tscn' appears to be invalid/corrupt.
...
ERROR: Native class BattlerStats.UpgradeableStats used in script doesn't exist or isn't exposed.
at: get_function_signature (modules/gdscript/gdscript_analyzer.cpp:3601)
ERROR: Native class BattlerStats.UpgradeableStats used in script doesn't exist or isn't exposed.
at: get_function_signature (modules/gdscript/gdscript_analyzer.cpp:3601)
ERROR: res://src/combat/battlers/Battler.tscn:9 - Parse Error: [ext_resource] referenced non-loaded resource at: res://src/combat/battlers/Battler.gd
at: _parse_ext_resource (scene/resources/resource_format_text.cpp:170)
ERROR: res://src/combat/battlers/Battler.tscn:9 - Parse Error: [ext_resource] referenced non-loaded resource at: res://src/combat/battlers/Battler.gd
at: _parse_node_tag (scene/resources/resource_format_text.cpp:269)
ERROR: Failed loading resource: res://src/combat/battlers/Battler.tscn. Make sure resources have been imported by opening the project in the editor at least once.
at: _load (core/io/resource_loader.cpp:205)
ERROR: res://src/main/prototype_scenes/MainScene.tscn:29 - Parse Error: [ext_resource] referenced non-loaded resource at: res://src/combat/battlers/Battler.tscn
at: _parse_ext_resource (scene/resources/resource_format_text.cpp:170)
ERROR: res://src/main/prototype_scenes/MainScene.tscn:29 - Parse Error: [ext_resource] referenced non-loaded resource at: res://src/combat/battlers/Battler.tscn
at: _parse_node_tag (scene/resources/resource_format_text.cpp:269)
ERROR: Failed loading resource: res://src/main/prototype_scenes/MainScene.tscn. Make sure resources have been imported by opening the project in the editor at least once.
at: _load (core/io/resource_loader.cpp:205)
ERROR: Index p_idx = 1 is out of bounds (edited_scene.size() = 1).
at: remove_scene (editor/editor_data.cpp:554)
BattlerStats.UpgradeableStats
is Enum value.
There seems to be something wrong with that Battler.tscn and Battler.gd
And after I load that MainScene.tscn
it opens normally but with error. Might be that new "enum" causes some problems.
ERROR: Native class BattlerStats.UpgradeableStats used in script doesn't exist or isn't exposed.
at: get_function_signature (modules/gdscript/gdscript_analyzer.cpp:3601)
But then again this don't crash right away, again so don't have narrowed down cause of this.
I will continue to narrow down the reason why and when this happens
That's... unusual. Think there's something deeper going on than LSP issues.
Ok now found one way to crash. took while to find out good way to crash. And still little random.
class_name ResourceTest
extends Resource
@export var resource: Resource
@export var resource: ResouceTest
After this is seems to spam errors in editor and terminal and after some time it crashes.
The annoying part about this is that I cannot create example from this. Now that it crashed few times in my project it stopped crashing, there seems to be some hidden things hiding still what I don't know yet.
It seems sometimes LSP or Script parser continues to try resolve things what are broken and after sometime it crashes, and it don't seem to do this always.
...
SCRIPT ERROR: Parse Error: Export type can only be built-in, a resource, or an enum.
at: GDScript::reload (res://src/character/BaseCharacter.gd:4)
ERROR: Method/function failed. Returning: ERR_PARSE_ERROR
at: reload (modules/gdscript/gdscript.cpp:873)
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.dev.custom_build (14b69483b6b3ddc23e123c976a10c1adc91646f7)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x3cda0) [0x7f853e661da0] (??:0)
[2] StringName::operator String() const (??:0)
[3] GDScriptParser::DataType::to_string() const (??:0)
[4] ExtendGDScriptParser::parse_class_symbol(GDScriptParser::ClassNode const*, lsp::DocumentSymbol&) (??:0)
[5] ExtendGDScriptParser::update_symbols() (??:0)
[6] ExtendGDScriptParser::parse(String const&, String const&) (??:0)
[7] GDScriptWorkspace::parse_script(String const&, String const&) (??:0)
[8] GDScriptTextDocument::sync_script_content(String const&, String const&) (??:0)
[9] GDScriptTextDocument::didChange(Variant const&) (??:0)
[10] void call_with_variant_args_helper<__UnexistingClass, Variant const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (??:0)
[11] void call_with_variant_args_dv<__UnexistingClass, Variant const&>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (??:0)
[12] MethodBindT<Variant const&>::call(Object*, Variant const**, int, Callable::CallError&) (??:0)
[13] Object::call(StringName const&, Variant const**, int, Callable::CallError&) (??:0)
[14] Object::callv(StringName const&, Array const&) (??:0)
[15] JSONRPC::process_action(Variant const&, bool) (??:0)
[16] JSONRPC::process_string(String const&) (??:0)
[17] GDScriptLanguageProtocol::process_message(String const&) (??:0)
[18] GDScriptLanguageProtocol::LSPeer::handle_data() (??:0)
[19] GDScriptLanguageProtocol::poll() (??:0)
[20] GDScriptLanguageServer::thread_main(void*) (??:0)
[21] Thread::callback(Thread*, Thread::Settings const&, void (*)(void*), void*) (??:0)
[22] void std::__invoke_impl<void, void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*>(std::__invoke_other, void (*&&)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*&&, Thread::Settings&&, void (*&&)(void*), void*&&) (??:0)
[23] std::__invoke_result<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*>::type std::__invoke<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*>(void (*&&)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*&&, Thread::Settings&&, void (*&&)(void*), void*&&) (??:0)
[24] void std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul>) (??:0)
[25] std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> >::operator()() (??:0)
[26] std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> > >::_M_run() (??:0)
[27] /home/amatrelan/Projects/godot/bin/godot.linuxbsd.tools.64(+0x6a95d34) [0x563aaf5c6d34] (??:0)
[28] /usr/lib/libpthread.so.0(+0x9259) [0x7f853e947259] (??:0)
[29] /usr/lib/libc.so.6(clone+0x43) [0x7f853e7235e3] (??:0)
-- END OF BACKTRACE --
================================================================
Can't get it to break here even with those steps. I just get the expected ERR_PARSE_ERROR: Export type can only be built-in, a resource, or an enum.
messages. =\
Yeah it did same to me too, it crashed again two times and after that it worked OK again.
Sometimes it only prints error message once but sometimes it does seem to do it in loop till crashes. I don't know how it sometimes goes to that loop so need to investigate what causes it. And when it will crash it actually takes sometime till it crashes.
I noticed that in Godot editor it shows those new error message popups and counter rises even when I don't do anything so last time it crashed I left it be, didn't touch anything. After 15 or so seconds later it crashed.
That error message counter Error message something (65)
it got quite high, I would say around 65 and suddenly it crashed.
And actually forgot to mention, I used Emacs and mode for it, My cursor was all the time in that
@export var resource: ResouceTest # At end here kept my cursor.
If that might affect is somehow, it might be that it spams LSP requests for server when keeping in that position.
Might just be that VSCode's internal LSP stuff is more stable and/or that emacs does something strange with the requests that the server can't handle. You could try setting up VSCode with the Godot-tools extension and see if that, too, crashes for you, in which case it might be a linux thing.
Hmm.
Hmm now crashed with VSCode too, there seems to be something really unstable when GDScript
contains "errors". Might be that this is not directly LSP related but GDScript parser/analyzer might be the problematic one. And now backtrace don't contain any directly to LSP but GDScript analyzer things.
Now this time I had originally
var _previous_selected_target = null # This was what I had originally,
I made copy of that line so
var _previous_selected_target = null
var _previous_selected_target = null
Made change to second line to correct
var _previous_selected_target = null
var _previous_selected_action = null
After this I don't know why but decided to hammer that
var _previous_selected_target = null
var _previous_selected_target = null # Made this same as first
After that I made small changes, like changing on second line target
-> targe
and save and back target
and save and so on, about 5 times(?), but when reading log it seems to be over 25 times there
var _previous_selected_target = null
var _previous_selected_action = null
And few seconds later it crashed.
Engine version: Godot Engine v4.0.alpha.custom_build (31b73580e79084adb88c5bfa82e1ebb45c746ac4)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x3cda0) [0x7f9fd324ada0] (??:0)
SCRIPT ERROR: Parse Error: Could not resolve class "CharacterStats", because of a parser error.
at: GDScript::reload (res://src/character/BaseCharacter.gd:13)
ERROR: Method/function failed. Returning: ERR_PARSE_ERROR
at: reload (modules/gdscript/gdscript.cpp:873)
[2] GDScriptParser::DataType::is_set() const (??:0)
[3] GDScriptAnalyzer::resolve_inheritance(GDScriptParser::ClassNode*, bool) (??:0)
[4] GDScriptAnalyzer::resolve_inheritance() (??:0)
[5] GDScriptParserRef::raise_status(GDScriptParserRef::Status) (??:0)
[6] GDScriptAnalyzer::make_global_class_meta_type(StringName const&, GDScriptParser::Node const*) (??:0)
[7] GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode*, bool) (??:0)
[8] GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode*) (??:0)
[9] GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode*, bool) (??:0)
[10] GDScriptAnalyzer::resolve_assert(GDScriptParser::AssertNode*) (??:0)
[11] GDScriptAnalyzer::resolve_node(GDScriptParser::Node*) (??:0)
[12] GDScriptAnalyzer::resolve_suite(GDScriptParser::SuiteNode*) (??:0)
[13] GDScriptAnalyzer::resolve_function_body(GDScriptParser::FunctionNode*) (??:0)
[14] GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode*) (??:0)
[15] GDScriptAnalyzer::resolve_program() (??:0)
[16] GDScriptAnalyzer::analyze() (??:0)
[17] GDScriptLanguage::validate(String const&, String const&, List<String, DefaultAllocator>*, List<ScriptLanguage::ScriptError, DefaultAllocator>*, List<ScriptLanguage::Warning, DefaultAllocator>*, Set<int, Comparator<int>, DefaultAllocator>*) const (??:0)
[18] ScriptTextEditor::get_functions() (??:0)
[19] ScriptEditor::_update_members_overview() (??:0)
[20] ScriptEditor::_update_script_names() (??:0)
[21] ScriptEditor::_filesystem_changed() (??:0)
[22] void call_with_variant_args_helper<ScriptEditor>(ScriptEditor*, void (ScriptEditor::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (??:0)
[23] void call_with_variant_args<ScriptEditor>(ScriptEditor*, void (ScriptEditor::*)(), Variant const**, int, Callable::CallError&) (??:0)
[24] CallableCustomMethodPointer<ScriptEditor>::call(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
SCRIPT ERROR: Parse Error: Could not resolve class "CharacterStats", because of a parser error.
at: GDScript::reload (res://src/character/BaseCharacter.gd:13)
SCRIPT ERROR: Parse Error: Identifier "previou" not declared in the current scope.
at: GDScript::reload (res://src/character/BaseCharacter.gd:65)
ERROR: Method/function failed. Returning: ERR_PARSE_ERROR
at: reload (modules/gdscript/gdscript.cpp:873)
[25] Callable::call(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[26] Object::emit_signal(StringName const&, Variant const**, int) (??:0)
[27] Object::_emit_signal(Variant const**, int, Callable::CallError&) (??:0)
[28] MethodBindVarArg<Object>::call(Object*, Variant const**, int, Callable::CallError&) (??:0)
[29] Object::call(StringName const&, Variant const**, int, Callable::CallError&) (??:0)
[30] Callable::call(Variant const**, int, Variant&, Callable::CallError&) const (??:0)
[31] MessageQueue::_call_function(Callable const&, Variant const*, int, bool) (??:0)
[32] MessageQueue::flush() (??:0)
[33] SceneTree::physics_process(double) (??:0)
[34] Main::iteration() (??:0)
[35] OS_LinuxBSD::run() (??:0)
[36] /home/amatrelan/Projects/godot/bin/godot.linuxbsd.tools.64(main+0x174) [0x55d545c7cfed] (??:0)
[37] /usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7f9fd3235b25] (??:0)
[38] /home/amatrelan/Projects/godot/bin/godot.linuxbsd.tools.64(_start+0x2e) [0x55d545c7cdae] (??:0)
-- END OF BACKTRACE --
I'm still unable to recreate this on this end. At least on windows it never crashes no matter how often I switch between _target and _action. Maybe some GCC vs Microsoft build C++ thing.
Hmm decided to run with valgrind with full memory check valgrind --leak-check=full --show-leak-kinds=all --trace-children=yes --track-origins=yes ./bin/godot.linuxbsd.tools.64 -e --path <project-name> 2>&1 | tee valgrid.log
but it seems to crash even before editor is fully loaded.
ERROR: Method argument to Callable constructor must be a non-empty string
at: Callable (core/variant/callable.cpp:274)
Comes 6536 times and after that comes stack overflow error in valgrind
==16644== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==16644== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==16644== Can't extend stack to 0x1ffe801028 during signal delivery for thread 1:
==16644== no stack segment
==16644==
==16644== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==16644== Access not within mapped region at address 0x1FFE801028
==16644== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==16644== at 0xB3AC13B: __vfprintf_internal (in /usr/lib/libc-2.33.so)
==16644== If you believe this happened as a result of a stack
==16644== overflow in your program's main thread (unlikely but
==16644== possible), you can try to increase the size of the
==16644== main thread stack using the --main-stacksize= flag.
==16644== The main thread stack size used in this run was 8388608.
==16644==
==16644== HEAP SUMMARY:
==16644== in use at exit: 294,618,275 bytes in 1,063,356 blocks
==16644== total heap usage: 6,406,663 allocs, 5,343,307 frees, 1,527,863,008 bytes allocated
So cannot do full memory checks for this, I will try some other way to check memory usage. Might be that valgrind with full memory check is interfering with system too much and causes problems.
This might be related to this, is those "toast" notifications stored somewhere in memory? Could it be that there is memory handling error and it overflows?
Started to thinking that all crashes seems to be related to that I make some error and that error notification comes up. At least I don't think this is anymore related to directly to LSP.
The workspace stores the current script, parse results, data about native members.
The GDScript parser is extended to hold diagnostics and documentation links, but those are generated as new objects on the fly and are not persistent.
@Razoric480 I meant that toast icon notification, bell icon. It don't seem to clear errors, if I press it again it shows them again even after some time, even if I have disabled in settings, Settings -> Interface -> Editor -> Show Internal Errors In Toast Notifications. It seems to store them into somewhere in memory.
Edit: Seems to be that it don't store if it's disabled, but if it's disabled after some errors has come it keeps them in memory. I will disable this toast notifications and check out if it still continues to crash.
Oh, I see. I'm not aware of how it works, unfortunately.
Yeah, I will look into this if it don't crash anymore that I have disabled that, then it's certain that this don't have anything to do LSP, I don't actually believe this has anything to do with LSP anymore.
ERROR: Method argument to Callable constructor must be a non-empty string at: Callable (core/variant/callable.cpp:274)
IIRC @groud noticed something similar, also related to the toaster.
And no, still crashing...
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.alpha.custom_build (b5c0184795363aa27c3df5bfa2a87fef35705e4d)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x3cda0) [0x7f71a8d8eda0] (??:0)
[2] StringName::operator String() const (??:0)
[3] GDScriptParser::DataType::to_string() const (??:0)
[4] ExtendGDScriptParser::parse_class_symbol(GDScriptParser::ClassNode const*, lsp::DocumentSymbol&) (??:0)
[5] ExtendGDScriptParser::update_symbols() (??:0)
[6] ExtendGDScriptParser::parse(String const&, String const&) (??:0)
[7] GDScriptWorkspace::parse_script(String const&, String const&) (??:0)
[8] GDScriptTextDocument::sync_script_content(String const&, String const&) (??:0)
[9] GDScriptTextDocument::didSave(Variant const&) (??:0)
[10] void call_with_variant_args_helper<__UnexistingClass, Variant const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (??:0)
[11] void call_with_variant_args_dv<__UnexistingClass, Variant const&>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (??:0)
[12] MethodBindT<Variant const&>::call(Object*, Variant const**, int, Callable::CallError&) (??:0)
[13] Object::call(StringName const&, Variant const**, int, Callable::CallError&) (??:0)
[14] Object::callv(StringName const&, Array const&) (??:0)
[15] JSONRPC::process_action(Variant const&, bool) (??:0)
[16] JSONRPC::process_string(String const&) (??:0)
[17] GDScriptLanguageProtocol::process_message(String const&) (??:0)
[18] GDScriptLanguageProtocol::LSPeer::handle_data() (??:0)
[19] GDScriptLanguageProtocol::poll() (??:0)
[20] GDScriptLanguageServer::thread_main(void*) (??:0)
[21] Thread::callback(Thread*, Thread::Settings const&, void (*)(void*), void*) (??:0)
[22] void std::__invoke_impl<void, void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*>(std::__invoke_other, void (*&&)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*&&, Thread::Settings&&, void (*&&)(void*), void*&&) (??:0)
[23] std::__invoke_result<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*>::type std::__invoke<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*>(void (*&&)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*&&, Thread::Settings&&, void (*&&)(void*), void*&&) (??:0)
[24] void std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul>) (??:0)
[25] std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> >::operator()() (??:0)
[26] std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> > >::_M_run() (??:0)
[27] /home/amatrelan/Projects/godot/bin/godot.linuxbsd.tools.64(+0x6b43d14) [0x55a6d615dd14] (??:0)
[28] /usr/lib/libpthread.so.0(+0x9259) [0x7f71a9074259] (??:0)
[29] /usr/lib/libc.so.6(clone+0x43) [0x7f71a8e505e3] (??:0)
-- END OF BACKTRACE --
================================================================
And now I get it to crash consistently. But the change I do in GDScript is minimal when I get this to crash.
func _init(data, actor, targets:): # I save as this or with as `targets: ): it crashes.
pass
Now it don't even manage put toast notification / print error to terminal before it crashes like this.
I don't know yet if this exact line causes crash, or just part of some more. I try to create minimal reproduction project from this tomorrow after work.
But now it crashes every time I save that file with LSP connected to external editor (VSCode). If VSCode is not connected to LSP it wont trigger the crash, so there isn't any file watcher what triggers this problem. LSP by himself is calling something that causes problems.
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.alpha.custom_build (b5c0184795363aa27c3df5bfa2a87fef35705e4d)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x3cda0) [0x7fcaee61eda0] (??:0)
[2] StringName::operator String() const (??:0)
[3] GDScriptParser::DataType::to_string() const (??:0)
[4] ExtendGDScriptParser::parse_class_symbol(GDScriptParser::ClassNode const*, lsp::DocumentSymbol&) (??:0)
[5] ExtendGDScriptParser::update_symbols() (??:0)
[6] ExtendGDScriptParser::parse(String const&, String const&) (??:0)
[7] GDScriptWorkspace::parse_script(String const&, String const&) (??:0)
[8] GDScriptTextDocument::sync_script_content(String const&, String const&) (??:0)
[9] GDScriptTextDocument::didSave(Variant const&) (??:0)
[10] void call_with_variant_args_helper<__UnexistingClass, Variant const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (??:0)
[11] void call_with_variant_args_dv<__UnexistingClass, Variant const&>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (??:0)
[12] MethodBindT<Variant const&>::call(Object*, Variant const**, int, Callable::CallError&) (??:0)
[13] Object::call(StringName const&, Variant const**, int, Callable::CallError&) (??:0)
[14] Object::callv(StringName const&, Array const&) (??:0)
[15] JSONRPC::process_action(Variant const&, bool) (??:0)
[16] JSONRPC::process_string(String const&) (??:0)
[17] GDScriptLanguageProtocol::process_message(String const&) (??:0)
[18] GDScriptLanguageProtocol::LSPeer::handle_data() (??:0)
[19] GDScriptLanguageProtocol::poll() (??:0)
[20] GDScriptLanguageServer::_notification(int) (??:0)
[21] GDScriptLanguageServer::_notificationv(int, bool) (??:0)
[22] Object::notification(int, bool) (??:0)
[23] SceneTree::_notify_group_pause(StringName const&, int) (??:0)
[24] SceneTree::process(double) (??:0)
[25] Main::iteration() (??:0)
[26] OS_LinuxBSD::run() (??:0)
[27] /home/amatrelan/Projects/godot/bin/godot.linuxbsd.tools.64(main+0x174) [0x55c62ac03fed] (??:0)
[28] /usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7fcaee609b25] (??:0)
[29] /home/amatrelan/Projects/godot/bin/godot.linuxbsd.tools.64(_start+0x2e) [0x55c62ac03dae] (??:0)
-- END OF BACKTRACE --
================================================================
Here is another one, and disabled threading from LSP.
Still nothing on this end just with the script, with or without errors. Maybe it's something with the project contents, so I'll have to check a minimum project.
Though I do notice that threading being on or off does seem to make a difference in how errors are reported (though even with it off it doesn't crash for me)
Hmm while writing minimal project, it crashed while writing it, I just created first ActionData.gd
and after that I started writing Action.gd
ActionData.gd
Action.gd
One behavioural thing I do, I don't fix errors in code right away, I write usually till I'm finished that "section" and after that I fix errors (typos and other things).
ps. I continue tomorrow this after work.
# ActionData.gd
class_name ActionData
extends Resource
enum ExampleEnum {
NONE,
ONE,
TWO,
TREE,
FOUR
}
@export var icon: Texture
@export var display_name := "Default Display Name"
@export var base_mana_cost := 0
@export var enumvar: ExampleEnum = ExampleEnum.NONE
@export var is_only_self := false
@export var is_only_all := false
# Action.gd
class_name Action
extends RefCounted
var _data: ActionData
var _ac # This was where it crashed, this was supposed to be `_actor`
#############################################
# I didn't manage write this yet completely but here is rest
var _actor
var _targets := []
func _init(data, actor, targets: ):
pass
I started continuing with my minimal project, and yet didn't found a way to crash it. But when I toggle that toast notification settings, it clearly goes really unstable at that point.
If I have disabled toast messages it crashes. But as I started today with toasts on it didn't crash (at least right away).
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.alpha.custom_build (b5c0184795363aa27c3df5bfa2a87fef35705e4d)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x3cda0) [0x7ff647aeada0] (??:0)
[2] StringName::operator String() const (??:0)
[3] GDScriptParser::DataType::to_string() const (??:0)
[4] ExtendGDScriptParser::parse_class_symbol(GDScriptParser::ClassNode const*, lsp::DocumentSymbol&) (??:0)
[5] ExtendGDScriptParser::update_symbols() (??:0)
[6] ExtendGDScriptParser::parse(String const&, String const&) (??:0)
[7] GDScriptWorkspace::parse_script(String const&, String const&) (??:0)
[8] GDScriptTextDocument::sync_script_content(String const&, String const&) (??:0)
[9] GDScriptTextDocument::didSave(Variant const&) (??:0)
[10] void call_with_variant_args_helper<__UnexistingClass, Variant const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (??:0)
[11] void call_with_variant_args_dv<__UnexistingClass, Variant const&>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (??:0)
[12] MethodBindT<Variant const&>::call(Object*, Variant const**, int, Callable::CallError&) (??:0)
[13] Object::call(StringName const&, Variant const**, int, Callable::CallError&) (??:0)
[14] Object::callv(StringName const&, Array const&) (??:0)
[15] JSONRPC::process_action(Variant const&, bool) (??:0)
[16] JSONRPC::process_string(String const&) (??:0)
[17] GDScriptLanguageProtocol::process_message(String const&) (??:0)
[18] GDScriptLanguageProtocol::LSPeer::handle_data() (??:0)
[19] GDScriptLanguageProtocol::poll() (??:0)
[20] GDScriptLanguageServer::_notification(int) (??:0)
[21] GDScriptLanguageServer::_notificationv(int, bool) (??:0)
[22] Object::notification(int, bool) (??:0)
[23] SceneTree::_notify_group_pause(StringName const&, int) (??:0)
[24] SceneTree::process(double) (??:0)
[25] Main::iteration() (??:0)
[26] OS_LinuxBSD::run() (??:0)
[27] /home/amatrelan/Projects/godot/bin/godot.linuxbsd.tools.64(main+0x174) [0x557c6fe92fed] (??:0)
[28] /usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7ff647ad5b25] (??:0)
[29] /home/amatrelan/Projects/godot/bin/godot.linuxbsd.tools.64(_start+0x2e) [0x557c6fe92dae] (??:0)
-- END OF BACKTRACE --
================================================================
crash4.0.zip With this it crashes consistently for me. Edit: This is not exactly minimal project, but I stripped away all what is not directly affecting these lines of code, and still crashing.
Steps:
src/combat/Actions/Action.gd
file
func _init(data, actor, targets: ): # <- Here at end, put space for example
pass
At least for me it's crashes all the time with this.
No crash, not even an error. I'll have to take out linux and try there.
Before I even do anything it returns this
~/Projects ∙ ./godot/bin/godot.linuxbsd.tools.64
Godot Engine v4.0.alpha.custom_build.53297b46f - https://godotengine.org
WARNING: Error setting locale modifiers
at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:4304)
Vulkan API 1.2.203 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 2070 SUPER
Editing project: /home/amatrelan/Projects/crash4.0 (::home::amatrelan::Projects::crash4.0)
Godot Engine v4.0.alpha.custom_build.53297b46f - https://godotengine.org
WARNING: Error setting locale modifiers
at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:4304)
Vulkan API 1.2.203 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 2070 SUPER
~/Projects ∙
~/Projects ∙ ERROR: Condition "err" is true. Returning: err
at: load_source_code (modules/gdscript/gdscript.cpp:1023)
ERROR: Condition "err" is true. Returning: err
at: load_source_code (modules/gdscript/gdscript.cpp:1023)
ERROR: Condition "err" is true. Returning: err
at: load_source_code (modules/gdscript/gdscript.cpp:1023)
Ah these errors comes from neovim plugin when using with vscode, it creates some temp files in project root.
Little more information, it seems that LSP requests can overwhelm server / Godot. As you can see first:
In right side of emacs there is all LSP requests and answers what LSP-mode got. It's a ton.
On second startup
One new thing, type defining in parameters isn't required for it to crash.
func _init(data, actor, targets):
pass
Also causes it to crash.
But if I change the line to
func _init(_dataa, _actora, _targetsa): # So that there isn't any errors.
pass
Only adding underscores to parameters causes them to shadow values which also crashes editor.
Clean Linux install and still crashes on emacs, but VSCode works for a while but after while it crashes as previously.
VSCode seems to go slow in LSP functionality before it crashes. It seems to be that more errors comes it goes to slower. But it also is quite random what I have done before it crashes.
Here is some more info about system if these help.
gcc --version
gcc (GCC) 11.1.0
ld --version
GNU ld (GNU Binutils) 2.36.1
Not sure if I should create a new issue, but the language server is also causing a crash whenever I edit a .gdshader (in vscode) if the language server is connected to vscode.
Similar occurance. Using neovim external editor
I get a very similar crash to jivvy there for my project in Linux after updating it to the 4.0 beta running on Ubuntu 20.04 in both the downloaded version and one I built myself, doesn't seem to happen for the same project in Windows.
Interestingly this doesn't happen on another almost identical Ubuntu 20.04 install of mine on the same project... I wonder if it's some strange driver interaction? The one it does happen on is a laptop while the one that doesn't crash is a desktop. The crash still happens if I run the editor headless though so I doubt it's a GPU thing... I'm using an up-to-date version of VS Code as the external editor on both.
Okay I've got this down to a minimal example although the more I simplify it the less frequent the crash gets. It might be possible to remove some further lines from these but I haven't managed to get it to crash if I do yet, I'm fairly sure the enum is required.
I've got two script files:
Thing.gd:
class_name Thing
enum E {A, B}
func _init(_a, _b, _c):
pass
and ThingGroup.gd:
class_name ThingGroup
func func1(_a: float, _b: float, _c := 1) -> Thing:
return null
func func2(a, c := 1) -> Thing:
var thing := func1(a.x, a.y, c)
return thing
I can currently reproduce this by running godot headless with: godot --headless minimal_lang_server_crash/project.godot
, opening ThingGroup.gd in VSCode (with godot-tools) and saving it repeatedly (hitting ctrl-S anywhere between 10 and 50 times, sometimes more). It was more frequent before reducing it down.
Full minimal project here: minimal_lang_server_crash.zip
I couldn't get it to do it in editor, but I could get it to hit in headless. Looks like it's possible for the function's return datatype's script type to be null in the GDScriptParser, which is why the stack trace notes that datatype::to_string fails.
Adding in a quick nullptr check and returning an empty string instead seems to fix it.
@Norgg If you can give #66306 a shot and see if that fixes your issue.
Still getting a crash unfortunately, although in a different place I think, this is from gdb after putting an abort() statement into the crash handler because for some reason it wasn't giving line numbers in that.
#0 StringName::operator String (this=0x55557733d3b8) at ./core/string/string_name.h:138
#1 0x00005555580d4354 in GDScriptParser::DataType::to_string (this=0x7fffffffc930) at modules/gdscript/gdscript_parser.cpp:3997
#2 0x0000555558154903 in ExtendGDScriptParser::parse_function_symbol (this=0x555574fc7690, p_func=0x555573154920, r_symbol=...)
at modules/gdscript/language_server/gdscript_extend_parser.cpp:425
#3 0x0000555558153462 in ExtendGDScriptParser::parse_class_symbol (this=0x555574fc7690, p_class=0x55557246e1a0, r_symbol=...)
at modules/gdscript/language_server/gdscript_extend_parser.cpp:302
#4 0x0000555558151550 in ExtendGDScriptParser::update_symbols (this=0x555574fc7690) at modules/gdscript/language_server/gdscript_extend_parser.cpp:88
#5 0x0000555558159e44 in ExtendGDScriptParser::parse (this=0x555574fc7690, p_code=..., p_path=...) at modules/gdscript/language_server/gdscript_extend_parser.cpp:854
#6 0x0000555557fef62a in GDScriptWorkspace::parse_script (this=0x5555705187a0, p_path=..., p_content=...) at modules/gdscript/language_server/gdscript_workspace.cpp:427
#7 0x0000555557fdf43c in GDScriptTextDocument::sync_script_content (this=0x555570518a50, p_path=..., p_content=...) at modules/gdscript/language_server/gdscript_text_document.cpp:417
#8 0x0000555557fdc047 in GDScriptTextDocument::didSave (this=0x555570518a50, p_param=...) at modules/gdscript/language_server/gdscript_text_document.cpp:89
#9 0x0000555557fd7385 in call_with_variant_args_helper<__UnexistingClass, Variant const&, 0ul> (p_instance=0x555570518a50, p_method=
(void (__UnexistingClass::*)(__UnexistingClass * const, const Variant &)) 0x555557fdbf9e <GDScriptTextDocument::didSave(Variant const&)>, p_args=0x7fffffffd070, r_error=...)
at ./core/variant/binder_common.h:262
#10 0x0000555557fd63ad in call_with_variant_args_dv<__UnexistingClass, Variant const&> (p_instance=0x555570518a50, p_method=
(void (__UnexistingClass::*)(__UnexistingClass * const, const Variant &)) 0x555557fdbf9e <GDScriptTextDocument::didSave(Variant const&)>, p_args=0x7fffffffd1a0, p_argcount=1,
r_error=..., default_values=...) at ./core/variant/binder_common.h:409
#11 0x0000555557fd5156 in MethodBindT<Variant const&>::call (this=0x555570515650, p_object=0x555570518a50, p_args=0x7fffffffd1a0, p_arg_count=1, r_error=...)
at ./core/object/method_bind.h:320
#12 0x000055555c297a8b in Object::callp (this=0x555570518a50, p_method=..., p_args=0x7fffffffd1a0, p_argcount=1, r_error=...) at core/object/object.cpp:733
#13 0x000055555c297564 in Object::callv (this=0x555570518a50, p_method=..., p_args=...) at core/object/object.cpp:670
#14 0x00005555584c22b1 in JSONRPC::process_action (this=0x555570518170, p_action=..., p_process_arr_elements=true) at modules/jsonrpc/jsonrpc.cpp:130
#15 0x00005555584c2adc in JSONRPC::process_string (this=0x555570518170, p_input=...) at modules/jsonrpc/jsonrpc.cpp:162
#16 0x0000555557fc778d in GDScriptLanguageProtocol::process_message (this=0x555570518170, p_text=...) at modules/gdscript/language_server/gdscript_language_protocol.cpp:142
#17 0x0000555557fc71ae in GDScriptLanguageProtocol::LSPeer::handle_data (this=0x555574bc2530) at modules/gdscript/language_server/gdscript_language_protocol.cpp:97
#18 0x0000555557fc8ba7 in GDScriptLanguageProtocol::poll (this=0x555570518170) at modules/gdscript/language_server/gdscript_language_protocol.cpp:247
#19 0x0000555557fd8c5b in GDScriptLanguageServer::_notification (this=0x555570517b50, p_what=25) at modules/gdscript/language_server/gdscript_language_server.cpp:59
#20 0x0000555557fda15c in GDScriptLanguageServer::_notificationv (this=0x555570517b50, p_notification=25, p_reversed=false) at modules/gdscript/language_server/gdscript_language_server.h:39
#21 0x000055555c297e73 in Object::notification (this=0x555570517b50, p_notification=25, p_reversed=false) at core/object/object.cpp:790
#22 0x000055555a0fd89f in SceneTree::_notify_group_pause (this=0x5555615a2a90, p_group=..., p_notification=25) at scene/main/scene_tree.cpp:867
#23 0x000055555a0fbbbf in SceneTree::process (this=0x5555615a2a90, p_time=0.0055555555555555549) at scene/main/scene_tree.cpp:464
#24 0x0000555557b74987 in Main::iteration () at main/main.cpp:3138
#25 0x0000555557b1cc36 in OS_LinuxBSD::run (this=0x7fffffffda30) at platform/linuxbsd/os_linuxbsd.cpp:575
#26 0x0000555557b17cc8 in main (argc=3, argv=0x7fffffffdf48) at platform/linuxbsd/godot_linuxbsd.cpp:72
With full frame arguments for the first few:
#0 StringName::operator String (this=0x55557733d3b8) at ./core/string/string_name.h:138
#1 0x00005555580d4354 in GDScriptParser::DataType::to_string (this=0x7fffffffc930) at modules/gdscript/gdscript_parser.cpp:3997
#2 0x0000555558154903 in ExtendGDScriptParser::parse_function_symbol (this=0x555574fc7690, p_func=0x555573154920, r_symbol=
@0x7fffffffcb10: {name = {_cowdata = {_ptr = 0x555575904050 U"func2"}, static _null = 0 U'\000', static invalid_node_name_characters = {_cowdata = {_ptr = 0x555560579450 U". : @ / \" %"}, static _null = 0 U'\000', static invalid_node_name_characters = <same as static member of an already seen type>}}, detail = {_cowdata = {_ptr = 0x55557733d3a0 U"func func2(a, c: int = 1) -> GDScript"}, static _null = 0 U'\000', static invalid_node_name_characters = {_cowdata = {_ptr = 0x555560579450 U". : @ / \" %"}, static _null = 0 U'\000', static invalid_node_name_characters = <same as static member of an already seen type>}}, documentation = {_cowdata = {_ptr = 0x0}, static _null = 0 U'\000', static invalid_node_name_characters = {_cowdata = {_ptr = 0x555560579450 U". : @ / \" %"}, static _null = 0 U'\000', static invalid_node_name_characters = <same as static member of an already seen type>}}, native_class = {_cowdata = {_ptr = 0x0}, static _null = 0 U'\000', static invalid_node_name_characters = {_cowdata = {_ptr = 0x555560579450 U". : @ / \" %"}, static _null = 0 U'\000', static invalid_node_name_characters = <same as static member of an already seen type>}}, kind = 6, deprecated = false, range = {start = {line = 5, character = 0}, end = {line = 5, character = 1}}, selectionRange = {start = {line = 5, character = 0}, end = {line = 0, character = 0}}, uri = {_cowdata = {_ptr = 0x555575bd0b90 U"file:///home/norgg/gamedev/gd-crash-repro/ThingGroup.gd"}, static _null = 0 U'\000', static invalid_node_name_characters = {_cowdata = {_ptr = 0x555560579450 U". : @ / \" %"}, static _null = 0 U'\000', static invalid_node_name_characters = <same as static member of an already seen type>}}, script_path = {_cowdata = {_ptr = 0x555575ba9f70 U"res://ThingGroup.gd"}, static _null = 0 U'\000', static invalid_node_name_characters = {_cowdata = {_ptr = 0x555560579450 U". : @ / \" %"}, static _null = 0 U'\000', static invalid_node_name_characters = <same as static member of an already seen type>}}, children = {write = {<No data fields>}, _cowdata = {_ptr = 0x55557512eb60}}})
And here's some valgrind output:
==424674== Invalid read of size 8
==424674== at 0x2C88323: GDScriptParser::DataType::to_string() const (gdscript_parser.cpp:3996)
==424674== by 0x2D08902: ExtendGDScriptParser::parse_function_symbol(GDScriptParser::FunctionNode const*, lsp::DocumentSymbol&) (gdscript_extend_parser.cpp:425)
==424674== by 0x2D07461: ExtendGDScriptParser::parse_class_symbol(GDScriptParser::ClassNode const*, lsp::DocumentSymbol&) (gdscript_extend_parser.cpp:302)
==424674== by 0x2D0554F: ExtendGDScriptParser::update_symbols() (gdscript_extend_parser.cpp:88)
==424674== by 0x2D0DE43: ExtendGDScriptParser::parse(String const&, String const&) (gdscript_extend_parser.cpp:854)
==424674== by 0x2BA3629: GDScriptWorkspace::parse_script(String const&, String const&) (gdscript_workspace.cpp:427)
==424674== by 0x2BA0F7F: GDScriptWorkspace::reload_all_workspace_scripts() (gdscript_workspace.cpp:210)
==424674== by 0x2BA2C9E: GDScriptWorkspace::initialize() (gdscript_workspace.cpp:400)
==424674== by 0x2B7C480: GDScriptLanguageProtocol::initialize(Dictionary const&) (gdscript_language_protocol.cpp:206)
==424674== by 0x2B8B682: void call_with_variant_args_ret_helper<__UnexistingClass, Dictionary, Dictionary const&, 0ul>(__UnexistingClass*, Dictionary (__UnexistingClass::*)(Dictionary const&), Variant const**, Variant&, Callable::CallError&, IndexSequence<0ul>) (binder_common.h:680)
==424674== by 0x2B8A695: void call_with_variant_args_ret_dv<__UnexistingClass, Dictionary, Dictionary const&>(__UnexistingClass*, Dictionary (__UnexistingClass::*)(Dictionary const&), Variant const**, int, Variant&, Callable::CallError&, Vector<Variant> const&) (binder_common.h:493)
==424674== by 0x2B8933A: MethodBindTR<Dictionary, Dictionary const&>::call(Object*, Variant const**, int, Callable::CallError&) (method_bind.h:481)
==424674== Address 0x30e782a8 is 296 bytes inside a block of size 680 free'd
==424674== at 0xB94FA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==424674== by 0x68782EC: Memory::free_static(void*, bool) (memory.cpp:168)
==424674== by 0x2CB35BC: void memdelete<GDScriptParser::Node>(GDScriptParser::Node*) (memory.h:112)
==424674== by 0x2C73EC8: GDScriptParser::clear() (gdscript_parser.cpp:160)
==424674== by 0x2C73D79: GDScriptParser::~GDScriptParser() (gdscript_parser.cpp:153)
==424674== by 0x2C21FDE: void memdelete<GDScriptParser>(GDScriptParser*) (memory.h:109)
==424674== by 0x2C20E33: GDScriptParserRef::~GDScriptParserRef() (gdscript_cache.cpp:100)
==424674== by 0x2BEFAB8: void memdelete<GDScriptParserRef>(GDScriptParserRef*) (memory.h:109)
==424674== by 0x2BEF013: Ref<GDScriptParserRef>::unref() (ref_counted.h:221)
==424674== by 0x2BEC24D: Ref<GDScriptParserRef>::~Ref() (ref_counted.h:233)
==424674== by 0x2BED82F: KeyValue<String, Ref<GDScriptParserRef> >::~KeyValue() (pair.h:82)
==424674== by 0x2BED85F: HashMapElement<String, Ref<GDScriptParserRef> >::~HashMapElement() (hash_map.h:55)
==424674== Block was alloc'd at
==424674== at 0xB94E7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==424674== by 0x6877C32: Memory::alloc_static(unsigned long, bool) (memory.cpp:75)
==424674== by 0x6877BB2: operator new(unsigned long, char const*) (memory.cpp:40)
==424674== by 0x2CB4604: GDScriptParser::ClassNode* GDScriptParser::alloc_node<GDScriptParser::ClassNode>() (gdscript_parser.h:1311)
==424674== by 0x2C75F7E: GDScriptParser::parse_program() (gdscript_parser.cpp:536)
==424674== by 0x2C7520C: GDScriptParser::parse(String const&, String const&, bool) (gdscript_parser.cpp:387)
==424674== by 0x2C20C3F: GDScriptParserRef::raise_status(GDScriptParserRef::Status) (gdscript_cache.cpp:62)
==424674== by 0x2BF59DE: GDScriptAnalyzer::resolve_datatype(GDScriptParser::TypeNode*) (gdscript_analyzer.cpp:491)
==424674== by 0x2BFBCA6: GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode*) (gdscript_analyzer.cpp:1179)
==424674== by 0x2BF92EA: GDScriptAnalyzer::resolve_class_interface(GDScriptParser::ClassNode*) (gdscript_analyzer.cpp:840)
==424674== by 0x2C14696: GDScriptAnalyzer::resolve_program() (gdscript_analyzer.cpp:4276)
==424674== by 0x2C147E5: GDScriptAnalyzer::analyze() (gdscript_analyzer.cpp:4294)
==424674==
==424674== Invalid read of size 8
==424674== at 0x2C88337: GDScriptParser::DataType::to_string() const (gdscript_parser.cpp:3997)
==424674== by 0x2D08902: ExtendGDScriptParser::parse_function_symbol(GDScriptParser::FunctionNode const*, lsp::DocumentSymbol&) (gdscript_extend_parser.cpp:425)
==424674== by 0x2D07461: ExtendGDScriptParser::parse_class_symbol(GDScriptParser::ClassNode const*, lsp::DocumentSymbol&) (gdscript_extend_parser.cpp:302)
==424674== by 0x2D0554F: ExtendGDScriptParser::update_symbols() (gdscript_extend_parser.cpp:88)
==424674== by 0x2D0DE43: ExtendGDScriptParser::parse(String const&, String const&) (gdscript_extend_parser.cpp:854)
==424674== by 0x2BA3629: GDScriptWorkspace::parse_script(String const&, String const&) (gdscript_workspace.cpp:427)
==424674== by 0x2BA0F7F: GDScriptWorkspace::reload_all_workspace_scripts() (gdscript_workspace.cpp:210)
==424674== by 0x2BA2C9E: GDScriptWorkspace::initialize() (gdscript_workspace.cpp:400)
==424674== by 0x2B7C480: GDScriptLanguageProtocol::initialize(Dictionary const&) (gdscript_language_protocol.cpp:206)
==424674== by 0x2B8B682: void call_with_variant_args_ret_helper<__UnexistingClass, Dictionary, Dictionary const&, 0ul>(__UnexistingClass*, Dictionary (__UnexistingClass::*)(Dictionary const&), Variant const**, Variant&, Callable::CallError&, IndexSequence<0ul>) (binder_common.h:680)
==424674== by 0x2B8A695: void call_with_variant_args_ret_dv<__UnexistingClass, Dictionary, Dictionary const&>(__UnexistingClass*, Dictionary (__UnexistingClass::*)(Dictionary const&), Variant const**, int, Variant&, Callable::CallError&, Vector<Variant> const&) (binder_common.h:493)
==424674== by 0x2B8933A: MethodBindTR<Dictionary, Dictionary const&>::call(Object*, Variant const**, int, Callable::CallError&) (method_bind.h:481)
==424674== Address 0x30e782a8 is 296 bytes inside a block of size 680 free'd
==424674== at 0xB94FA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==424674== by 0x68782EC: Memory::free_static(void*, bool) (memory.cpp:168)
==424674== by 0x2CB35BC: void memdelete<GDScriptParser::Node>(GDScriptParser::Node*) (memory.h:112)
==424674== by 0x2C73EC8: GDScriptParser::clear() (gdscript_parser.cpp:160)
==424674== by 0x2C73D79: GDScriptParser::~GDScriptParser() (gdscript_parser.cpp:153)
==424674== by 0x2C21FDE: void memdelete<GDScriptParser>(GDScriptParser*) (memory.h:109)
==424674== by 0x2C20E33: GDScriptParserRef::~GDScriptParserRef() (gdscript_cache.cpp:100)
==424674== by 0x2BEFAB8: void memdelete<GDScriptParserRef>(GDScriptParserRef*) (memory.h:109)
==424674== by 0x2BEF013: Ref<GDScriptParserRef>::unref() (ref_counted.h:221)
==424674== by 0x2BEC24D: Ref<GDScriptParserRef>::~Ref() (ref_counted.h:233)
==424674== by 0x2BED82F: KeyValue<String, Ref<GDScriptParserRef> >::~KeyValue() (pair.h:82)
==424674== by 0x2BED85F: HashMapElement<String, Ref<GDScriptParserRef> >::~HashMapElement() (hash_map.h:55)
==424674== Block was alloc'd at
==424674== at 0xB94E7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==424674== by 0x6877C32: Memory::alloc_static(unsigned long, bool) (memory.cpp:75)
==424674== by 0x6877BB2: operator new(unsigned long, char const*) (memory.cpp:40)
==424674== by 0x2CB4604: GDScriptParser::ClassNode* GDScriptParser::alloc_node<GDScriptParser::ClassNode>() (gdscript_parser.h:1311)
==424674== by 0x2C75F7E: GDScriptParser::parse_program() (gdscript_parser.cpp:536)
==424674== by 0x2C7520C: GDScriptParser::parse(String const&, String const&, bool) (gdscript_parser.cpp:387)
==424674== by 0x2C20C3F: GDScriptParserRef::raise_status(GDScriptParserRef::Status) (gdscript_cache.cpp:62)
==424674== by 0x2BF59DE: GDScriptAnalyzer::resolve_datatype(GDScriptParser::TypeNode*) (gdscript_analyzer.cpp:491)
==424674== by 0x2BFBCA6: GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode*) (gdscript_analyzer.cpp:1179)
==424674== by 0x2BF92EA: GDScriptAnalyzer::resolve_class_interface(GDScriptParser::ClassNode*) (gdscript_analyzer.cpp:840)
==424674== by 0x2C14696: GDScriptAnalyzer::resolve_program() (gdscript_analyzer.cpp:4276)
==424674== by 0x2C147E5: GDScriptAnalyzer::analyze() (gdscript_analyzer.cpp:4294)
Strange... will have to poke at it some more.
Based on #66306 changeset I think this is also needed if script_type
can be null.
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index b5cb5a4680..b29774a408 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -4104,7 +4104,7 @@ String GDScriptParser::DataType::to_string() const {
return class_type->fqcn;
case SCRIPT: {
if (is_meta_type) {
- return script_type->get_class_name().operator String();
+ return script_type != nullptr : script_type->get_class_name().operator String() : "";
}
String name = script_type != nullptr ? script_type->get_name() : "";
if (!name.is_empty()) {
cc @Razoric480
Assuming fixed by #75943. Please let us know if this is still reproducible in 4.1 beta 3 or later.
Yeah, something fixed this for me around about 4.0 release, not seen any crashes for a while, thanks!
Godot version
v4.0.dev.custom_build [f1b63dce7]
System information
Linux, x11, nvidia
Issue description
Language server seems to crash sometimes randomly, don't have found clear reason why this happens. I crashes during code editing (I'm using Emacs with gdscript mode and lsp).
Latest commit from master is 092a2861277e7df87aec10516d713d0bf4adba79
Steps to reproduce
Don't have clear reproduce yet, restarting engine and it continues to work and then again after some time crashes.
Minimal reproduction project
No response