[F39] xdg-desktop-portal-gnome takes a lot of memory when using FileChooser dialog and may trigger OOM Killer

Problem

When using often FileChooser dialog repeatedly xdg-desktop-portal-gnome takes a lot of memory( VRAM memory leak).
It can take several gigs very quickly


Open a browser (Brave or Chrome) and then try to save pictures or other documents from the page displayed - no actual saving is required / just getting the dialog window is sufficient to cause the memory increase . After 6 additional triggering of FileChooser dialog ;

Process is therefore sometimes killed by OOM killer :

janv. 11 10:44:50 faithnomore kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gnome.service,task=xdg-desktop-por,pid=659367,uid=1000
janv. 11 10:44:50 faithnomore systemd[658535]: xdg-desktop-portal-gnome.service: A process of this unit has been killed by the OOM killer.
janv. 11 10:44:51 faithnomore systemd[658535]: xdg-desktop-portal-gnome.service: Failed with result 'oom-kill'.
janv. 21 08:25:37 faithnomore kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gnome.service,task=xdg-desktop-por,pid=1484702,uid=1000
févr. 02 07:14:16 faithnomore kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gnome.service,task=xdg-desktop-por,pid=2980,uid=1000
févr. 02 07:14:16 faithnomore systemd[2034]: xdg-desktop-portal-gnome.service: A process of this unit has been killed by the OOM killer.
févr. 02 07:14:16 faithnomore systemd[2034]: xdg-desktop-portal-gnome.service: Failed with result 'oom-kill'.


Cause

Memory leak issue;


Not yet known.

Related Issues

https://www.reddit.com/r/gnome/comments/18ku5lt/warning_xdgdesktopportalgnome_has_a_huge_vram/?rdt=55894

Screenshot and FileChooser portals leak memory (#91) · Issues · GNOME / xdg-desktop-portal-gnome · GitLab mentions :
" The PR was merged. Right now I can’t reproduce the huge leaks you found but some smaller one were fixed.
Note that the file chooser in Gtk 4 leaks internally and I believe it was fixed in a recent commit for 4.13.x"
Fix commit is : Fix some memory leaks (!132) · Merge requests · GNOME / xdg-desktop-portal-gnome · GitLab

Workarounds

Restart xdg-desktop-portal-gnome

Thanks for your report. I haven’t seen any other complains about this and and memory leak doesn’t seem to be too severe in most cases (I think I can reproduce a 2MB increase for each file save dialog opened, but not more), so I don’t think we need to have it placed in Common Issues at this moment. I’ll move it to Ask Fedora so that this topic stays accessible and people can continue commenting on it.

From Proposed Common Issues to Ask Fedora

Thanks Kamil for your feedback. Which browser did you use ? With Brave I can notice 20MB increase per FileChooser usage.
Tonight I went from 200M usage to 429M (so the double) just by saving less than 10 files.
289M - 310M - 326M - 346M - 366M - 385M - 409M - 429M
I hope the fix will be included in F40 - it appears so looking at Fix some memory leaks (!132) · Merge requests · GNOME / xdg-desktop-portal-gnome · GitLab

I tested in Firefox (no memory leak) and Chromium (from Flathub, 2MB memory leak).

Can you try F40 Beta? Download here, toggle “Show Beta downloads”:

You can just boot the Live image, no need to install it. In the Live environment, install your preferred browser and test it. Thanks!

Thanks Kamil. I will try F40 beta later today.
So far on my F39 SilverBlue system I tried :

  • Chrome : 8 to 10Mb increase for each file saved
  • Thorium (Chromium based) : around 20Mb increase for each file saved
  • Firefox : no increase as it does not use xdg-desktop-portal-gnome if memory serves me right

Just tried the F40 beta ISO Fedora-WS-Live-40_B-1-10 (live ISO). Issue is not yet fixed / is still around : 2Mb memory increase for each file saved.

Thanks for testing, I can confirm it. I’ve updated the upstream ticket.

1 Like