GNOME Bugzilla – Bug 121170
Slow file handle leak
Last modified: 2004-12-22 21:47:04 UTC
I wondered where all my file handles were going after updating to Red Hat rawhide. On this I see gweather uses a lot of file handles initially (it has some 35 open and four threads). It also adds one handle per refresh it does (trigger a reload with the menu you'll see the same)
I saw the same behavior with my GNOME CVS installation (upon seeing this bug report, I decided to test it out). Note that, for some reason, the weather wasn't coming up at the time (I guess the main server was down or something?). However, my installation was somewhat old, so I decided to compile the most recent gnome-applet module from CVS. Once I was able to do that, it appears that the weather was able to appear (main server came back up?). At that point, I was no longer able to reproduce this bug. I don't know if this bug is a "This has been fixed in newer versions" or a "There's a file leak when the weather can't be obtained." I'm just going to update the report and add the bugsquad keyword and let someone else figure it out.
Alan: which version of gnome-applets is used in rawhide?
2.3.7-1 is the current version.
From valgrind I see the following leaks reported: ==18596== 400 bytes in 35 blocks are definitely lost in loss record 114 of 195 ==18596== at 0x400128C6: calloc (vg_replace_malloc.c:273) ==18596== by 0x8F094E: g_malloc0 (in /usr/lib/libglib-2.0.so.0.200.3) ==18596== by 0x9743EF: gnome_vfs_socket_new (in /usr/lib/libgnomevfs-2.so.0.3 00.90) ==18596== by 0x9616F8: gnome_vfs_inet_connection_to_socket (in /usr/lib/libgn omevfs-2.so.0.300.90) ==18596== by 0x43847CEC: (within /usr/lib/gnome-vfs-2.0/modules/libhttp.so) ==18596== by 0x43847FE5: (within /usr/lib/gnome-vfs-2.0/modules/libhttp.so) ==18596== by 0x4384834E: (within /usr/lib/gnome-vfs-2.0/modules/libhttp.so) ==18596== by 0x95BD6B: gnome_vfs_open_uri_cancellable (in /usr/lib/libgnomevf s-2.so.0.300.90) ==18596== by 0x963BD7: (within /usr/lib/libgnomevfs-2.so.0.300.90) ==18596== by 0x964AA8: _gnome_vfs_job_execute (in /usr/lib/libgnomevfs-2.so.0 .300.90) ==18596== by 0x9623C8: (within /usr/lib/libgnomevfs-2.so.0.300.90) ==18596== by 0x9748BD: (within /usr/lib/libgnomevfs-2.so.0.300.90) ==18596== by 0x9028F0: (within /usr/lib/libglib-2.0.so.0.200.3) ==18596== by 0x4023F571: thread_wrapper (vg_libpthread.c:667) ==18596== by 0x4015CF04: do__quit (vg_scheduler.c:2146) ==18596== This one I haven't taken a shot at fixing yet. And: ==18596== 746 bytes in 75 blocks are definitely lost in loss record 132 of 195 ==18596== at 0x4001246E: malloc (vg_replace_malloc.c:153) ==18596== by 0x8F08C6: g_malloc (in /usr/lib/libglib-2.0.so.0.200.3) ==18596== by 0x8FD760: g_strndup (in /usr/lib/libglib-2.0.so.0.200.3) ==18596== by 0x8FEA0D: g_ascii_strdown (in /usr/lib/libglib-2.0.so.0.200.3) ==18596== by 0x4384762F: (within /usr/lib/gnome-vfs-2.0/modules/libhttp.so) ==18596== by 0x43847774: (within /usr/lib/gnome-vfs-2.0/modules/libhttp.so) ==18596== by 0x43847B8C: (within /usr/lib/gnome-vfs-2.0/modules/libhttp.so) ==18596== by 0x43847FE5: (within /usr/lib/gnome-vfs-2.0/modules/libhttp.so) ==18596== by 0x4384834E: (within /usr/lib/gnome-vfs-2.0/modules/libhttp.so) ==18596== by 0x95BD6B: gnome_vfs_open_uri_cancellable (in /usr/lib/libgnomevf s-2.so.0.300.90) ==18596== by 0x963BD7: (within /usr/lib/libgnomevfs-2.so.0.300.90) ==18596== by 0x964AA8: _gnome_vfs_job_execute (in /usr/lib/libgnomevfs-2.so.0 .300.90) ==18596== by 0x9623C8: (within /usr/lib/libgnomevfs-2.so.0.300.90) ==18596== by 0x9748BD: (within /usr/lib/libgnomevfs-2.so.0.300.90) ==18596== by 0x9028F0: (within /usr/lib/libglib-2.0.so.0.200.3) ==18596== by 0x4023F571: thread_wrapper (vg_libpthread.c:667) ==18596== by 0x4015CF04: do__quit (vg_scheduler.c:2146) ==18596== This is possibly fixed by the attatched patch to gnome-vfs.
Created attachment 19825 [details] [review] leak fix in gweather (gnome-vfs)
Kjartan: I think you should put your patch and valgrind analysis in a seperate gnome-vfs bug. I don't think the leaks would be related to file-handles. The file-handles problem is probably gweathers fault in how it uses gnome-vfs.
I did. Trying to get to the bottom of the gnome_vfs_inet_connection_to_socket() leak now to see if that might be the cause.
Alan, how does this show up on your system? Can you tell me how to verify that file handles are leaking?
Look in /proc/$pid/fd Refresh Repeat.
This doesn't seem to happen in 2.2.0 following Alan's advice. I think that the problem came from the experimental gweather that was shipped in early 2.3.x releases but that eventually had to be reverted to the normal applet. The 2.4.0 gweather should be pretty much the same as 2.2.0 so I have a feeling that this bug is not valid anymore. It would be nice to verify on a 2.4.0 build.
Yeah, I tried monitoring that dir earlier and I had a constant number of entries in /proc/<pid>/fd
Confirmed - 2.4 revert of old one fixed it