https://bugs.kde.org/show_bug.cgi?id=474231

            Bug ID: 474231
           Summary: "Too many open files" when trying to update a large
                    number of refs
    Classification: Applications
           Product: Discover
           Version: 5.27.5
          Platform: Archlinux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Flatpak Backend
          Assignee: plasma-b...@kde.org
          Reporter: be...@igalia.com
                CC: aleix...@kde.org, jgrul...@redhat.com,
                    trav...@redhat.com
  Target Milestone: ---

STEPS TO REPRODUCE
1. Have a Flatpak installation with ~50 pending updates
2. Open Discover, select "Update" and click "Update all"

OBSERVED RESULT
The application crashes. The exact stack trace and journal messages are
different each time, but they are all variations of "Too many open files":

plasma-discover[3235]: Creating pipes for GWakeup: Too many open files
plasma-discover[4090]: Error spawning revokefs-fuse: Too many open files
plasma-discover[3518]: Cannot create repo on revokefs mountpoint
/var/tmp/flatpak-cache-T1LSA2/org.gnome.Platform.Locale-SQUKA2: opening repo:
While checking parent repository '/var/lib/flatpak/repo': opening repo:
opendir(tmp): Too many open files

There is also a large number of /usr/lib/revokefs-fuse processes running.

EXPECTED RESULT
All refs are updated correctly.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.107.0
Qt Version: 5.19.5

ADDITIONAL INFORMATION
Having a look at the discover Flatpak backend I see that
FlatpakBackend::installApplication() is called in a loop for every application
that needs to be updated:

https://invent.kde.org/plasma/discover/-/blob/v5.27.5/libdiscover/resources/StandardBackendUpdater.cpp?ref_type=tags#L65

Each one of these creates a new FlatpakJobTransaction, each with its own
FlatpakTransactionThread which in turn has its own FlatpakTransaction object:

https://invent.kde.org/plasma/discover/-/blob/v5.27.5/libdiscover/backends/FlatpakBackend/FlatpakTransactionThread.cpp?ref_type=tags#L101

In other words, instead of creating one FlatpakTransaction and putting all refs
in it it creates one transaction per ref and (as far as I can see) runs them
all in parallel. I haven't confirmed it yet but I suspect that the problem is
related to this.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to