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

RichTextLabel::_process_line error makes Godot unresponsive during One-Click Deploy #17815

Open
Tracked by #39144
ondesic opened this issue Mar 28, 2018 · 19 comments
Open
Tracked by #39144

Comments

@ondesic
Copy link

ondesic commented Mar 28, 2018

Godot version:

3.02

Issue description:

I have changed nothing in my program, but out of nowhere I can't One-Click Deploy my app to my phone without Godot freezing and the terminal goes to an endless loop saying:

"error: richtextlabel::_process_line: index line=0 out of size"

This may not be enough info, but again everything was running fine, then out of nowhere this is occurring.

@ghost ghost added this to the 3.1 milestone Mar 28, 2018
@vnen
Copy link
Member

vnen commented Mar 28, 2018

Sounds the same as #16072.

@ondesic
Copy link
Author

ondesic commented Mar 29, 2018

I checked 16072. the only similarity is the error code. With my error it happens every time I send the program to my phone.

@ondesic
Copy link
Author

ondesic commented Mar 29, 2018

I am really working hard to understand this bug to help Godot. The exact looping error is:

ERROR: RichTextLabel::_process_line: Index line=0 out of size (l.offset_caches.size()=0)
   At: scene\gui\rich_text_label.cpp:117

I opened the CPP file mentioned and it states:

if (p_mode != PROCESS_CACHE) {

		ERR_FAIL_INDEX_V(line, l.offset_caches.size(), 0);
		line_ofs = l.offset_caches[line];

	}

I have painstakingly taken the only scene in my app that has any labels in it. That scene is called "HUD". It is an instance added to the MAIN scene and is a CanvasLayer that holds labels and buttons. I have deleted each child and script of the HUD scene with no luck.

Finally I changed the PAUSE_MODE of the HUD scene to "stop" instead of "inherit" and now it runs fine.
If I change it back to "inherit" or "process", the errors come back.

Could someone please look into this. I'll help however I can.

@ghost
Copy link

ghost commented Mar 29, 2018

Could you make a minimal project that isolates the issue?

@vnen
Copy link
Member

vnen commented Mar 29, 2018

I checked 16072. the only similarity is the error code

Yes, and with that it's likely they have the same root cause. The problem is not the error per se but the infinite loop that happens when the error is shown.

@ondesic
Copy link
Author

ondesic commented Mar 29, 2018

I have whittled down the project. In its full form it errors every time, In it's smaller form it doesn't error out every time (dang it). However, after One-Click Deploying it 3 or 4 times to the android phone, it will error loop. One time it took 10 times running it on the phone to get the error loop. Here is the simple project.
test.zip

@ondesic
Copy link
Author

ondesic commented Apr 4, 2018

Could someone look at the little test project I put together?

@ondesic
Copy link
Author

ondesic commented Apr 22, 2018

Did anyone try this? I know everyone is busy, but I am just trying to help Godot. It's been 25 days since I started the thread. :-(

@ghost
Copy link

ghost commented Apr 22, 2018

We are all trying to help Godot. But as you can see there are more than two years old issues still open. Only way to ensure bugfix is to provide the fix yourself. (even then it still takes time to review)

I can't try this because I don't have a configured phone to do One-click deploy on.

If you're on Linux, try using gdb to breakpoint on the error line and give us stack trace. That will help pinpointing the cause. I assume nothing is wrong with the project as there's no usage of RichTextLabel.

@ondesic
Copy link
Author

ondesic commented Apr 23, 2018

Good point about issues over 2 years. The test project consistently gives me errors is I follow the steps I outlined. It is beyond my expertise as to why the looping error is occurring or how to fix it.

@reduz
Copy link
Member

reduz commented Sep 7, 2018

@hpvb I think you were doing android export work recently, did you see any of this?

@akien-mga akien-mga changed the title ERROR make Godot unresponsive RichTextLabel::_process_line error makes Godot unresponsive Jan 19, 2019
@akien-mga akien-mga changed the title RichTextLabel::_process_line error makes Godot unresponsive RichTextLabel::_process_line error makes Godot unresponsive during One-Click Deploy Jan 19, 2019
@akien-mga
Copy link
Member

#17465 seems related.

#16072 has the same error code but happens in a different scenario.
#24027 too, yet another scenario but same error code.

There definitely seems to be a potential infinite loop in RichTextLabel that needs to be investigated, as well as how those 3/4 different scenarios can trigger it.

@realkotob
Copy link
Contributor

realkotob commented Jan 20, 2019

I get this error when running but it doesn't happen consistently.

It causes the editor to crash but I don't have any data loss so it seems it happens after the scene saving and during the deploy phase.

@akien-mga akien-mga modified the milestones: 3.1, 3.2 Mar 4, 2019
@follower
Copy link
Contributor

follower commented Mar 24, 2019

As an additional data point, I have encountered the similar error message while using RichTextLabel:

E 0:00:11:0045   Index line=0 out of size (l.offset_caches.size()=0)
  <C Source>     scene/gui/rich_text_label.cpp:166 @ _process_line()

I'm using the add_text() method to append a text representation of (MIDI) input events to the label as the events occur. Most of the time this works but sometimes (more frequently for a particular MIDI device with frequent messages, I think) it triggers this error.

It occurred to me that I had the "Scroll Following" property enabled so I tried disabling scroll following and the error didn't seem to occur (with my limited testing).

I wonder if there's some sort of race condition related to redraw/scroll interaction?

Edited to add: This behavior most closely matches #24027 but this issue item seemed to be an umbrella item for the error message.

@akien-mga
Copy link
Member

Can anyone still reproduce this bug in the latest 3.2 builds?

@akien-mga
Copy link
Member

No answer and I haven't seen new reports about this in a while, so I'll assume that it got fixed at some point. Please comment if you can still reproduce it (or open a new issue if you can reproduce another RichTextLabel::_process_line error with a different test case).

@Arech
Copy link

Arech commented May 16, 2020

Can anyone still reproduce this bug in the latest 3.2 builds?

@akien-mga I'm having exactly this error right now using latest 3.2.1.stable. I did custom build to incorporate my own C++ code, but I don't have any reason to think that it is my code that causes the error.

The root cause of the infinite loop is simple, I think. RichTextLabel::_process_line() is called with a third parameter int& y and at least some callers expects y to change it value on function exit. But should it exit early with error handler ERR_FAIL_INDEX_V at line 170, y remains the same as it was and viola - we got infinite loop.

For example:

  1. in RichTextLabel::_notification() there's a code at line 1017 (comments are mine):
while (y /* <-------> */ < size.height && from_line < main->lines.size()) {
	visible_line_count += _process_line(main, text_rect.get_position(), y, /* <---- */ ...
  1. similar code at RichTextLabel::_find_click() at line=1062
while (y < text_rect.get_size().height && from_line < p_frame->lines.size()) {
		_process_line(p_frame, text_rect.get_position(), y, ...

btw, I'd suspect there are many more similar wrong uses of ERR_FAIL_INDEX_V() around the engine that could lead to infinite loops and it's better to audit all ERR_FAIL_INDEX_V() uses in the project...

However, to this moment that's all I know about the error. Will post updates if find something useful...

Also I will be very grateful if someone is to fix the issue asap. I'm not sure I can do it myself in some near future, as I have just started to use Godot a few days ago, but the issue is now blocking my progress completely...

@Arech
Copy link

Arech commented May 16, 2020

Btw, my use-case is very similar to #17465 (also Win7 x64, deploying to android 9 at htc u12+).

Regarding the scene - I'm using almost completely "stock" 2D Physics Platformer Demo (RigidBody) game from the lib.

The good thing is the issue seems to be definitely related to Debug/Small Deploy with Network FS main editor's menu checkbox. I unchecked it and then was able to run debug properly without a freezing. I checked it, and on deploying editor froze in the infinite loop with the error.

The bad thing - that's all know how to reproduce the bug.

@akien-mga
Copy link
Member

Related (likely duplicate, but both have useful debugging info) 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

10 participants