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

GDScript code completion can trigger infinite recursion in _guess_expression_type #38851

Closed
razcore-rad opened this issue May 19, 2020 · 4 comments · Fixed by #62918
Closed

Comments

@razcore-rad
Copy link
Contributor

razcore-rad commented May 19, 2020

Godot version:
3.2.1.stable.official

OS/device including version:
Ubuntu 20.04
Linux alienware 5.4.0-29-generic #33-Ubuntu SMP Wed Apr 29 14:32:27 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Issue description:
Maximum _guess_expression_type depth limit reached. Please file a bugreport.

Steps to reproduce:
Define a dictionary:

var minmax = {"min": 0.0, "max": 1.0}

Try to write something like:

minmax = {
  "min": minmax.min
}

Experience total block-out of OS.

Minimal reproduction project:

@Calinou Calinou added this to the 4.0 milestone May 19, 2020
@ThakeeNathees
Copy link
Contributor

@razcore-art could you upload a minimal reproduction project or explain the exact steps to reproduce?

can't reproduce with this single script

var minmax = {"min": 0.0, "max": 1.0}
func _ready():
	minmax = {
		"min": minmax.min
	}
	print(minmax)

@razcore-rad
Copy link
Contributor Author

Sorry, I had a typo, I think it's related to typed GDScript, can't upload a project cause if I were to type the script out it will freeze my OS.

Try this:

func _ready() -> void:
	var minmax := {"min": 0.0, "max": 1.0}
	minmax = {
		"min": minmax.min # <- freezes on this line as you type
	}

@mrushyendra
Copy link
Contributor

@ThakeeNathees - there actually seems to be 2 very closely related issues. Open Node2D.gd in codeCompleteBug.zip in the Godot Editor.

You will see something like:

func _ready():
	var foo := {"min": 0.0, "max": 1.0}
	foo = {
		"min" : foo.m
	} 
  1. Try typing 'i' after 'foo.m'
func _ready():
	var foo := {"min": 0.0, "max": 1.0}
	foo = {
		"min" : foo.mi  #<-- add the 'i' here
	} 

You should see a single Maximum _guess_expression_type depth limit reached. Please file a bugreport message.

  1. Now type an 'n' in the same line
func _ready():
	var foo := {"min": 0.0, "max": 1.0}
	foo = {
		"min" : foo.min #<-- add the 'n' here
	} 

The message Maximum _guess_expression_type depth limit reached. Please file a bugreport is printed almost indefinitely, and the editor hangs.

if (++p_context.depth > 100) {
print_error("Maximum _guess_expression_type depth limit reached. Please file a bugreport.");
return false;
}

I'm guessing (1) is an unavoidable issue since in this case the user is trying to redefine "foo" after it has already been declared previously. Not sure how we could ever reliably deal with such cases.

In (2), the code seems to enter an infinite loop as well, but checking for p_context.depth in order to break out of the loop seems to be insufficient, because in certain functions p_context is passed by value instead of reference. Hence, p_context.depth continually exceeds 100 in certain recursive calls, but the error is not propagated back.

I've attached a trace from GDB below:

#0  _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:640
#1  0x0000000001f69457 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:950
#2  0x0000000001f69457 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:950
#3  0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#4  0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#5  0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#6  0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#7  0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#8  0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#9  0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#10 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#11 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#12 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#13 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#14 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#15 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#16 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#17 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#18 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#19 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#20 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#21 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#22 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#23 0x0000000001f69457 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:950
#24 0x0000000001f69457 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:950
#25 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#26 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#27 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#28 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#29 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#30 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#31 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#32 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#33 0x0000000001f69457 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:950
#34 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#35 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#36 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#37 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#38 0x0000000001f69457 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:950
---Type <return> to continue, or q <return> to quit---
#39 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#40 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#41 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#42 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#43 0x0000000001f69457 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:950
#44 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#45 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#46 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#47 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#48 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#49 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#50 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#51 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#52 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#53 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#54 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#55 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#56 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#57 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#58 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#59 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#60 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#61 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#62 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#63 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#64 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#65 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#66 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#67 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#68 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#69 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#70 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#71 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#72 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#73 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#74 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#75 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#76 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#77 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
---Type <return> to continue, or q <return> to quit---
#78 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#79 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#80 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#81 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#82 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#83 0x0000000001f69067 in _guess_expression_type (p_context=..., p_expression=0x14b1db90, r_type=...) at modules/gdscript/gdscript_editor.cpp:923
#84 0x0000000001f6786d in _guess_expression_type (p_context=..., p_expression=0x14b1d770, r_type=...) at modules/gdscript/gdscript_editor.cpp:673
#85 0x0000000001f6b116 in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1232
#86 0x0000000001f67781 in _guess_expression_type (p_context=..., p_expression=0x853b2a0, r_type=...) at modules/gdscript/gdscript_editor.cpp:662
#87 0x0000000001f75a53 in GDScriptLanguage::complete_code (this=0x80baeb0, p_code=..., p_path=..., p_owner=0x15361bc0, r_options=0x7fffffffc358, 
    r_forced=@0x7fffffffc357: false, r_call_hint=...) at modules/gdscript/gdscript_editor.cpp:2611
#88 0x00000000031b2f5d in ScriptTextEditor::_code_complete_script (this=0x14f64360, p_code=..., r_options=0x7fffffffc358, 
    r_force=@0x7fffffffc357: false) at editor/plugins/script_text_editor.cpp:805
#89 0x00000000031b2e44 in ScriptTextEditor::_code_complete_scripts (p_ud=0x14f64360, p_code=..., r_options=0x7fffffffc358, 
    r_force=@0x7fffffffc357: false) at editor/plugins/script_text_editor.cpp:793
#90 0x0000000003421a35 in CodeTextEditor::_complete_request (this=0x14f64dd0) at editor/code_editor.cpp:800
#91 0x00000000034310a7 in call_with_variant_args_helper<CodeTextEditor>(CodeTextEditor*, void (CodeTextEditor::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (p_instance=0x14f64dd0, 
    p_method=(void (CodeTextEditor::*)(CodeTextEditor * const)) 0x3421992 <CodeTextEditor::_complete_request()>, p_args=0x7fffffffc760, 
    r_error=...) at ./core/callable_method_pointer.h:132
#92 0x0000000003430bc5 in call_with_variant_args<CodeTextEditor> (p_instance=0x14f64dd0, 
    p_method=(void (CodeTextEditor::*)(CodeTextEditor * const)) 0x3421992 <CodeTextEditor::_complete_request()>, p_args=0x7fffffffc760, 
    p_argcount=0, r_error=...) at ./core/callable_method_pointer.h:157
#93 0x000000000342f512 in CallableCustomMethodPointer<CodeTextEditor>::call (this=0x138169e0, p_arguments=0x7fffffffc760, p_argcount=0, 
    r_return_value=..., r_call_error=...) at ./core/callable_method_pointer.h:184
#94 0x00000000045b5b51 in Callable::call (this=0x8997738, p_arguments=0x7fffffffc760, p_argcount=0, r_return_value=..., r_call_error=...)
    at core/callable.cpp:49
#95 0x000000000464241f in Object::emit_signal (this=0x14f65af0, p_name=..., p_args=0x7fffffffc760, p_argcount=0) at core/object.cpp:1169
#96 0x0000000004642b14 in Object::emit_signal (this=0x14f65af0, p_name=..., p_arg1=..., p_arg2=..., p_arg3=..., p_arg4=..., p_arg5=...)
    at core/object.cpp:1224
#97 0x00000000038c3b49 in TextEdit::query_code_comple (this=0x14f65af0) at scene/gui/text_edit.cpp:6637
#98 0x000000000342198c in CodeTextEditor::_code_complete_timer_timeout (this=0x14f64dd0) at editor/code_editor.cpp:791
#99 0x00000000034310a7 in call_with_variant_args_helper<CodeTextEditor>(CodeTextEditor*, void (CodeTextEditor::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (p_instance=0x14f64dd0, 

    p_method=(void (CodeTextEditor::*)(CodeTextEditor * const)) 0x342195a <CodeTextEditor::_code_complete_timer_timeout()>, 
    p_args=0x7fffffffccc0, r_error=...) at ./core/callable_method_pointer.h:132
#100 0x0000000003430bc5 in call_with_variant_args<CodeTextEditor> (p_instance=0x14f64dd0, 
    p_method=(void (CodeTextEditor::*)(CodeTextEditor * const)) 0x342195a <CodeTextEditor::_code_complete_timer_timeout()>, 
    p_args=0x7fffffffccc0, p_argcount=0, r_error=...) at ./core/callable_method_pointer.h:157
---Type <return> to continue, or q <return> to quit---
#101 0x000000000342f512 in CallableCustomMethodPointer<CodeTextEditor>::call (this=0x138becd0, p_arguments=0x7fffffffccc0, p_argcount=0, 
    r_return_value=..., r_call_error=...) at ./core/callable_method_pointer.h:184
#102 0x00000000045b5b51 in Callable::call (this=0x86b0ef8, p_arguments=0x7fffffffccc0, p_argcount=0, r_return_value=..., r_call_error=...)
    at core/callable.cpp:49
#103 0x000000000464241f in Object::emit_signal (this=0x14fbd780, p_name=..., p_args=0x7fffffffccc0, p_argcount=0) at core/object.cpp:1169
#104 0x0000000004642b14 in Object::emit_signal (this=0x14fbd780, p_name=..., p_arg1=..., p_arg2=..., p_arg3=..., p_arg4=..., p_arg5=...)
    at core/object.cpp:1224
#105 0x00000000036a77c3 in Timer::_notification (this=0x14fbd780, p_what=25) at scene/main/timer.cpp:61
#106 0x00000000036a9e3a in Timer::_notificationv (this=0x14fbd780, p_notification=25, p_reversed=false) at scene/main/timer.h:37
#107 0x00000000046406fd in Object::notification (this=0x14fbd780, p_notification=25, p_reversed=false) at core/object.cpp:899
#108 0x000000000368c1f5 in SceneTree::_notify_group_pause (this=0x816f0b0, p_group=..., p_notification=25) at scene/main/scene_tree.cpp:823
#109 0x000000000368a29d in SceneTree::idle (this=0x816f0b0, p_time=0.0173480026) at scene/main/scene_tree.cpp:453
#110 0x00000000019b4eaf in Main::iteration () at main/main.cpp:2199
#111 0x000000000197e094 in OS_LinuxBSD::run (this=0x7fffffffd150) at platform/linuxbsd/os_linuxbsd.cpp:241
#112 0x000000000197bc03 in main (argc=4, argv=0x7fffffffd638) at platform/linuxbsd/godot_linuxbsd.cpp:55

To replicate:

gdb godot
run -e --path ../path/to/sample/project
break _guess_expression_type

Next, type "in" in line 13. Then, in GDB, press ctrl-c

continue
bt

Possible Fix

Instead of copying p_context:

GDScriptCompletionContext c = p_context;
c.line = op->line;

Pass p_context itself to any recursive calls to _guess_expression_type.

I'm pretty new to this module, so it's just a hypothesis. Do let me know if you have any other possible fix in mind that I can help implement.

@akien-mga
Copy link
Member

I can confirm this is still reproducible in current 3.x using the project by @mrushyendra, with the same symptoms (error when typing i, infinite loop when typing n).

In master, it's worse as it crashes right away when typing i:

Thread 1 "godot-git" received signal SIGSEGV, Segmentation fault.
0x0000000005cdd500 in _guess_expression_type (p_context=<error reading variable: Cannot access memory at address 0x7fffff7fe568>, p_expression=<error reading variable: Cannot access memory at address 0x7fffff7fe560>, r_type=<error reading variable: Cannot access memory at address 0x7fffff7fe558>) at modules/gdscript/gdscript_editor.cpp:1222
1222    static bool _guess_expression_type(GDScriptParser::CompletionContext &p_context, const GDScriptParser::ExpressionNode *p_expression, GDScriptCompletionIdentifier &r_type) {

(gdb) bt
#0  0x0000000005cdd500 in _guess_expression_type (p_context=<error reading variable: Cannot access memory at address 0x7fffff7fe568>, 
    p_expression=<error reading variable: Cannot access memory at address 0x7fffff7fe560>, r_type=<error reading variable: Cannot access memory at address 0x7fffff7fe558>)
    at modules/gdscript/gdscript_editor.cpp:1222
#1  0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489
#2  0x0000000005cdd7ca in _guess_expression_type (p_context=..., p_expression=0x1cb09700, r_type=...) at modules/gdscript/gdscript_editor.cpp:1267
#3  0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#4  0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#5  0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489
#6  0x0000000005cdd7ca in _guess_expression_type (p_context=..., p_expression=0x1cb09700, r_type=...) at modules/gdscript/gdscript_editor.cpp:1267
#7  0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#8  0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#9  0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489
#10 0x0000000005cdd7ca in _guess_expression_type (p_context=..., p_expression=0x1cb09700, r_type=...) at modules/gdscript/gdscript_editor.cpp:1267
#11 0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#12 0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#13 0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489
#14 0x0000000005cdd7ca in _guess_expression_type (p_context=..., p_expression=0x1cb09700, r_type=...) at modules/gdscript/gdscript_editor.cpp:1267
#15 0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#16 0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#17 0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489
#18 0x0000000005cdd7ca in _guess_expression_type (p_context=..., p_expression=0x1cb09700, r_type=...) at modules/gdscript/gdscript_editor.cpp:1267
#19 0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#20 0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#21 0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489
#22 0x0000000005cdd7ca in _guess_expression_type (p_context=..., p_expression=0x1cb09700, r_type=...) at modules/gdscript/gdscript_editor.cpp:1267
#23 0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#24 0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#25 0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489
#26 0x0000000005cdd7ca in _guess_expression_type (p_context=..., p_expression=0x1cb09700, r_type=...) at modules/gdscript/gdscript_editor.cpp:1267
#27 0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#28 0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#29 0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489
#30 0x0000000005cdd7ca in _guess_expression_type (p_context=..., p_expression=0x1cb09700, r_type=...) at modules/gdscript/gdscript_editor.cpp:1267
#31 0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#32 0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#33 0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489

<snip>

#1903 0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#1904 0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#1905 0x0000000005cdea07 in _guess_expression_type (p_context=..., p_expression=0x1ccb0740, r_type=...) at modules/gdscript/gdscript_editor.cpp:1489
#1906 0x0000000005cdd7ca in _guess_expression_type (p_context=..., p_expression=0x1cb09700, r_type=...) at modules/gdscript/gdscript_editor.cpp:1267
#1907 0x0000000005ce085f in _guess_identifier_type (p_context=..., p_identifier=..., r_type=...) at modules/gdscript/gdscript_editor.cpp:1787
#1908 0x0000000005cdd6e9 in _guess_expression_type (p_context=..., p_expression=0xc2b9980, r_type=...) at modules/gdscript/gdscript_editor.cpp:1252
#1909 0x0000000005ce6964 in GDScriptLanguage::complete_code (this=0xc0e6710, p_code=..., p_path=..., p_owner=0x1cb1fbb0, r_options=0x7fffffffc258, r_forced=@0x7fffffffc24f: true, r_call_hint=...) at modules/gdscript/gdscript_editor.cpp:2577
#1910 0x0000000006f8590c in ScriptTextEditor::_code_complete_script (this=0x1c2444c0, p_code=..., r_options=0x7fffffffc258, r_force=@0x7fffffffc24f: true) at editor/plugins/script_text_editor.cpp:701
#1911 0x0000000006f85800 in ScriptTextEditor::_code_complete_scripts (p_ud=0x1c2444c0, p_code=..., r_options=0x7fffffffc258, r_force=@0x7fffffffc24f: true) at editor/plugins/script_text_editor.cpp:689
#1912 0x00000000064d31d6 in CodeTextEditor::_complete_request (this=0x1c244c90) at editor/code_editor.cpp:862
#1913 0x00000000064e69c2 in call_with_variant_args_helper<CodeTextEditor>(CodeTextEditor*, void (CodeTextEditor::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (p_instance=0x1c244c90, p_method=(void (CodeTextEditor::*)(CodeTextEditor * const)) 0x64d3140 <CodeTextEditor::_complete_request()>, p_args=0x0, r_error=...) at ./core/variant/binder_common.h:236
#1914 0x00000000064e6612 in call_with_variant_args<CodeTextEditor> (p_instance=0x1c244c90, p_method=(void (CodeTextEditor::*)(CodeTextEditor * const)) 0x64d3140 <CodeTextEditor::_complete_request()>, p_args=0x0, p_argcount=0, r_error=...) at ./core/variant/binder_common.h:350
#1915 0x00000000064e45d8 in CallableCustomMethodPointer<CodeTextEditor>::call (this=0x1a56f6a0, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/object/callable_method_pointer.h:104
#1916 0x0000000008d6f85f in Callable::call (this=0x1a5e0068, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at core/variant/callable.cpp:50
#1917 0x0000000009005cd2 in Object::emit_signalp (this=0x1c61e9d0, p_name=..., p_args=0x0, p_argcount=0) at core/object/object.cpp:1114
#1918 0x00000000051961c7 in Object::emit_signal<>(StringName const&) (this=0x1c61e9d0, p_name=...) at ./core/object/object.h:773
#1919 0x0000000007456727 in CodeEdit::request_code_completion (this=0x1c61e9d0, p_force=false) at scene/gui/code_edit.cpp:1814
#1920 0x00000000064d313b in CodeTextEditor::_code_complete_timer_timeout (this=0x1c244c90) at editor/code_editor.cpp:853
#1921 0x00000000064e69c2 in call_with_variant_args_helper<CodeTextEditor>(CodeTextEditor*, void (CodeTextEditor::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (p_instance=0x1c244c90, p_method=(void (CodeTextEditor::*)(CodeTextEditor * const)) 0x64d3104 <CodeTextEditor::_code_complete_timer_timeout()>, p_args=0x0, r_error=...) at ./core/variant/binder_common.h:236
#1922 0x00000000064e6612 in call_with_variant_args<CodeTextEditor> (p_instance=0x1c244c90, p_method=(void (CodeTextEditor::*)(CodeTextEditor * const)) 0x64d3104 <CodeTextEditor::_code_complete_timer_timeout()>, p_args=0x0, p_argcount=0, r_error=...) at ./core/variant/binder_common.h:350
#1923 0x00000000064e45d8 in CallableCustomMethodPointer<CodeTextEditor>::call (this=0x1a568b50, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at ./core/object/callable_method_pointer.h:104
#1924 0x0000000008d6f85f in Callable::call (this=0xcf94698, p_arguments=0x0, p_argcount=0, r_return_value=..., r_call_error=...) at core/variant/callable.cpp:50
#1925 0x0000000009005cd2 in Object::emit_signalp (this=0x1c341b20, p_name=..., p_args=0x0, p_argcount=0) at core/object/object.cpp:1114
#1926 0x00000000051961c7 in Object::emit_signal<>(StringName const&) (this=0x1c341b20, p_name=...) at ./core/object/object.h:773
#1927 0x0000000007390a1f in Timer::_notification (this=0x1c341b20, p_what=25) at scene/main/timer.cpp:60
#1928 0x0000000007392f72 in Timer::_notificationv (this=0x1c341b20, p_notification=25, p_reversed=false) at scene/main/timer.h:37
#1929 0x0000000009004193 in Object::notification (this=0x1c341b20, p_notification=25, p_reversed=false) at core/object/object.cpp:848
#1930 0x0000000007376307 in SceneTree::_notify_group_pause (this=0xb759c70, p_group=..., p_notification=25) at scene/main/scene_tree.cpp:851
#1931 0x00000000073747b5 in SceneTree::process (this=0xb759c70, p_time=0.0068970000000000004) at scene/main/scene_tree.cpp:449
#1932 0x0000000004e409d8 in Main::iteration () at main/main.cpp:2701
#1933 0x0000000004df9c9d in OS_LinuxBSD::run (this=0x7fffffffd1a0) at platform/linuxbsd/os_linuxbsd.cpp:357
#1934 0x0000000004df5f5c in main (argc=2, argv=0x7fffffffd6e8) at platform/linuxbsd/godot_linuxbsd.cpp:58

@akien-mga akien-mga changed the title GDscript parser _guess_expression_type memory-leak GDscript code completion can trigger infinite recursion in _guess_expression_type Mar 26, 2022
@akien-mga akien-mga changed the title GDscript code completion can trigger infinite recursion in _guess_expression_type GDScript code completion can trigger infinite recursion in _guess_expression_type Mar 26, 2022
@YeldhamDev YeldhamDev linked a pull request Jul 12, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants