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

Deleted files still appear on file list until view is refreshed #374

Closed
kriestof opened this issue Nov 16, 2023 · 26 comments · Fixed by #381
Closed

Deleted files still appear on file list until view is refreshed #374

kriestof opened this issue Nov 16, 2023 · 26 comments · Fixed by #381
Labels
bug Something isn't working waiting on op Waiting for more information from the original poster
Milestone

Comments

@kriestof
Copy link

kriestof commented Nov 16, 2023

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

Alacritty

Yazi version

0.1.5

Did you try the latest main branch to see if the problem has already been fixed?

Not tried, and I'll explain why below

Describe the bug

Sometimes while doing yank --cut/yank, paste, remove the file list does not seem to be properly updated. For instance I have executed remove command, but the file still appears on the list. Only after refreshing directory list (moving out and entering directory again) the list is updated.

Expected Behavior

Removed files should not appear any longer on file list. Pasted files should appear on file list.

To Reproduce

I don't have clear steps to reproduce this behavior, but I will try to be attentive and keep you updated. My guess is, this behavior may be connected to some unfinished task hanging. While this happened I: (1) opened multiple times helix from yazi or some files with xdg, (2) yanked files, cut, pasted or deleted, (3) created new directories.

Configuration

No response

Anything else?

No response

@kriestof kriestof added the bug Something isn't working label Nov 16, 2023
@kriestof
Copy link
Author

On feature list I see following in bugs:

Trigger Refresh manually when rename, create, in case notify-rs doesn't update in time

Maybe it's somehow connected? But I do not see relevant bug report.

@kriestof
Copy link
Author

kriestof commented Nov 18, 2023

Another update. While trying to remove a few larger files (50-200 MB) through Yazi my computer froze. I've got my nvme LED diode blinking on PC. It was reproducible - when I did it again after PC restart I had same freeze effect.

It has happened to me for the first time. No other issues like that with this drive before. However, it's too little to prove it's Yazi's fault. Hence, I'm not opening new issue for now. If anyone has similar problem please report.

I am on Linux Arch kernel 6.5.9-arch2-1.

@solvation
Copy link

I can confirm this issue.

Wayland on NixOS, kernel 6.6.x, tried different terminals (kitty, alacritty, foot), all show the same behaviour mentioned by the issue creator.

I do have the issue since 1.5, 1.4 was ok for me. At the moment I use master branch and its still reproducable.

After the problem is triggered, the yazi process stays above 100% in top. tasks_show inside yazi doesn't show any unfinished tasks. It never recovers from that state even if I keep running it for hours/days.

Its sort of reproducable for me by moving a bunch of files to a network folder with a large number of files. It doesnt seem to make a difference if its 10 000 or 300 000 and also there is no difference in mounting the network drive via smb or nfs protocol.

I still haven't figured out if its related to the folder being luks-encrypted and if it does matter if the share is local or networked. Have to do some more testing to hopefully further isolate the problem.

@kriestof
Copy link
Author

@solvation thanks for confirming. In my case disk is neither encrypted nor network mounted. Last time it happened to me after I made a few delete operations, but then I had a freeze so that was a bit different.

To add fs details I use btrfs.

@sxyazi
Copy link
Owner

sxyazi commented Nov 18, 2023

I've tried for a long time, but unfortunately, I couldn't reproduce it on my macOS and Linux (Kernel 6.1.12).

I attempted to copy 10 video files of ~500MB each to both my internal SSD(APFS) and external USB(ExFAT). The CPU fluctuated between 0.4% to 2.2%, and there were no issues with freezing. The file list refreshed correctly.

Then I tried copying a directory containing 4992 small files totaling 1.68GB. The CPU fluctuated between 3.6% to 6.4%, and it performed normally.

The entire test was conducted using the latest main branch code. I'm unsure how to pinpoint this problem.

Would it be possible to provide a screen recording of your steps? Also please try reducing the concurrent tasks to 1 to see what would happen:

micro_workers = 5
macro_workers = 10
bizarre_retry = 5

@sxyazi
Copy link
Owner

sxyazi commented Nov 18, 2023

On feature list I see following in bugs:

Trigger Refresh manually when rename, create, in case notify-rs doesn't update in time

Maybe it's somehow connected? But I do not see relevant bug report.

It has been addressed in the "feat: better file hover state" PR, so it's unrelated.

@kriestof
Copy link
Author

Please note there may be two separate bugs (problem with listing and freezing). I've isolated one issue which I found a way to reproduce. Still, the issue with proper list refresh may be unrelated.

@solvation
Copy link

I tried to debug it a bit with gdb and found out 2 things:

  1. changing workers and retry all to 1 doesnt prevent the "listing no longer updating" bug for me.

  2. when the bug is triggered yazi starts generating these messages (and never stops) inside gdb without me doing anything in the program. That seem to cause the load the yazi process shows in that state in top. In the "normal" state where the refresh is still working it only generates and kills threads when I do "something" like changing previews p.e.
    But haven't yet found a reliable way to reproduce it though.

image

@kriestof
Copy link
Author

Ok, found a way to isolate the not refreshing list issue as well. This also seems to be connected with Ueberzug.

  1. You need a folder with sufficient amount of photos. It worked for me with a directory with around 40, but not with 3 photos.
  2. Enter this directory
  3. Move out of the dir with photos and try to remove directory

The directory won't be removed until you move out of that parent directory and in again. Then when you try to operate on other files/dirs you could notice similar problems with refreshing.

@solvation
Copy link

image

I got yazi in this "not updating view" state again and stopped it in the debugger. Thats the stack trace I managed to get. Not sure how helpfull that is without debug symbols.

@sxyazi
Copy link
Owner

sxyazi commented Nov 19, 2023

Hi @solvation, the creator of this issue has split it into two separate problems. Let me know which problem you are currently experiencing, or them both?

@sxyazi
Copy link
Owner

sxyazi commented Nov 19, 2023

Ok, found a way to isolate the not refreshing list issue as well. This also seems to be connected with Ueberzug.

  1. You need a folder with sufficient amount of photos. It worked for me with a directory with around 40, but not with 3 photos.
  2. Enter this directory
  3. Move out of the dir with photos and try to remove directory

The directory won't be removed until you move out of that parent directory and in again. Then when you try to operate on other files/dirs you could notice similar problems with refreshing.

Would the issue exist without Ueberzug? i.e. using a terminal that supports displaying images by itself, and uninstalling Ueberzug.

@sxyazi
Copy link
Owner

sxyazi commented Nov 19, 2023

I just tried another attempt following the steps above, sadly I still couldn't reproduce it...

CleanShot.2.mp4

@solvation
Copy link

Hi @solvation, the creator of this issue has split it into two separate problems. Let me know which problem you are currently experiencing, or them both?

Hi, thanks for your time!
Sorry I didn't clarify enough:
I only experience the "view is not updating" issue on deleting or moving files. I have to manually move out and back into the folder see the change. For moving that means that both, source and destination, are no longer automatically updated. Also if for example my home folder is open in yazi and I copy something via terminal, the contents of the folder is also no longer updated. Everything else p.e. file previews work fine as far as I can tell.
As a terminal I use kitty on wayland for all yazi stuff but tested foot also trying to narrow down the error while avoiding uberzug. But no difference there.

I'll try to get a working screen capture of the issue as you suggested but have to do some setup for that first.

@solvation
Copy link

solvation commented Nov 19, 2023

Example 1: deleting all files in a folder but one ->

deleteHB.mp4

Example 2: cutting all files in test1 and pasting them into test2 ->

movingHB.mp4

@sxyazi
Copy link
Owner

sxyazi commented Nov 19, 2023

Example 1: deleting all files in a folder but one -> https://file.io/O4JenS2wwUxS

Example 2: cutting all files in test1 and pasting them into test2 -> https://file.io/8QmYmlgJifEN

I can't download both files, "The transfer you requested has been deleted."

CleanShot

@kriestof
Copy link
Author

kriestof commented Nov 19, 2023

Would the issue exist without Ueberzug? i.e. using a terminal that supports displaying images by itself, and uninstalling Ueberzug.

Yep, I can confirm this issue exists as well on kitty while ueberzugpp uninstalled. I've tried Wayland/X11.

However, I've been playing a bit more with that issue. On the main branch from git I can also experience this bug, but it's much more difficult to reproduce it (than with 0.1.5 version) and my simple steps given above may not work so well.

Right now SOMETIMES when I'm moving through the list of photos and then I try to delete a photo the view is not refreshed. Although, it's kind of race condition, sometimes it happens, but not always. Probably I can't give very clear steps for reproducing. I just give a video so you will have an idea of what I'm talking about.

output1.mp4

@kriestof
Copy link
Author

Funny enough. I've discovered this bug appears even without ueberzug working on alacritty. Hence, maybe it's even not connected to preview. And actually this pattern I've shown on the movie is quite reproducible.

  1. Just go to dir, move around
  2. Move out delete dir
  3. Recreate with original files
  4. Try to delete something inside

@solvation
Copy link

I still have it running in that "not updating the view" state in the debugger and single stepped.
image

After the last "step", it keeps "detaching from vfork ..." forever until I stop it.

In contrast, until yazi gets into that state debugger output looks like this:

image

Here first I deleted 2 files, everything works perfectly. In the debugger it just waits for next user interaction and doesnt detach form anything ;-)

@sxyazi
Copy link
Owner

sxyazi commented Nov 20, 2023

Hi I made a PR to fix it, #381, let me know if it works for you!

pr-381.mp4

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Nov 20, 2023
@solvation
Copy link

Not the OP but I just checked your PR with
nix run github:sxyazi/yazi/pr-7e6a61e7

  • I hope I picked the correct one.

Sorry to say but I can still reproduce the problem on my machine though.

I managed to debug a little bit further and it seems that, once yazi gets in that "bad state" where it doesnt properly refresh, it keeps creating [file] processes and immedeatly kills them. Even if I dont do anything in yazi and I'm p.e. in an empty dir where absolutly nothing should be "to do" for it.

@sxyazi
Copy link
Owner

sxyazi commented Nov 20, 2023

Thanks for your feedback @solvation.

It's possible that your issue is different from the OP, or it might be that this PR isn't effective at all. I'll wait a bit for the OP.

@kriestof
Copy link
Author

kriestof commented Nov 20, 2023

Yeah, plenty of changes in this PR. Great job! I've been trying this PR for a while and I don't experience issues mentioned in this ticket. If anything changes I'll get back to it.

PS. There are some second order issues. As this is development branch I am not creating new tickets.

  • I see yazi can estimate dir size which is great, unfortunately it's not updated when files are deleted
  • Sometimes when I enter a directory I see after ~200ms some kind of reordering of the list
  • I cannot use search on help widget
  • Some move/delete operations are hanging. I cannot give steps to reproduce at the moment.

@sxyazi
Copy link
Owner

sxyazi commented Nov 20, 2023

Thank you for testing; glad to see the issue has been addressed. I'll merge this PR now!

I see yazi can estimate dir size which is great, unfortunately it's not updated when files are deleted

This is intentional. Evaluating directory size is a time-consuming operation involving a large amount of I/O operations.

Ideally, watching all file changes within a directory recursively (not just deletions, but also creations and modifications that affect directory size) would be preferred.

However, this isn't an efficient approach. For performance and stability reasons, Yazi limits watching to a depth of 2 levels (having too many levels would exceed the file descriptor limit).

Another method is to allow users to manually refresh the size by pressing a key, but this would be an enhancement, not a bug.

Sometimes when I enter a directory I see after ~200ms some kind of reordering of the list

I need more reproducible details. Would you like to file an issue for it?

I cannot use search on help widget

This is a known bug and should be fixed soon.

Some move/delete operations are hanging. I cannot give steps to reproduce at the moment.

I haven't encountered this issue yet, I'll pay attention and observe. If you find any clues to reproduce it, please create an issue so I can further investigate!


Hey @solvation, it seems like you're experiencing a different issue from the OP. Would you like to file a separate issue for it?

@sxyazi
Copy link
Owner

sxyazi commented Nov 21, 2023

I cannot use search on help widget

This is a known bug and should be fixed soon.

Done! Fixed in #382

@sxyazi sxyazi added this to the v0.1.6 milestone Nov 23, 2023
Copy link

I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working waiting on op Waiting for more information from the original poster
Projects
None yet
3 participants