xdg-desktop-portal-gtk
xdg-desktop-portal-gtk copied to clipboard
Gtk portal has excessive resident memory usage
I found it using in excess of 100MiB of resident memory. For a glue application that is intended to expose a couple dbus endpoints and show file access dialogs, 100M seems quite a lot.
After restarting it drops down to 8.2MiB which is still quite a lot, but palatable.
Advise on what to look into the next time I find the portal consuming significant memory would be great.
So, I kept an eye on this and have found that the memory use grows slowly, over time.
I have also found that the leak(?) occurs when the portal implementation keeps looping doing following syscalls (this looping kind of behaviour occurs sporadically, I don't know what triggers it yet, seems to happen very arbitrarily)
...
sendmsg(14, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\23\0\0\0\0\0\30\0\252\4\10\0\30\0\0\0\4\0\0\0\3\0\0\0\30\0\0\0\1\0\24\0"..., iov_len=88}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 88
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 3, 16) = 1 ([{fd=14, revents=POLLIN}])
recvmsg(14, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="I\0\0\0\0\0\10\0", iov_len=3120}, {iov_base="", iov_len=976}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 8
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 3, 15) = 0 (Timeout)
sendmsg(14, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\23\0\0\0\0\0\30\0\252\4\10\0\30\0\0\0\4\0\0\0\3\0\0\0\30\0\0\0\1\0\24\0"..., iov_len=88}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 88
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 3, 16) = 1 ([{fd=14, revents=POLLIN}])
recvmsg(14, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base=">\0\0\0\0\0\10\0", iov_len=3112}, {iov_base="", iov_len=984}], msg_iovlen=2, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_DONTWAIT|MSG_CMSG_CLOEXEC) = 8
poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 3, 15) = 0 (Timeout)
sendmsg(14, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\23\0\0\0\0\0\30\0\252\4\10\0\30\0\0\0\4\0\0\0\3\0\0\0\30\0\0\0\1\0\24\0"..., iov_len=88}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 88
...
I'm not sure whom the portal is sending messages to or whom it is receiving them from, but it would continue even after I quit all of the applications, so I presume its sending stuff from itself to itself or something similar. There is no traffic on the session dbus when this is happening.
https://share.firefox.dev/3JATha3 is a profile I grabbed of the process during this sendmsg/recvmsg spam but it doesn't seem super revealing.