Ckath / fuf

Fairly Usable cli Filebrowser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

corruption of ui and segfaults while scrolling rapidly

Ckath opened this issue · comments

commented

image
possibly related to #3, though it also happens when loading is well and done. it seems most reproducible when scrolling over audio files(using mediainfo without exiftool) but can also happen at random. sometimes its fixable with an R, other times the entire terminal requires a restart. this might be related to the shoddily implemented ext_kill:

fuf/ext/sysext.c

Lines 13 to 31 in 2f9e773

void
ext_kill(pid_t pid, int sig)
{
FILE *f;
char proc_path[256];
while(pid) {
sprintf(proc_path, "/proc/%d/task/%d/children", pid, pid);
if (!(f = fopen(proc_path, "r"))) {
kill(pid, sig);
break;
}
pid_t child_pid;
fscanf(f, "%d", &child_pid);
fclose(f);
kill(pid, sig);
pid = child_pid;
}
}

which might conflict with some programs the preview script runs, will need further looking into to find the actual cause of this happening. another possibility is the threading model(killing and joining threads rapidly) is too stupid to work.

commented

extending this issue to also include the random segfaults which are probably related, the following things cause segfaults at random:

  • opening a directory
  • going back a directory
  • scrolling fast
  • scrolling slow
  • breathing
commented

possible fix in cbdf2f1, stop preview and refresh from executing at the same time, which might be corrupting the ncurses buffer

commented

great progress has been made rewriting the way the preview thread is handled in e351c9f, assuming lack of thread safety and improper managing of threads is the main cause of all these issues, load_items will be rewritten in similar fashion.
furthermore a seperate ext lib will be made wrapping ncurses functions in their own mutex to avoid ruining its window buffer

commented

the current corruptionfixing branch as of da1978b is looking very promising, I debugged further after the threading rework and without all the hanging due to threads there were a lot of lstat hangs on my nfs shares so I moved everything to inmemory item array. I cant notice a huge increase in memory usage even with 80K item dirs, and this means I no longer have to stat each selected item, this only happens once during loading now.

hopefully after some further use and merging it it will mostly fix this issue

commented

initial testing indicates the bulk of this is fixed as of d7a48d4, after the other small related bugs are fixed a patchset will be released