Repository: godot
Issue: Godot crashes when using an external editor
Labels: bug,topic:gdscript,topic:editor,crash

### Tested versions

- Reproducible in Godot 4.3-beta2, Godot4.3-rc1

### System information

Godot v4.3.rc1 - Arch Linux #1 SMP PREEMPT_DYNAMIC Wed, 24 Jul 2024 22:25:43 +0000 - Wayland - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 1060 6GB (nvidia; 555.58.02) - AMD Ryzen 5 1600 Six-Core Processor (12 Threads)

### Issue description

When I am editing a script utilizing neovim as an external editor, sometimes the Godot Editor crashes leaving the following Stack Trace:

```
ERROR: Cannot get class '@GDScript'.
   at: _get_parent_class (core/object/class_db.cpp:320)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.3.rc1.official (e343dbbcc1030f04dc5833f1c19d267a17332ca9)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x3d1d0) [0x7691f1c2c1d0] (??:0)
[2] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x5d005a] (??:0)
[3] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x47fcd6d] (??:0)
[4] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x4310194] (??:0)
[5] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x23b359c] (??:0)
[6] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x527520] (??:0)
[7] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x420282] (??:0)
[8] /usr/lib/libc.so.6(+0x25e08) [0x7691f1c14e08] (??:0)
[9] /usr/lib/libc.so.6(__libc_start_main+0x8c) [0x7691f1c14ecc] (??:0)
[10] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x43d42a] (??:0)
-- END OF BACKTRACE --
================================================================
```
Or this one:
```
Generated 'res://scripts/enemy/pathFollowers/defend_state_follow.gd' preview in 121737 usec

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.3.rc1.official (e343dbbcc1030f04dc5833f1c19d267a17332ca9)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x3d1d0) [0x7100479111d0] (??:0)
[2] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x5d005a] (??:0)
[3] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x47fcd6d] (??:0)
[4] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x4310194] (??:0)
[5] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x23b359c] (??:0)
[6] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x527520] (??:0)
[7] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x420282] (??:0)
[8] /usr/lib/libc.so.6(+0x25e08) [0x7100478f9e08] (??:0)
[9] /usr/lib/libc.so.6(__libc_start_main+0x8c) [0x7100478f9ecc] (??:0)
[10] /home/alexcg/Descargas/Godot_v4.3-rc1_linux.x86_64() [0x43d42a] (??:0)
-- END OF BACKTRACE --
================================================================

```

In neovim, I get the following error:
```
LSP[gdscript]: Error READ_ERROR: "ECONNRESET"
```

Sometimes it crashes 2-3 minutes after start editing scripts, and sometimes it can be more than 2 hours without a crash. It doesn't seem to creash when using the built-in text editor.
I have tried different versions of the glibc package, and different versions of the Godot Editor, and the crashes haven't stopped. I am getting the feeling that the crashes are more frequent when I am writing comments in the code and when I save the file, but I'm not entirely sure. 

My configuration in the Godot Editor for using neovim as an external editor is the following:
text_editor/external/exec_path: `nvim`
text_editor/external/exec_flags: `--server ./godothost --remote-send "<C-\><C-N>:n {file}<CR>{line}G{col}|"`
I open neovim using: `nvim --listen ./godothost`
Neovim is configured to connect to the Godot Lenguage Server.


https://github.com/user-attachments/assets/185551fa-ab81-407f-aa55-1d1456dcf776



### Steps to reproduce

1. Open a Godot project
2. Configure Godot to use an external editor
3. Open neovim
4. Start editing an script and saving the file
5. Now Godot may crash

### Minimal reproduction project (MRP)

N/A