Skip to content

delete: slow on NFS #2534

Open
Open

Description

@0-wiz-0

Setup (please complete the following information):

  • Distribution: pkgsrc
  • Distribution release: HEAD
  • Geeqie version 3.1

Describe the bug
I've just updated the package to 3.1.
Pressing 'delete' seems to delete a file - the preview of the file is replaced with the gray checkerboard
pattern. However, in previous versions (2.9) the deleted file was also removed from the file list in the directory
view on the left, and the next file in the list was displayed.

To reproduce
delete a file (in a directory with multiple files).

Expected behavior
see above

Screenshots
I can provide some but I hope the description is clear enough.

Image sources
any

Error logs or seg. fault files
no visible error

Additional context
That's on NetBSD 11.99.7/x86_64, but I was using 2.9 in the same environment, so it shouldn't matter, I hope.

Activity

  1. 0-wiz-0 commented on Aug 9, 2026

    @0-wiz-0
    ContributorAuthor

    Just went back to 2.9 (so same basic dependencies except for what changed between 2.9 and 3.1, i.e. gtk3 vs. gtk4) to confirm and yes, deletion is quick, the file is removed from the list and the next file is shown.

  2. 0-wiz-0 commented on Aug 12, 2026

    @0-wiz-0
    ContributorAuthor

    Another NetBSD users reports it works fine in his setup, so this might be limited to setups using VNC as display.

  3. przepompownia commented on Sep 15, 2026

    @przepompownia
  4. przepompownia commented on Sep 17, 2026

    @przepompownia
  5. przepompownia commented on Sep 17, 2026

    @przepompownia
  6. alfonx commented on Sep 26, 2026

    @alfonx
    Contributor

    @przepompownia's observation here (selection of 2+ files survives the deletion, 100% CPU) is the same loop as in #2569: the GPS map pane re-reads the metadata of the deleted files in an idle callback, which triggers NOTIFY_REREAD again and starves the file list refresh. #2641 fixes that.

    @0-wiz-0, if your setup also has the GPS map pane in the sidebar, #2641 will most likely fix your case too. If not, it may be a different cause. Thanks for Geeqie, everyone!

  7. 0-wiz-0 commented on Sep 26, 2026

    @0-wiz-0
    ContributorAuthor

    I don't have the libshumate dependency installed when building, so I think I see a different issue.

  8. przepompownia commented on Sep 26, 2026

    @przepompownia
  9. caclark commented on Oct 1, 2026

    @caclark
    Collaborator

    Is this fixed by 1492d3e ?

  10. 0-wiz-0 commented on Oct 4, 2026

    @0-wiz-0
    ContributorAuthor

    No, my slowdown is not related to that. I've tried git head and it was the same speed.

    The files are on NFS, the directory has > 1000 files of around 4-8MB each; deleting a file and showing the next one takes around 5 seconds each. I'm not sure if uses a trash on this file system; I don't think so, a .Trash-1000 directory exists at the mount point but the files in there are from 2025.

  11. 0-wiz-0 commented on Oct 5, 2026

    @0-wiz-0
    ContributorAuthor

    Reading the ktrace a bit, I think the slowdown is mostly because geeqie really likes to stat files.
    After the delete, it stats every file in the directory again; each of the stats takes around 1.5 ms (because the files are on NFS), so in total that's already 1.5 seconds. However, it not only does an stat, but also an lstat - for every file - so we're up to 3s for this alone.

    typical ktrace example for one of the files in the directory (in NetBSD kdump -e format, i.e. timestamp is column 4):

     10702  10702 geeqie   36.209131582 CALL  issetugid
     10702  10702 geeqie   36.209131662 RET   issetugid 0
     10702  10702 geeqie   36.209132263 CALL  __lstat50(0x72e6dd028b00,0x7f7fff83cc80)
     10702  10702 geeqie   36.209132534 NAMI  "/nfs/path/to/file/P9050339.JPG"
     10702  10702 geeqie   36.210750342 RET   __lstat50 0
     10702  10702 geeqie   36.210751103 CALL  issetugid
     10702  10702 geeqie   36.210751184 RET   issetugid 0
     10702  10702 geeqie   36.210751805 CALL  __stat50(0x72e6ecc82580,0x7f7fff83cf20)
     10702  10702 geeqie   36.210752145 NAMI  "/nfs/path/to/file/P9050339.JPG"
     10702  10702 geeqie   36.212379762 RET   __stat50 0
    
  12. changed the title [-]delete: removed file still in list[/-] [+]delete: slow on NFS[/+] on Oct 6, 2026
  13. 0-wiz-0 commented on Oct 6, 2026

    @0-wiz-0
    ContributorAuthor

    Here's some ideas how to make it faster.

    The first diff is a hack, it checks if the file name starts with a dot to decide if the file is "hidden" - but this gets rid of half of the stats - only one stat per file instead of two. Perhaps it gives you some idea how to speed this up?

    --- src/filedata/filelist.cc.orig       2026-10-06 09:05:47.683742736 +0000
    +++ src/filedata/filelist.cc
    @@ -164,13 +164,13 @@ gboolean FileData::FileList::read_list_real(const gcha
            while ((dir = readdir(dp)) != nullptr)
                    {
                    const gchar *name = dir->d_name;
    -               g_autofree gchar *filepath = g_build_filename(pathl, name, NULL);
    
    -               if (!options->file_filter.show_hidden_files && is_hidden_file(filepath))
    +               if (!options->file_filter.show_hidden_files && name[0] == '.')
                            {
                            continue;
                            }
    
    +               g_autofree gchar *filepath = g_build_filename(pathl, name, NULL);
                    struct stat ent_sbuf;
                    if (stat_func(filepath, &ent_sbuf) >= 0)
                            {
    

    The second diff (same file) updates the directory metadata after every refresh. This avoids that the regular file system monitor immediately re-checks the same directory after a file was deleted and its corresponding information in memory was already updated.

    So the second diff removes a hang of about ~3s shortly after every delete.

    --- src/filedata/filelist.cc.orig       2026-10-06 09:05:47.683742736 +0000
    +++ src/filedata/filelist.cc
    @@ -444,19 +444,37 @@ GList *FileData::FileList::sort(GList *list, SortSetti
            return g_list_sort_with_data(list, sort_file_cb, &settings);
     }
    
    +static void filelist_refresh_dir_fd(FileData *dir_fd)
    +{
    +       struct stat st;
    +       if (stat_utf8(dir_fd->path, &st))
    +               {
    +               dir_fd->size = st.st_size;
    +               dir_fd->date = st.st_mtime;
    +               dir_fd->cdate = st.st_ctime;
    +               dir_fd->mode = st.st_mode;
    +               }
    +}
    +
     gboolean FileData::FileList::read_list(FileData *dir_fd, GList **files, GList **dirs)
     {
    -       return read_list_real(dir_fd->path, files, dirs, TRUE);
    +       const gboolean ret = read_list_real(dir_fd->path, files, dirs, TRUE);
    +       if (ret) filelist_refresh_dir_fd(dir_fd);
    +       return ret;
     }
    
     gboolean FileData::FileList::read_list_lstat(FileData *dir_fd, GList **files, GList **dirs)
     {
    -       return read_list_real(dir_fd->path, files, dirs, FALSE);
    +       const gboolean ret = read_list_real(dir_fd->path, files, dirs, FALSE);
    +       if (ret) filelist_refresh_dir_fd(dir_fd);
    +       return ret;
     }
    
     gboolean FileData::FileList::read_list_lstat_all(FileData *dir_fd, GList **files, GList **dirs)
     {
    -       return read_list_real_all(dir_fd->path, files, dirs, FALSE);
    +       const gboolean ret = read_list_real_all(dir_fd->path, files, dirs, FALSE);
    +       if (ret) filelist_refresh_dir_fd(dir_fd);
    +       return ret;
     }
    
     void FileData::FileList::free_list(GList *list)
    

    Another idea (that is too big for me to implement) is to update the in-memory file list when a file is deleted directly - remove the file there too, instead of triggering a full rescan of the directory. That would save 3s again (if the directory state for the monitor is updated similar to what happens in the second diff) and be a big speedup.

  14. caclark commented on Oct 7, 2026

    @caclark
    Collaborator

    Which sort method do you have selected? Sorting on exif data will slow things down.

  15. 0-wiz-0 commented on Oct 7, 2026

    @0-wiz-0
    ContributorAuthor

    I have 'sort by name'.

  16. caclark commented on Oct 7, 2026

    @caclark
    Collaborator

    Is there a difference in speed between view-as-list and view-as-icon?

  17. 0-wiz-0 commented on Oct 7, 2026

    @0-wiz-0
    ContributorAuthor

    From my quick impression, view-as-icon is even slower.

  18. caclark commented on Oct 7, 2026

    @caclark
    Collaborator

    This is confusing.
    I see no difference in the relevant code between v2.9 and v3.x

    I set up a sub-dir with 1,000 40MB jpegs on a NFS drive.

    Deleting an image is instantaneous.

  19. 0-wiz-0 commented on Oct 7, 2026

    @0-wiz-0
    ContributorAuthor

    Sorry, I just tried again and it's slow with gtk3 too.

    Can you please look at the code paths I pointed out? They are based on what I found with the timings looking at ktrace here.
    geeqie does two stats per file after a delete, and that is just slow. Can these stats be reduced, please?

  20. caclark commented on Oct 7, 2026

    @caclark
    Collaborator

    Are you compiling from sources?

  21. 0-wiz-0 commented on Oct 7, 2026

    @0-wiz-0
    ContributorAuthor

    Yes, I'm one of the pkgsrc maintainers of geeqie and am currently using the 3.2 sources, with dependencies from pkgsrc, on NetBSD 11.99.9/x86_64.

  22. caclark commented on Oct 7, 2026

    @caclark
    Collaborator

    I am a bit reluctant to make a blind fix when I cannot see the problem.

    If you can make the edits you suggest to your system and verify that it solves the problem for you, I will check there are no adverse effects on my system - and if so, make the commit to the main repo.

  23. gdt commented on Oct 7, 2026

    @gdt
    Contributor

    I also am experiencing extreme slowness on NetBSD 11 with geeqie 3.2. I am building from pkgsrc. My images are on ZFS on ssd. Even in a directory with 14 images, after pagedown through all and clicking back to the top, I am finding pagedown very laggy. Sometimes it is perceptible, just, and sometimes it feels like a whole second. This is not deleting - this is just pageup/pagdown. It could be that what I'm seeing is different from what 0-wiz-0 is seing.

    My image files are jpg (earlier processed from raw), ranging from 140KB to 2.4MB. The biggest dimension is 2149 pixels. These are really not big files these days.

    I have no memory of this behavior with 2.9.

  24. 0-wiz-0 commented on Oct 7, 2026

    @0-wiz-0
    ContributorAuthor

    I'm guessing that you don't see it because your NFS implementation (Linux?) caches file attributes by default. Can you try turning that off? Reading the nfs man page I think that 'noac' or 'actimeo=0' might be relevant options for that.

  25. przepompownia commented on Oct 7, 2026

    @przepompownia
    Contributor

    Even in a directory with 14 images, after pagedown through all and clicking back to the top, I am finding pagedown very laggy. Sometimes it is perceptible, just, and sometimes it feels like a whole second. This is not deleting - this is just pageup/pagdown. It could be that what I'm seeing is different from what 0-wiz-0 is seing.

    Could this be suggesting that we need debouncing to avoid expensive operations of loading intermediate files too quickly when navigating forward or backward?

  26. gdt commented on Oct 7, 2026

    @gdt
    Contributor

    I have just been reading over ktrace from starting geeqie, watiting, pushing page down once, waiting, ^Q. At the time of pushing pagedown, there are a huge number (264) of NAMI invocations in the kernel (file name to inode translation, corresponding to some system call). Most of them look duplicative, and many don't make sense - moving to the next file should simply display that file, which would be open/read/close of it. or open/mmap/close. and it could be not that file, but the next one, if there's pre-caching.

    The system calls each seem pretty fast, but 10 us here, 50 us here, times a big number, plus whatever was really needed, seems to have added up to 300 ms.

    If you do this, with strace or whatever the "log system calls" tool is, do you see only system calls that make sense, or do you see a lot?

  27. caclark commented on Oct 7, 2026

    @caclark
    Collaborator

    b034e1f

    Might help. Might not.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions