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

Crash while editing GDScript in VS Code via LSP #71016

Closed
git2013vb opened this issue Jan 7, 2023 · 8 comments · Fixed by #82956
Closed

Crash while editing GDScript in VS Code via LSP #71016

git2013vb opened this issue Jan 7, 2023 · 8 comments · Fixed by #82956

Comments

@git2013vb
Copy link

git2013vb commented Jan 7, 2023

Godot version

Engine version: Godot Engine v4.0.beta.custom_build (5726770)

System information

Debian 11

Issue description

(252853) 23526 I: res://auto_load/setup.gd (39) [disconnect_signals] 
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/templates/self_list.h:106)
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object/object.cpp:1999)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta.custom_build (57267709e665f1683e79bd5d3432be2be5db6c1d)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x38d60) [0x7f2c13e4fd60] (??:0)
[2] CowData<char32_t>::_get_size() const (??:0)
[3] CowData<char32_t>::size() const (??:0)
[4] String::size() const (??:0)
[5] String::length() const (??:0)
[6] String::is_empty() const (??:0)
[7] GDScriptParser::has_class(GDScriptParser::ClassNode const*) const (??:0)
[8] GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode*, GDScriptParser::Node const*) (??:0)
[9] GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode*, bool) (??:0)
[10] GDScriptAnalyzer::resolve_inheritance() (??:0)
[11] GDScriptParserRef::raise_status(GDScriptParserRef::Status) (??:0)
[12] GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode*, bool) (??:0)
[13] GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode*) (??:0)
[14] GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode*, bool) (??:0)
[15] GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode*) (??:0)
[16] GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode*, bool) (??:0)
[17] GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode*) (??:0)
[18] GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode*, bool) (??:0)
[19] GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode*, bool, bool) (??:0)
[20] GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode*, bool) (??:0)
[21] GDScriptAnalyzer::resolve_node(GDScriptParser::Node*, bool) (??:0)
[22] GDScriptAnalyzer::resolve_suite(GDScriptParser::SuiteNode*) (??:0)
[23] GDScriptAnalyzer::resolve_function_body(GDScriptParser::FunctionNode*) (??:0)
[24] GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode*, GDScriptParser::Node const*) (??:0)
[25] GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode*, bool) (??:0)
[26] GDScriptAnalyzer::resolve_body() (??:0)
[27] GDScriptAnalyzer::analyze() (??:0)
[28] ExtendGDScriptParser::parse(String const&, String const&) (??:0)
[29] GDScriptWorkspace::parse_script(String const&, String const&) (??:0)
[30] GDScriptTextDocument::sync_script_content(String const&, String const&) (??:0)
[31] GDScriptTextDocument::didChange(Variant const&) (??:0)
[32] void call_with_variant_args_helper<__UnexistingClass, Variant const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (??:0)
[33] void call_with_variant_args_dv<__UnexistingClass, Variant const&>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (??:0)
[34] MethodBindT<Variant const&>::call(Object*, Variant const**, int, Callable::CallError&) const (??:0)
[35] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (??:0)
[36] Object::callv(StringName const&, Array const&) (??:0)
[37] JSONRPC::process_action(Variant const&, bool) (??:0)
[38] JSONRPC::process_string(String const&) (??:0)
[39] GDScriptLanguageProtocol::process_message(String const&) (??:0)
[40] GDScriptLanguageProtocol::LSPeer::handle_data() (??:0)
[41] GDScriptLanguageProtocol::poll() (??:0)
[42] GDScriptLanguageServer::thread_main(void*) (??:0)
[43] Thread::callback(Thread*, Thread::Settings const&, void (*)(void*), void*) (??:0)
[44] 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)
[45] 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)
[46] 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)
[47] std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> >::operator()() (??:0)
[48] 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)
[49] /home/vale/godotdev/forks/latest/godot/bin/godot.linuxbsd.editor.dev.x86_64(+0x75572e0) [0x558d21fc62e0] (??:0)
[50] /lib/x86_64-linux-gnu/libpthread.so.0(+0x7ea7) [0x7f2c1413dea7] (??:0)
[51] /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f2c13f13a2f] (??:0)
-- END OF BACKTRACE --
================================================================

Steps to reproduce

I was just working with vscode (fixing some comments) :)
EDIT: It happen often. Usually when I have a script error and I'm going to fix it in vscode. It happen when I have two godot instances open connected with different language-server's ports

Minimal reproduction project

na

@akien-mga akien-mga changed the title [4.0] Crash with signal 11 Crash while editing GDScript in VS Code via LSP Jan 7, 2023
@akien-mga akien-mga added this to the 4.0 milestone Jan 7, 2023
@adamscott
Copy link
Member

@git2013vb Could you join a minimal reproduction project that reproduces this issue reliably?

@git2013vb
Copy link
Author

git2013vb commented Jan 8, 2023

@git2013vb Could you join a minimal reproduction project that reproduces this issue reliably?

Of course. I will do it once I found out what exactly is the trigger.. So far seems quite random. It happen when I have syntax errors in vscode.

I have to pin point which kind of error is the culprit.
I had already posted if I knew when the error happened.

Thanks

@git2013vb
Copy link
Author

With Godot 4 stable the issue became more difficult to pinpoint.

From logs no infos at all

I noticed it crash very often when I change code signal related and when I have more than one instance open

All day I work with two or three instance at same time. So it became impossible to work

It force me to reopen it 10 time a day at least :)

Using its integrated editor is a no go because it lack of features that vscode give for free

  • perfect git management (the godot plugin have issues)
  • info mouse hover
  • AI integration
  • window detachable
  • file management (not godot related)

Just to mention some :)

@wrn4
Copy link

wrn4 commented May 4, 2023

I also get crashes when using LSP with emacs(lsp-mode).

Using Arch linux with glibc 2.37-3

handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.3.rc1.official (2d74ee0e5b89e233ef5e86c0667f09a48e963f82)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x39ab0) [0x7fe419996ab0] (??:0)
[2] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x11d13cb] (??:0)
[3] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x1161018] (??:0)
[4] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x11e4baf] (??:0)
[5] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x116dfdf] (??:0)
[6] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x116f896] (??:0)
[7] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x1170adc] (??:0)
[8] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x115ce32] (??:0)
[9] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x11856ba] (??:0)
[10] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x49aaa47] (??:0)
[11] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x116ad1d] (??:0)
[12] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x1214eac] (??:0)
[13] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x245ec2a] (??:0)
[14] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x243a194] (??:0)
[15] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x246f268] (??:0)
[16] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x462c05a] (??:0)
[17] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x2491ce7] (??:0)
[18] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x24712a7] (??:0)
[19] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x1153109] (??:0)
[20] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x11134fb] (??:0)
[21] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x45bb4d8] (??:0)
[22] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x45d2a5f] (??:0)
[23] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x154fa24] (??:0)
[24] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x1550412] (??:0)
[25] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x10ebb85] (??:0)
[26] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x1114b18] (??:0)
[27] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x41d2655] (??:0)
[28] /home//.asdf/installs/godot/4.0.3-rc1/bin/godot() [0x4dfc120] (??:0)
[29] /usr/lib/libc.so.6(+0x8744b) [0x7fe4199e444b] (??:0)
[30] /usr/lib/libc.so.6(+0x10ae40) [0x7fe419a67e40] (??:0)
-- END OF BACKTRACE --
================================================================

@zhylmzr
Copy link

zhylmzr commented Jun 14, 2023

I tried compiling the debug version 5222a99.
I am fairly certain that the presence of the error statement increases the likelihood of a crash.
This is the call stack during the crash:

lldb -p 17387
(lldb) process attach --pid 17387
Process 17387 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x0000000195cb350c libsystem_kernel.dylib`__semwait_signal + 8
libsystem_kernel.dylib`:
->  0x195cb350c <+8>:  b.lo   0x195cb352c               ; <+40>
    0x195cb3510 <+12>: pacibsp
    0x195cb3514 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x195cb3518 <+20>: mov    x29, sp
Target 0: (godot.macos.editor.dev.arm64) stopped.
Executable module set to "/Users/zhylmzr/Downloads/godot/bin/godot.macos.editor.dev.arm64".
Architecture set to: arm64e-apple-macosx-.
(lldb) c
Process 17387 resuming
(lldb) br l
No breakpoints currently set.
(lldb) SCRIPT ERROR: Parse Error: Expected end of statement after variable declaration, found "in" instead.
          at: GDScript::reload (res://Test.gd:5)
SCRIPT ERROR: Parse Error: Expected end of statement after variable declaration, found "in" instead.
          at: GDScript::reload (res://Test.gd:4)
ERROR: FATAL: Index p_index = 0 is out of bounds (size() = 0).
   at: get (./core/templates/cowdata.h:155)
Process 17387 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1052526fc)
    frame #0: 0x00000001052526fc godot.macos.editor.dev.arm64`CowData<GDScriptSyntaxHighlighter::ColorRegion>::get(this=0x000000017bdf3310, p_index=0) const at cowdata.h:155:3
   152 		}
   153 	
   154 		_FORCE_INLINE_ const T &get(int p_index) const {
-> 155 			CRASH_BAD_INDEX(p_index, size());
   156 	
   157 			return _ptr[p_index];
   158 		}
Target 0: (godot.macos.editor.dev.arm64) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1052526fc)
  * frame #0: 0x00000001052526fc godot.macos.editor.dev.arm64`CowData<GDScriptSyntaxHighlighter::ColorRegion>::get(this=0x000000017bdf3310, p_index=0) const at cowdata.h:155:3
    frame #1: 0x000000010524d5b8 godot.macos.editor.dev.arm64`Vector<GDScriptSyntaxHighlighter::ColorRegion>::operator[](this=0x000000017bdf3308, p_index=0) const at vector.h:93:74
    frame #2: 0x000000010524a580 godot.macos.editor.dev.arm64`GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(this=0x000000017bdf3010, p_line=4) at gdscript_highlighter.cpp:171:27
    frame #3: 0x0000000108425500 godot.macos.editor.dev.arm64`SyntaxHighlighter::get_line_syntax_highlighting(this=0x000000017bdf3010, p_line=4) at syntax_highlighter.cpp:47:15
    frame #4: 0x0000000107829dc8 godot.macos.editor.dev.arm64`TextEdit::_get_line_syntax_highlighting(this=0x000000017bd77410, p_line=4) at text_edit.cpp:7555:92
    frame #5: 0x000000010781e954 godot.macos.editor.dev.arm64`TextEdit::_notification(this=0x000000017bd77410, p_what=30) at text_edit.cpp:762:29
    frame #6: 0x000000010757d988 godot.macos.editor.dev.arm64`TextEdit::_notificationv(this=0x000000017bd77410, p_notification=30, p_reversed=false) at text_edit.h:42:2
    frame #7: 0x000000010757ab30 godot.macos.editor.dev.arm64`CodeEdit::_notificationv(this=0x000000017bd77410, p_notification=30, p_reversed=false) at code_edit.h:37:2
    frame #8: 0x0000000109ce016c godot.macos.editor.dev.arm64`Object::notification(this=0x000000017bd77410, p_notification=30, p_reversed=false) at object.cpp:790:2
    frame #9: 0x0000000107386394 godot.macos.editor.dev.arm64`CanvasItem::_redraw_callback(this=0x000000017bd77410) at canvas_item.cpp:135:3
    frame #10: 0x00000001073a2a08 godot.macos.editor.dev.arm64`void call_with_variant_args_helper<CanvasItem>(p_instance=0x000000017bd77410, p_method=f8 62 38 07 01 00 00 00 00 00 00 00 00 00 00 00, p_args=0x0000000000000000, r_error=0x000000016b482188, (null)=IndexSequence<> @ 0x000000016b481e2f)(), Variant const**, Callable::CallError&, IndexSequence<>) at binder_common.h:293:2
    frame #11: 0x00000001073a2970 godot.macos.editor.dev.arm64`void call_with_variant_args<CanvasItem>(p_instance=0x000000017bd77410, p_method=f8 62 38 07 01 00 00 00 00 00 00 00 00 00 00 00, p_args=0x0000000000000000, p_argcount=0, r_error=0x000000016b482188)(), Variant const**, int, Callable::CallError&) at binder_common.h:407:2
    frame #12: 0x00000001073a2674 godot.macos.editor.dev.arm64`CallableCustomMethodPointer<CanvasItem>::call(this=0x000060001e864010, p_arguments=0x0000000000000000, p_argcount=0, r_return_value=0x000000016b4821c0, r_call_error=0x000000016b482188) const at callable_method_pointer.h:104:3
    frame #13: 0x00000001098e8a54 godot.macos.editor.dev.arm64`Callable::callp(this=0x0000000118008088, p_arguments=0x0000000000000000, p_argcount=0, r_return_value=0x000000016b4821c0, r_call_error=0x000000016b482188) const at callable.cpp:50:11
    frame #14: 0x0000000109cda1d0 godot.macos.editor.dev.arm64`MessageQueue::_call_function(this=0x0000600002665890, p_callable=0x0000000118008088, p_args=0x00000001180080a0, p_argcount=0, p_show_error=false) at message_queue.cpp:229:13
    frame #15: 0x0000000109cda538 godot.macos.editor.dev.arm64`MessageQueue::flush(this=0x0000600002665890) at message_queue.cpp:275:6
    frame #16: 0x00000001074490a8 godot.macos.editor.dev.arm64`SceneTree::physics_process(this=0x000000013141ea10, p_time=0.016666666666666666) at scene_tree.cpp:430:33
    frame #17: 0x0000000104db7540 godot.macos.editor.dev.arm64`Main::iteration() at main.cpp:3131:45
    frame #18: 0x0000000104d37ad8 godot.macos.editor.dev.arm64`OS_MacOS::run(this=0x000000016b482670) at os_macos.mm:668:8
    frame #19: 0x0000000104d8c134 godot.macos.editor.dev.arm64`main(argc=4, argv=0x000000016b482ac0) at godot_main_macos.mm:77:6
    frame #20: 0x0000000195997f28 dyld`start + 2236

@Xananax
Copy link

Xananax commented Jun 15, 2023

Usually, I do not have VSCode set as my external editor in Godot's settings: I run Godot, then independently run VSCode and connect to the LS.

I can't be sure, since it's not my typical workflow, but I have noticed this bug disappears if I set VSCode as my external editor.

It seems far-fetched, but IMHO worth a check. Can the rest of the concerned people in this confirm if that's their case too?

To not clutter the report, please just use emojis:

  • 👍 = "Yes, I also use VSCode independently"
  • 👎 = "No, I do have VSCode set as an external editor"

(Of course if you don't encounter the bug, don't vote)

@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 26, 2023
@saierXP
Copy link

saierXP commented Aug 2, 2023

After repeated and extensive testing, I found that meeting the following two conditions will likely trigger a crash:

  1. After opening the multithreading of LSP(default value is off),
  2. Keeping the editor's internal script editor opens the corresponding script

I can't be sure, since it's not my typical workflow, but I have noticed this bug disappears if I set VSCode as my external editor.

When enabling an external editor, the second condition may not be met, but sometimes the corresponding script may be opened in the editor (such as when the debugger encounters an error) @Xananax

If the above two conditions are not met, I cannot guarantee that it will not crash (Although I repeatedly tested and couldn't crash), but the frequency of crashes is higher when the above two conditions are met.

The replication script is as follows:

#actor.gd
class_name Actor
#test.gd
extends Node

var a:=Actor.new()
var b:=Actor.new()

func _ready() -> void:
	if true:
		prints("{0},{1}".format([a.charname ,b.charname]))
		return

By deleting .charname and then re-entering .charname or any non-existent property repeatedly(Be sure to remove the dot), it will encounter a crash, ensuring that the script is saved with ctrl+s after each modification.

lsp_crash.mp4
Backtrace of this crash in 4.0.3.stable

godot.windows.editor.x86_64.exe!GDScriptParser::has_class(const GDScriptParser::ClassNode * p_class) Line 617	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode * p_class, const GDScriptParser::Node * p_source) Line 310	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode * p_class, bool p_recursive) Line 565	C++
godot.windows.editor.x86_64.exe!GDScriptParserRef::raise_status(GDScriptParserRef::Status p_new_status) Line 98	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::make_global_class_meta_type(const StringName & p_class_name, const GDScriptParser::Node * p_source) Line 3261	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode * p_identifier, bool can_be_builtin) Line 3661	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode * p_expression, bool p_is_root) Line 2252	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode * p_call, bool p_is_await, bool p_is_root) Line 3020	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode * p_expression, bool p_is_root) Line 2240	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::resolve_assignable(GDScriptParser::AssignableNode * p_assignable, const char * p_kind) Line 1733	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::resolve_variable(GDScriptParser::VariableNode * p_variable, bool p_is_local) Line 1819	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode * p_class, int p_index, const GDScriptParser::Node * p_source) Line 888	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::resolve_class_interface(GDScriptParser::ClassNode * p_class, const GDScriptParser::Node * p_source) Line 1126	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::resolve_class_interface(GDScriptParser::ClassNode * p_class, bool p_recursive) Line 1135	C++
[Inline Frame] godot.windows.editor.x86_64.exe!GDScriptAnalyzer::resolve_interface() Line 5140	C++
godot.windows.editor.x86_64.exe!GDScriptAnalyzer::analyze() Line 5176	C++
godot.windows.editor.x86_64.exe!GDScriptLanguage::lookup_code(const String & p_code, const String & p_symbol, const String & p_path, Object * p_owner, ScriptLanguage::LookupResult & r_result) Line 3370	C++
godot.windows.editor.x86_64.exe!GDScriptWorkspace::resolve_symbol(const lsp::TextDocumentPositionParams & p_doc_pos, const String & p_symbol_name, bool p_func_required) Line 653	C++
godot.windows.editor.x86_64.exe!GDScriptTextDocument::resolve(const Dictionary & p_params) Line 266	C++
[Inline Frame] godot.windows.editor.x86_64.exe!call_with_variant_args_ret_helper(GDScriptLanguageProtocol *) Line 711	C++
godot.windows.editor.x86_64.exe!call_with_variant_args_ret_dv<GDScriptLanguageProtocol,Dictionary,Dictionary const &>(GDScriptLanguageProtocol * p_instance, Dictionary(GDScriptLanguageProtocol::*)(const Dictionary &) p_method, const Variant * * p_args, int p_argcount, Variant & r_ret, Callable::CallError & r_error, const Vector<Variant> & default_values) Line 524	C++
godot.windows.editor.x86_64.exe!MethodBindTR<GDScriptLanguageProtocol,Dictionary,Dictionary const &>::call(Object * p_object, const Variant * * p_args, int p_arg_count, Callable::CallError & r_error) Line 471	C++
godot.windows.editor.x86_64.exe!Object::callp(const StringName & p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error) Line 733	C++
godot.windows.editor.x86_64.exe!Object::callv(const StringName & p_method, const Array & p_args) Line 670	C++
godot.windows.editor.x86_64.exe!JSONRPC::process_action(const Variant & p_action, bool p_process_arr_elements) Line 130	C++
godot.windows.editor.x86_64.exe!JSONRPC::process_string(const String & p_input) Line 162	C++
godot.windows.editor.x86_64.exe!GDScriptLanguageProtocol::process_message(const String & p_text) Line 143	C++
godot.windows.editor.x86_64.exe!GDScriptLanguageProtocol::LSPeer::handle_data() Line 98	C++
godot.windows.editor.x86_64.exe!GDScriptLanguageProtocol::poll() Line 250	C++
godot.windows.editor.x86_64.exe!GDScriptLanguageServer::thread_main(void * p_userdata) Line 80	C++
godot.windows.editor.x86_64.exe!Thread::callback(unsigned __int64 p_caller_id, const Thread::Settings & p_settings, void(*)(void *) p_callback, void * p_userdata) Line 67	C++
[Inline Frame] godot.windows.editor.x86_64.exe!std::invoke(void(*)(unsigned __int64, const Thread::Settings &, void(*)(void *), void *) &&) Line 1586	C++
godot.windows.editor.x86_64.exe!std::thread::_Invoke<std::tuple<void (__cdecl*)(unsigned __int64,Thread::Settings const &,void (__cdecl*)(void *),void *),unsigned __int64,Thread::Settings,void (__cdecl*)(void *),void *>,0,1,2,3,4>(void * _RawVals) Line 56	C++
godot.windows.editor.x86_64.exe!thread_start<unsigned int (__cdecl*)(void *),1>(void * const parameter) Line 97	C++
kernel32.dll!BaseThreadInitThunk()	Unknown
ntdll.dll!RtlUserThreadStart()	Unknown

Although I originally encountered another crash for lsp, the call stack is different from OP. So I will not list in detail here.
Meet the above two conditions, then add a tab before the return(code above), then save, undo or add another tab until a crash occurs.

Anothr crash backtrace

godot.windows.editor.x86_64.exe!CowData<RBMap<int,int,Comparator<int>,DefaultAllocator>>::get(int) Line 155	C++
godot.windows.editor.x86_64.exe!Vector<RBMap<int,int,Comparator<int>,DefaultAllocator>>::operator[](int) Line 93	C++
godot.windows.editor.x86_64.exe!CodeEdit::_is_in_delimiter(int p_line, int p_column, CodeEdit::DelimiterType p_type) Line 2629	C++
godot.windows.editor.x86_64.exe!CodeEdit::is_in_string(int) Line 1646	C++
godot.windows.editor.x86_64.exe!CodeEdit::can_fold_line(int p_line) Line 1487	C++
godot.windows.editor.x86_64.exe!CodeEdit::_fold_gutter_draw_callback(int p_line, int p_gutter, Rect2 p_region) Line 1414	C++
godot.windows.editor.x86_64.exe!call_with_variant_args_helper(CodeEdit *) Line 293	C++
godot.windows.editor.x86_64.exe!call_with_variant_args(CodeEdit * p_instance, void(CodeEdit::*)(int, int, Rect2) p_method, const Variant * *) Line 407	C++
godot.windows.editor.x86_64.exe!CallableCustomMethodPointer<CodeEdit,int,int,Rect2>::call(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 105	C++
godot.windows.editor.x86_64.exe!Callable::callp(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 51	C++
godot.windows.editor.x86_64.exe!TextEdit::_notification(int p_what) Line 1069	C++
godot.windows.editor.x86_64.exe!TextEdit::_notificationv(int p_notification, bool p_reversed) Line 42	C++
godot.windows.editor.x86_64.exe!CodeEdit::_notificationv(int p_notification, bool p_reversed) Line 37	C++
godot.windows.editor.x86_64.exe!Object::notification(int p_notification, bool p_reversed) Line 792	C++
godot.windows.editor.x86_64.exe!CanvasItem::_redraw_callback() Line 136	C++
godot.windows.editor.x86_64.exe!Callable::callp(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 51	C++
godot.windows.editor.x86_64.exe!MessageQueue::_call_function(const Callable & p_callable, const Variant * p_args, int p_argcount, bool p_show_error) Line 230	C++
godot.windows.editor.x86_64.exe!MessageQueue::flush() Line 292	C++
godot.windows.editor.x86_64.exe!SceneTree::physics_process(double p_time) Line 432	C++
godot.windows.editor.x86_64.exe!Main::iteration() Line 3131	C++
godot.windows.editor.x86_64.exe!OS_Windows::run() Line 1295	C++
godot.windows.editor.x86_64.exe!widechar_main(int argc, wchar_t * * argv) Line 181	C++
godot.windows.editor.x86_64.exe!_main() Line 205	C++
godot.windows.editor.x86_64.exe!main(int argc, char * * argv) Line 217	C++
godot.windows.editor.x86_64.exe!invoke_main() Line 102	C++
godot.windows.editor.x86_64.exe!__scrt_common_main_seh() Line 288	C++
kernel32.dll!BaseThreadInitThunk()	Unknown
ntdll.dll!RtlUserThreadStart()	Unknown

@Alex2782
Copy link
Member

Alex2782 commented Aug 27, 2023

Godot v4.2.dev (6da4ad1) - macOS 13.4.1 - Vulkan (Forward+) - integrated Apple M1 - Apple M1 (8 Threads)

I was able to force the crash 2 times within 15 minutes. Tested like @saierXP in the video.

Does anyone already know how to fix such errors?
Like here in the description: Custom Godot servers
mutex->lock(); and mutex->unlock(); must be executed correctly?

cowdata.h#L81

image

CALL STACK
godot.macos.editor.dev.arm64!CowData<char32_t>::_get_size() const (/Users/alex/Develop/godot-github/core/templates/cowdata.h:81)
godot.macos.editor.dev.arm64!CowData<char32_t>::size() const (/Users/alex/Develop/godot-github/core/templates/cowdata.h:131)
godot.macos.editor.dev.arm64!String::size() const (/Users/alex/Develop/godot-github/core/string/ustring.h:217)
godot.macos.editor.dev.arm64!String::length() const (/Users/alex/Develop/godot-github/core/string/ustring.h:273)
godot.macos.editor.dev.arm64!String::is_empty() const (/Users/alex/Develop/godot-github/core/string/ustring.h:411)
godot.macos.editor.dev.arm64!GDScriptParser::has_class(GDScriptParser::ClassNode const*) const (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_parser.cpp:624)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode*, GDScriptParser::Node const*) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:311)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode*, bool) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:564)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::resolve_inheritance() (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:5388)
godot.macos.editor.dev.arm64!GDScriptParserRef::raise_status(GDScriptParserRef::Status) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_cache.cpp:76)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::make_global_class_meta_type(StringName const&, GDScriptParser::Node const*) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:3423)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode*, bool) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:3852)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode*, bool) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:2391)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode*, bool, bool) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:3169)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode*, bool) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:2379)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::resolve_assignable(GDScriptParser::AssignableNode*, char const*) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:1842)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::resolve_variable(GDScriptParser::VariableNode*, bool) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:1927)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode*, int, GDScriptParser::Node const*) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:928)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::resolve_class_interface(GDScriptParser::ClassNode*, GDScriptParser::Node const*) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:1178)
godot.macos.editor.dev.arm64!GDScriptAnalyzer::resolve_class_interface(GDScriptParser::ClassNode*, bool) (/Users/alex/Develop/godot-github/modules/gdscript/gdscript_analyzer.cpp:1206)

Edit: that is new outside of Godot

image

CALL STACK
libsystem_pthread.dylib!pthread_mutex_lock (Unknown Source:0)
libc++.1.dylib!std::__1::recursive_mutex::lock() (Unknown Source:0)
godot.macos.editor.dev.arm64!std::__1::unique_lock<std::__1::recursive_mutex>::unique_lock[abi:v15006](std::__1::recursive_mutex&) (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__mutex_base:122)
godot.macos.editor.dev.arm64!std::__1::unique_lock<std::__1::recursive_mutex>::unique_lock[abi:v15006](std::__1::recursive_mutex&) (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__mutex_base:122)
godot.macos.editor.dev.arm64!MutexLock<MutexImpl<std::__1::recursive_mutex> >::MutexLock(MutexImpl<std::__1::recursive_mutex> const&) (/Users/alex/Develop/godot-github/core/os/mutex.h:122)
godot.macos.editor.dev.arm64!MutexLock<MutexImpl<std::__1::recursive_mutex> >::MutexLock(MutexImpl<std::__1::recursive_mutex> const&) (/Users/alex/Develop/godot-github/core/os/mutex.h:122)
godot.macos.editor.dev.arm64!TextParagraph::set_break_flags(BitField<TextServer::LineBreakFlag>) (/Users/alex/Develop/godot-github/scene/resources/text_paragraph.cpp:486)
godot.macos.editor.dev.arm64!ItemList::_shape_text(int) (/Users/alex/Develop/godot-github/scene/gui/item_list.cpp:50)
godot.macos.editor.dev.arm64!ItemList::add_item(String const&, Ref<Texture2D> const&, bool) (/Users/alex/Develop/godot-github/scene/gui/item_list.cpp:64)
godot.macos.editor.dev.arm64!ScriptEditor::_update_script_names() (/Users/alex/Develop/godot-github/editor/plugins/script_editor_plugin.cpp:2141)
godot.macos.editor.dev.arm64!void call_with_variant_args_helper<ScriptEditor>(ScriptEditor*, void (ScriptEditor::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (/Users/alex/Develop/godot-github/core/variant/binder_common.h:303)
godot.macos.editor.dev.arm64!void call_with_variant_args<ScriptEditor>(ScriptEditor*, void (ScriptEditor::*)(), Variant const**, int, Callable::CallError&) (/Users/alex/Develop/godot-github/core/variant/binder_common.h:417)
godot.macos.editor.dev.arm64!CallableCustomMethodPointer<ScriptEditor>::call(Variant const**, int, Variant&, Callable::CallError&) const (/Users/alex/Develop/godot-github/core/object/callable_method_pointer.h:104)
godot.macos.editor.dev.arm64!Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/Users/alex/Develop/godot-github/core/variant/callable.cpp:50)
godot.macos.editor.dev.arm64!Object::emit_signalp(StringName const&, Variant const**, int) (/Users/alex/Develop/godot-github/core/object/object.cpp:1072)
godot.macos.editor.dev.arm64!Node::emit_signalp(StringName const&, Variant const**, int) (/Users/alex/Develop/godot-github/scene/main/node.cpp:3580)
godot.macos.editor.dev.arm64!Error Object::emit_signal<>(StringName const&) (/Users/alex/Develop/godot-github/core/object/object.h:891)
godot.macos.editor.dev.arm64!ScriptTextEditor::_validate_script() (/Users/alex/Develop/godot-github/editor/plugins/script_text_editor.cpp:512)
godot.macos.editor.dev.arm64!ScriptTextEditor::reload_text() (/Users/alex/Develop/godot-github/editor/plugins/script_text_editor.cpp:323)
godot.macos.editor.dev.arm64!ScriptEditor::reload_scripts(bool) (/Users/alex/Develop/godot-github/editor/plugins/script_editor_plugin.cpp:2617)
godot.macos.editor.dev.arm64!GDScriptTextDocument::didSave(Variant const&) (/Users/alex/Develop/godot-github/modules/gdscript/language_server/gdscript_text_document.cpp:112)
godot.macos.editor.dev.arm64!void call_with_variant_args_helper<__UnexistingClass, Variant const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/Users/alex/Develop/godot-github/core/variant/binder_common.h:303)
godot.macos.editor.dev.arm64!void call_with_variant_args_dv<__UnexistingClass, Variant const&>(__UnexistingClass*, void (__UnexistingClass::*)(Variant const&), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (/Users/alex/Develop/godot-github/core/variant/binder_common.h:450)
godot.macos.editor.dev.arm64!MethodBindT<Variant const&>::call(Object*, Variant const**, int, Callable::CallError&) const (/Users/alex/Develop/godot-github/core/object/method_bind.h:331)
godot.macos.editor.dev.arm64!Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (/Users/alex/Develop/godot-github/core/object/object.cpp:741)
godot.macos.editor.dev.arm64!Object::callv(StringName const&, Array const&) (/Users/alex/Develop/godot-github/core/object/object.cpp:678)
godot.macos.editor.dev.arm64!JSONRPC::process_action(Variant const&, bool) (/Users/alex/Develop/godot-github/modules/jsonrpc/jsonrpc.cpp:130)
godot.macos.editor.dev.arm64!JSONRPC::process_string(String const&) (/Users/alex/Develop/godot-github/modules/jsonrpc/jsonrpc.cpp:162)
godot.macos.editor.dev.arm64!GDScriptLanguageProtocol::process_message(String const&) (/Users/alex/Develop/godot-github/modules/gdscript/language_server/gdscript_language_protocol.cpp:143)
godot.macos.editor.dev.arm64!GDScriptLanguageProtocol::LSPeer::handle_data() (/Users/alex/Develop/godot-github/modules/gdscript/language_server/gdscript_language_protocol.cpp:98)
godot.macos.editor.dev.arm64!GDScriptLanguageProtocol::poll() (/Users/alex/Develop/godot-github/modules/gdscript/language_server/gdscript_language_protocol.cpp:249)
godot.macos.editor.dev.arm64!GDScriptLanguageServer::thread_main(void*) (/Users/alex/Develop/godot-github/modules/gdscript/language_server/gdscript_language_server.cpp:80)
godot.macos.editor.dev.arm64!Thread::callback(unsigned long long, Thread::Settings const&, void (*)(void*), void*) (/Users/alex/Develop/godot-github/core/os/thread.cpp:61)
godot.macos.editor.dev.arm64!decltype(std::declval<void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*)>()(std::declval<unsigned long long>(), std::declval<Thread::Settings>(), std::declval<void (*)(void*)>(), std::declval<void*>())) std::__1::__invoke[abi:v15006]<void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long, Thread::Settings, void (*)(void*), void*>(void (*&&)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long&&, Thread::Settings&&, void (*&&)(void*), void*&&) (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__functional/invoke.h:394)
godot.macos.editor.dev.arm64!void std::__1::__thread_execute[abi:v15006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long, Thread::Settings, void (*)(void*), void*, 2ul, 3ul, 4ul, 5ul>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long, Thread::Settings, void (*)(void*), void*>&, std::__1::__tuple_indices<2ul, 3ul, 4ul, 5ul>) (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/thread:290)
godot.macos.editor.dev.arm64!void* std::__1::__thread_proxy[abi:v15006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(unsigned long long, Thread::Settings const&, void (*)(void*), void*), unsigned long long, Thread::Settings, void (*)(void*), void*> >(void*) (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/thread:301)
libsystem_pthread.dylib!_pthread_start (Unknown Source:0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Status: Todo
Development

Successfully merging a pull request may close this issue.

10 participants