Big dbus writes with a FD list fail
This issue arose from the investigation of gnome-builder#1116 (closed).
The bug is in https://gitlab.gnome.org/GNOME/glib/-/blob/master/gio/gdbusprivate.c
The underlying condition is: a very large DBus message with an FD list is being sent; the message is split into multiple writes due to EWOULDBLOCK, but the fd_list is not cleared after the first write. The code hits the path at line 1086, which causes a write error; the DBus connection is closed and the app goes down. (I lose my unsaved files and cry).
I think the fix is to clear the fd_list at line 1044, after the socket control message has been sent.
I would provide a patch but I am not sure of the ownership/memory management here. I suspect MessageToWriteData would need a ref to the fd_list, which can then be cleared after write, instead of reading off the DBusMessage directly, because GDBusMessages are immutable to be thread-safe.