Searching in 'Run Everything' locks up Enlightenment, process at 100% CPU usage #20

Closed
opened 2022-10-01 11:59:11 -07:00 by rennod · 14 comments

Typing to search in the 'Run Everything' menu locks up the complete desktop, I have to kill the main Enlightenment process from another tty to get out of it. Said process is at 100% CPU usage after triggering the bug.

I tried to start over with a new, fresh .e profile, still happens. Bit unsure how to find out what the process is doing with gdb...

Up to date Arch builds, so Enlightenment 0.25.4 and EFL 1.26.3. I'm just starting Enlightenment with startx, but it also happens in Wayland.

Typing to search in the 'Run Everything' menu locks up the complete desktop, I have to kill the main Enlightenment process from another tty to get out of it. Said process is at 100% CPU usage after triggering the bug. I tried to start over with a new, fresh .e profile, still happens. Bit unsure how to find out what the process is doing with gdb... Up to date Arch builds, so Enlightenment 0.25.4 and EFL 1.26.3. I'm just starting Enlightenment with startx, but it also happens in Wayland.
Owner

i don't see it here... well on git - i backported various fixes from git master. does git master work (try install the efl-git and enlightenment-git aur's). i want to know if its a fix already in git master but somehow not in stable or it's something specific to you?

i don't see it here... well on git - i backported various fixes from git master. does git master work (try install the efl-git and enlightenment-git aur's). i want to know if its a fix already in git master but somehow not in stable or it's something specific to you?
raster self-assigned this 2022-10-03 10:07:54 -07:00
Author

Build both efl-git and enlightenment-git, no change. Still locks up, process sits at 100% CPU.

Build both efl-git and enlightenment-git, no change. Still locks up, process sits at 100% CPU.
Author

So i looked a bit at the .e-log.log output and after a few tries reproducing the issue the only relevant log message seems to be

WD: Enlightenment main loop hung. No response to ping for 10sec
So i looked a bit at the .e-log.log output and after a few tries reproducing the issue the only relevant log message seems to be ``` WD: Enlightenment main loop hung. No response to ping for 10sec ```
Owner

ooook - the watchdog found a mainloop lockup. can you get a backtrace with symbols?

https://www.enlightenment.org/contrib/enlightenment_debugging

also see efl debugging. i need to know where it hangs.

ooook - the watchdog found a mainloop lockup. can you get a backtrace with symbols? https://www.enlightenment.org/contrib/enlightenment_debugging also see efl debugging. i need to know where it hangs.
Author

Bit tricky, the process seems to get restarted after some time. I'm not sure how much sense the bt makes. I did one of all threads too.

Bit tricky, the process seems to get restarted after some time. I'm not sure how much sense the bt makes. I did one of all threads too.
17 KiB
Owner

the watchdog will restart e after a bit if a complete mainloop lockup is detected. evry_fuzzy_match() seems to be the problem... this loop here:

              /* go to next word */
              for (; (p[0] && (s_len - (p - str) >= (unsigned int)ii)) &&
                   !((isspace(*p) || (ip && ispunct(*p))));
                   p += ii)
                {
                   if (!_evry_utf8_next(p, &ii)) break;
                }

i can only imagine ii stops goinng up0 - it's not advancing... for some reason. why? what sgtrng is it looking at? what is it not advancing on (what char)?

the watchdog will restart e after a bit if a complete mainloop lockup is detected. evry_fuzzy_match() seems to be the problem... this loop here: /* go to next word */ for (; (p[0] && (s_len - (p - str) >= (unsigned int)ii)) && !((isspace(*p) || (ip && ispunct(*p)))); p += ii) { if (!_evry_utf8_next(p, &ii)) break; } i can only imagine ii stops goinng up0 - it's not advancing... for some reason. why? what sgtrng is it looking at? what is it not advancing on (what char)?
Owner

can you try this patch in e?

diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c
index 7817c7ff6..7daf50412 100644
--- a/src/modules/everything/evry_util.c
+++ b/src/modules/everything/evry_util.c
@@ -52,8 +52,9 @@ evry_util_file_detail_set(Evry_Item_File *file)
 static inline Eina_Unicode
 _evry_utf8_next(const char *buf, int *iindex)
 {
+   int pidx = *iindex;
    Eina_Unicode u = eina_unicode_utf8_next_get(buf, iindex);
-   if ((!u) || ((u >= 0xdc80) && (u <= 0xdcff))) return 0;
+   if ((!u) || ((u >= 0xdc80) && (u <= 0xdcff)) || (pidx != *iindex)) return 0;
    return u;
 }
can you try this patch in e? ``` diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c index 7817c7ff6..7daf50412 100644 --- a/src/modules/everything/evry_util.c +++ b/src/modules/everything/evry_util.c @@ -52,8 +52,9 @@ evry_util_file_detail_set(Evry_Item_File *file) static inline Eina_Unicode _evry_utf8_next(const char *buf, int *iindex) { + int pidx = *iindex; Eina_Unicode u = eina_unicode_utf8_next_get(buf, iindex); - if ((!u) || ((u >= 0xdc80) && (u <= 0xdcff))) return 0; + if ((!u) || ((u >= 0xdc80) && (u <= 0xdcff)) || (pidx != *iindex)) return 0; return u; } ```
Author

So applied that on top of current git, same symptoms, new bt, different place...

So applied that on top of current git, same symptoms, new bt, different place...
31 KiB
Owner

hmm maybe it was not that loop? maybe its always in

while ((m_cnt < m_num) && (*next != 0))
  {
...
  }

if its always some line within this loop (line 107 -> 243) is it always stuck in this range somewhere?

hmm maybe it was not that loop? maybe its always in while ((m_cnt < m_num) && (*next != 0)) { ... } if its always some line within this loop (line 107 -> 243) is it always stuck in this range somewhere?
Author

It looks like it's always within that range.

It looks like it's always within that range.
Owner

hmm well i'd need to know more like what is m_cnt and m_num? what is next and *next?

hmm well i'd need to know more like what is m_cnt and m_num? what is next and *next?
Author

I did some printf debugging. Attached is part of the log, it indeed starts looping here forever.

I did some printf debugging. Attached is part of the log, it indeed starts looping here forever.
Contributor

Hi,

I think I have a similar issue on my system and I investigated it a bit. I have a file in my home directory whose name is Readme \366ffnen which is encoded in the Windows-1252 character set (366 oct = 246 dec = "ö" (German umlaut)) probably because it was installed via Wine ages ago. The everything module will enter an infinite loop in evry_fuzzy_match() when starting a search because of this file name. Here's a minimal repro case which will cause the infinite loop:

evry_fuzzy_match("\366", "a");

It seems that the issue was introduced by commit fd26c7b224 because if I apply the patch below, which reverts a part of that commit, evry_fuzzy_match() no longer runs into an infinite loop with the repro case inputs:

diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c
index 7817c7ff6..5f733f5fd 100644
--- a/src/modules/everything/evry_util.c
+++ b/src/modules/everything/evry_util.c
@@ -220,7 +220,7 @@ evry_fuzzy_match(const char *str, const char *match)
                        !((isspace(*p) || (ip && ispunct(*p))));
                        p += ii)
                     {
-                       if (!_evry_utf8_next(p, &ii)) break;
+                       if (!eina_unicode_utf8_next_get(p, &ii)) break;
                     }
                   ii = 0;
                   for (; (p[0] && (s_len - (p - str) >= (unsigned int)ii)) &&

Not sure if this a correct fix for this issue though.

Hi, I think I have a similar issue on my system and I investigated it a bit. I have a file in my home directory whose name is `Readme \366ffnen` which is encoded in the Windows-1252 character set (366 oct = 246 dec = "ö" (German umlaut)) probably because it was installed via Wine ages ago. The everything module will enter an infinite loop in `evry_fuzzy_match()` when starting a search because of this file name. Here's a minimal repro case which will cause the infinite loop: `evry_fuzzy_match("\366", "a");` It seems that the issue was introduced by commit fd26c7b224e1010df8e4b24d174818b2add39b0b because if I apply the patch below, which reverts a part of that commit, `evry_fuzzy_match()` no longer runs into an infinite loop with the repro case inputs: ``` diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c index 7817c7ff6..5f733f5fd 100644 --- a/src/modules/everything/evry_util.c +++ b/src/modules/everything/evry_util.c @@ -220,7 +220,7 @@ evry_fuzzy_match(const char *str, const char *match) !((isspace(*p) || (ip && ispunct(*p)))); p += ii) { - if (!_evry_utf8_next(p, &ii)) break; + if (!eina_unicode_utf8_next_get(p, &ii)) break; } ii = 0; for (; (p[0] && (s_len - (p - str) >= (unsigned int)ii)) && ``` Not sure if this a correct fix for this issue though.
Owner

:) thanks! now i know what caused it! :)

:) thanks! now i know what caused it! :)
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: enlightenment/enlightenment#20
No description provided.