godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.71k stars 21.12k forks source link

Remote debugger fails to connect on first execution #31873

Closed JFonS closed 4 years ago

JFonS commented 5 years ago

Godot version: 4611977d

OS/device including version: Antergos Linux (5.2.9 kernel)

Issue description: Remote debugger fails to connect when the project is first executed from the editor. I only get it to happen when the project uses the multiplayer API, so it's probably related.

I get the following errors from the executed proecess:

ERROR: _get_socket_error: Socket error: 111
   At: drivers/unix/net_socket_posix.cpp:206.
ERROR: connect_to_host: Connection to remote host failed!
   At: drivers/unix/net_socket_posix.cpp:406.
ERROR: connect_to_host: Remote Debugger: Unable to connect. Status: 3.
   At: core/script_debugger_remote.cpp:92.

Steps to reproduce:

bojidar-bg commented 5 years ago

Can reproduce even after removing the script and signals from the main scene.

Cannot reproduce if I select any node in the Scene tab. Actually, the first run selects the root node of the scene, so it might be related. Can reproduce again (on a non-first run) if I create a new node, select it, and delete it. Cannot reproduce if I create a new resource from the inspector after doing the previous step.

Therefore, I think the issue is that the Remote Debugger fails if there is no object shown in the inspector, but the inspector's title shows an object.

Faless commented 5 years ago

Seems like a recent regression, I'll try to bisect

Faless commented 5 years ago

I've bisected it back to 2f2abadefe91ad3fb1c81be46f4573988b8226be but I can't find what's wrong with it. After that commit I'm also getting an error in console when opening projects (corrupted memory? gdb doesn't seem to help much):

ERROR: to_int64: Cannot represent 5f4b70c6025c3eef91701b4140359dd7 as 64-bit integer, provided value is too big.
   At: core/ustring.cpp:1806.

gdb trace for that error:

Thread 1 "godot.x11.tools" hit Breakpoint 1, String::to_int64 (this=0x7fffffffb9a8) at core/ustring.cpp:1806
1806                ERR_FAIL_COND_V_MSG(integer > INT64_MAX / 10, sign == 1 ? INT64_MAX : INT64_MIN, "Cannot represent " + *this + " as 64-bit integer, provided value is " + (sign == 1 ? "too big." : "too small."));
(gdb) bt
#0  String::to_int64 (this=0x7fffffffb9a8) at core/ustring.cpp:1806
#1  0x0000000001565f1e in GDScriptTokenizerText::_advance (this=0x8b8aeb0) at modules/gdscript/gdscript_tokenizer.cpp:990
#2  0x0000000001567645 in GDScriptTokenizerText::advance (this=0x8b8aeb0, p_amount=1) at modules/gdscript/gdscript_tokenizer.cpp:1207
#3  0x0000000001529e3b in GDScriptParser::_parse_newline (this=0x7fffffffc000) at modules/gdscript/gdscript_parser.cpp:3367
#4  0x000000000152a6df in GDScriptParser::_parse_class (this=0x7fffffffc000, p_class=0x8b99e80) at modules/gdscript/gdscript_parser.cpp:3482
#5  0x0000000001551492 in GDScriptParser::_parse (this=0x7fffffffc000, p_base_path=...) at modules/gdscript/gdscript_parser.cpp:8351
#6  0x0000000001551be4 in GDScriptParser::parse (this=0x7fffffffc000, p_code=..., p_base_path=..., p_just_validate=false, p_self_path=..., p_for_completion=false, r_safe_lines=0x0, 
    p_dependencies_only=false) at modules/gdscript/gdscript_parser.cpp:8459
#7  0x000000000148ea8a in GDScript::reload (this=0x7e42ee0, p_keep_state=false) at modules/gdscript/gdscript.cpp:570
#8  0x0000000001499a14 in ResourceFormatLoaderGDScript::load (this=0x6a6db10, p_path=..., p_original_path=..., r_error=0x0) at modules/gdscript/gdscript.cpp:2189
#9  0x0000000003a82715 in ResourceLoader::_load (p_path=..., p_original_path=..., p_type_hint=..., p_no_cache=false, r_error=0x0) at core/io/resource_loader.cpp:270
#10 0x0000000003a831df in ResourceLoader::load (p_path=..., p_type_hint=..., p_no_cache=false, r_error=0x0) at core/io/resource_loader.cpp:396
#11 0x0000000002905a4e in EditorAutoloadSettings::_create_autoload (this=0x8b8a3e0, p_path=...) at editor/editor_autoload_settings.cpp:317
#12 0x000000000290af78 in EditorAutoloadSettings::EditorAutoloadSettings (this=0x8b8a3e0) at editor/editor_autoload_settings.cpp:771
#13 0x000000000230b7ff in ProjectSettingsEditor::ProjectSettingsEditor (this=0x846a500, p_data=0x7382490) at editor/project_settings_editor.cpp:2014
#14 0x000000000216a2d9 in EditorNode::EditorNode (this=0x7381d10) at editor/editor_node.cpp:5917
#15 0x000000000140541e in Main::start () at main/main.cpp:1617
#16 0x00000000013c788c in main (argc=4, argv=0x7fffffffddb8) at platform/x11/godot_x11.cpp:55
akien-mga commented 5 years ago
ERROR: to_int64: Cannot represent 5f4b70c6025c3eef91701b4140359dd7 as 64-bit integer, provided value is too big.
   At: core/ustring.cpp:1806.

I'm also experiencing that, and this error is being raised by #31513 (which doesn't mean that #31513 introduced the bug though, it may have simply been unnoticed before).

akien-mga commented 5 years ago

Can you confirm if #31989 fixes it?

Faless commented 5 years ago

@akien-mga yes, it does. But I don't understand what the problem was (and the revert says nothing about it), so I fear we might be simply hiding the error, not fixing it.

Faless commented 4 years ago

Closing as fixed by the revert. The debugger will likely undergo some refactoring in 4.0 (adding to #33925, something I'd like to discuss at Godot Sprint).