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

The engine crashes after changing the path to the node #80041

Closed
ghost opened this issue Jul 30, 2023 · 4 comments · Fixed by #80472
Closed

The engine crashes after changing the path to the node #80041

ghost opened this issue Jul 30, 2023 · 4 comments · Fixed by #80472

Comments

@ghost
Copy link

ghost commented Jul 30, 2023

Godot version

v4.1.1-stable_mono_win64

System information

Windows 11

Issue description

I removed the node to replace it with another, but when I change the path in the code, the engine crashes for me.

Steps to reproduce

I did a screen recording as it happens:

rec.mp4

Minimal reproduction project

MixApo.zip

@rsubtil
Copy link
Contributor

rsubtil commented Aug 8, 2023

Godot is entering an infinite loop here:

godot/scene/gui/code_edit.cpp

Lines 3151 to 3168 in f7bc653

for (Vector<Pair<int, int>> &subsequence_matches : all_possible_subsequence_matches) {
Pair<int, int> match_last_segment = subsequence_matches[subsequence_matches.size() - 1];
int next_index = match_last_segment.first + match_last_segment.second;
// get the last index from current sequence
// and look for next char starting from that index
if (target_lower[next_index] == *string_to_complete_char_lower) {
Vector<Pair<int, int>> new_matches = subsequence_matches;
new_matches.write[new_matches.size() - 1].second++;
next_subsequence_matches.push_back(new_matches);
}
for (int index : all_ocurence) {
if (index > next_index) {
Vector<Pair<int, int>> new_matches = subsequence_matches;
new_matches.push_back({ index, 1 });
next_subsequence_matches.push_back(new_matches);
}
}
}

Reverting #75746 fixes the problem (cc @ajreckof)

@ajreckof
Copy link
Member

ajreckof commented Aug 8, 2023

I'll take a look at it tomorrow but to be sure is Godot crashing or is it freezing?

@rsubtil
Copy link
Contributor

rsubtil commented Aug 8, 2023

I'll take a look at it tomorrow but to be sure is Godot crashing or is it freezing?

It doesn't crash. When poking around in gdb it seems like it never exits this loop.

@akien-mga akien-mga added this to the 4.2 milestone Aug 9, 2023
@ajreckof
Copy link
Member

Okay so it is not really freezing it is just taking way way way way way way too long. What is actually happening is that it is trying to find all possible way to match the query inside way too long options. Just to give an idea of how bad this becomes here the query is around 40 characters long and options are often 200-300 long. which means at some steps it can go up to 10000000 matches which slow down the whole process.
With that said I have a quick and easy fix that do make it quicker not really perfect but still usable it uses an altered version that gives more precedence to grouped by not looking further if the next character matches. Beware that this means the altered algorithm will take the first c in "MaincartoonCanvas" even for a queryy like "MainCanvas", this obviously mean it will rank differently option that show this behaviour . This is the worst case I could think of.

I made a quick PR there it runs smoothly even with OP really astronomical example (around a hundred or even more options with a size of around 300 for some).

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

Successfully merging a pull request may close this issue.

4 participants