GNOME Bugzilla – Bug 656682
Empathy exits due to problem in the main loop exits with "Too many open files"
Last modified: 2011-08-26 09:12:51 UTC
Running master Empathy dies with this every once in a while: GLib-ERROR **: Cannot create eventfd for main loop wake-up: Too many open files Program received signal SIGTRAP, Trace/breakpoint trap. g_logv (log_domain=0x35518aec46 "GLib", log_level=<optimized out>, format= 0x35518b54c0 "Cannot create eventfd for main loop wake-up: %s", args1=0x7fffffffd508) at gmessages.c:559
+ Trace 228106
Interesting, I guess we leak fd somewhere. Could you please use strace or a similar tool to check what are those files?
I managed to reproduce this. I had 1000 avatar files opened.
I really suspect this has been introduced by Folks's cache backend. We didn't change any avatar related code in Empathy or tp-glib. Can you please double check if folks isn't leaking any fd?
(In reply to comment #3) > I really suspect this has been introduced by Folks's cache backend. We didn't > change any avatar related code in Empathy or tp-glib. Can you please double > check if folks isn't leaking any fd? It could also be this code, though I can't see any way it could leak an fd. (It doesn't explicitly close the input stream, but GInputStream is supposed to close its FD when it's finalised, so that should be OK…unless we're leaking the input stream.) http://git.gnome.org/browse/empathy/commit/?id=3a9a3210bbf8e927ef64510d066c035aa60a8a50
Turns out it was that code, though the leak wasn't entirely our fault. See bug #657206 for the problem in GIO which caused it. I've worked around it in Empathy by explicitly closing the input stream, so at the worst we'll just leak the input stream object rather than its FD. commit 57075092737c287010e1a2435bf1b1c1839101a5 Author: Philip Withnall <philip@tecnocode.co.uk> Date: Tue Aug 23 23:42:52 2011 +0100 libempathy-gtk: Explicitly close the input stream used for reading avatars Due to a missing unref in GIO, the input stream is leaked by GFileIcon, so if we rely on its FD being implicitly closed when the stream is finalised, we'll end up leaking (lots of) file descriptors. As well as fixing the unref in GIO (see: bgo#657206), we now explicitly close the input stream so that even if the stream object is leaked, the FD isn't. Closes: bgo#656682 libempathy-gtk/empathy-ui-utils.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
Running master I am still getting this: GLib-ERROR **: Cannot create eventfd for main loop wake-up: Too many open files Program received signal SIGTRAP, Trace/breakpoint trap. g_logv (log_domain=0x33a7caec46 "GLib", log_level=<optimized out>, format=0x33a7cb54c0 "Cannot create eventfd for main loop wake-up: %s", args1=0x7fffffffd528) at gmessages.c:559 559 g_private_set (g_log_depth, GUINT_TO_POINTER (depth)); (gdb) bt
+ Trace 228201
Pre-crashing messages: [Thread 0x7fffdadf0700 (LWP 9527) exited] [New Thread 0x7fffdadf0700 (LWP 14290)] I/O error : Too many open files I/O error : Too many open files
And yes, I still have a zillion avatar files open: ls -lah /proc/EMPATHY_PID/fd/ total 0 dr-x------ 2 rgs rgs 0 Aug 25 18:56 . dr-xr-xr-x 8 rgs rgs 0 Aug 25 18:37 .. lrwx------ 1 rgs rgs 64 Aug 25 18:56 0 -> /dev/pts/4 lrwx------ 1 rgs rgs 64 Aug 25 18:56 1 -> /dev/pts/4 lrwx------ 1 rgs rgs 64 Aug 25 18:56 10 -> socket:[179554523] lr-x------ 1 rgs rgs 64 Aug 25 18:56 100 -> /debian/rgs/.cache/telepathy/avatars/butterfly/msn/f70cfdffa9008de13f85015d24ba052d287a0dfd lr-x------ 1 rgs rgs 64 Aug 25 22:43 1000 -> /debian/rgs/.cache/telepathy/avatars/gabble/jabber/_37755b577f0fae920651bb27362924b6792ad24fd lr-x------ 1 rgs rgs 64 Aug 25 22:43 1001 -> /debian/rgs/.cache/telepathy/avatars/gabble/jabber/_393cdac4409b8c598c1df2fc45575e502b5b77e92 lr-x------ 1 rgs rgs 64 Aug 25 22:43 1002 -> /debian/rgs/.cache/telepathy/avatars/gabble/jabber/ac0e051c346dda727d8dc1fc8d34e0ab9aa79043 .. ls -lah /proc/EMPATHY_PID/fd/ | grep avatars | wc -l 999
I was actually running empathy without the needed patch - with Philip's patch life is good again. Sorry for the noise.