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

Godot freezes due to print statements in thread within an EditorPlugin #43705

Open
winston-yallow opened this issue Nov 20, 2020 · 3 comments
Open

Comments

@winston-yallow
Copy link
Contributor

Godot version:
v3.2.3.stable.official

OS/device including version:
OS: Solus x86_64 (Kernel 5.6.19-159.current)
CPU: Intel i5-7400

Issue description:
Printing repeatedly in a thread (started within the editor) will freeze godot.
The following error is printed in an endless scroll to the terminal if godot was started from the command line:

ERROR: _process_line: Index line = 0 is out of bounds (l.offset_caches.size() = 0).
   At: scene/gui/rich_text_label.cpp:170.

Steps to reproduce:
Start a thread repeatedly that prints to the output. The output tab must be open for godot to freeze after enough lines were printed. It never happens on the first run of the thread, but at one of the following runs.

Minimal reproduction project:
The project contains a small plugin that can freeze the engine. Steps to use this project:

  1. Open the output tab
  2. Press the "CRASH" button at the top right corner of the editor
  3. Wait till you can press it again, then go back to step 2

Project zip: bug.zip
Bug file: ./addons/freezer/CrashButton.gd (thread method in line 40)

@winston-yallow
Copy link
Contributor Author

winston-yallow commented Nov 20, 2020

Could anyone help me and point me to a starting point where this might be related to in the source code? I would like to try and investigate but are a bit lost for a starting point.

Edit: Removed first sentence and changed some words as it sounded a bit too demanding

@akien-mga
Copy link
Member

The problem is that RichTextLabel (which is used by the Output panel) is not thread safe. You'd have to see if you can make RichTextLabel thread safe, or make the Output panel's code that handles receiving and printing messages thread safe.

@akien-mga
Copy link
Member

Related (or duplicate, but that one is not about thread use) to #38058.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants