[Pidgin] #3949: leaks file descriptors on each server connection
Pidgin
trac at pidgin.im
Wed Nov 14 00:35:56 EST 2007
#3949: leaks file descriptors on each server connection
-----------------------+----------------------------------------------------
Reporter: rickju | Type: defect
Status: new | Priority: minor
Component: libpurple | Version: 2.2.2
Keywords: | Pending: 0
-----------------------+----------------------------------------------------
One of the jabber servers I connect to is having problems and I can't
connect to it.
However gaim just keeps on trying, which is o.k., except each time it
tries it leaks a file descriptor:
: estale.eu IA 31 $; pfiles $(pgrep -u cg13442 gaim)
12609: /usr/bin/gaim
Current rlimit: 256 file descriptors
0: S_IFCHR mode:0666 dev:342,0 ino:6815752 uid:0 gid:3 rdev:13,2
O_RDONLY|O_LARGEFILE
/devices/pseudo/mm at 0:null
1: S_IFREG mode:0644 dev:356,23 ino:946574 uid:14442 gid:10 size:284205
O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE
/home/cg13442/.dt/sessionlogs/estale_DISPLAY=:4
2: S_IFREG mode:0644 dev:356,23 ino:946574 uid:14442 gid:10 size:284205
O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE
/home/cg13442/.dt/sessionlogs/estale_DISPLAY=:4
3: S_IFDOOR mode:0444 dev:351,0 ino:53 uid:0 gid:0 size:0
O_RDONLY|O_LARGEFILE FD_CLOEXEC door to nscd[128]
/var/run/name_service_door
4: S_IFSOCK mode:0666 dev:348,0 ino:3483 uid:0 gid:0 size:0
O_RDWR|O_NONBLOCK FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(16384),SO_RCVBUF(5120)
sockname: AF_UNIX
peername: AF_UNIX /tmp/.X11-unix/X4
5: S_IFREG mode:0640 dev:356,23 ino:25705154 uid:14442 gid:10 size:509
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/yahoo/triplettravel/.system/2006-07-28.082546.txt
6: S_IFIFO mode:0000 dev:349,0 ino:251138 uid:14442 gid:10 size:0
O_RDWR
7: S_IFIFO mode:0000 dev:349,0 ino:251138 uid:14442 gid:10 size:0
O_RDWR
8: S_IFIFO mode:0000 dev:349,0 ino:251139 uid:14442 gid:10 size:0
O_RDWR
9: S_IFIFO mode:0000 dev:349,0 ino:251139 uid:14442 gid:10 size:0
O_RDWR
10: S_IFIFO mode:0000 dev:349,0 ino:251140 uid:14442 gid:10 size:0
O_RDWR
11: S_IFIFO mode:0000 dev:349,0 ino:251140 uid:14442 gid:10 size:0
O_RDWR|O_NONBLOCK
12: S_IFCHR mode:0644 dev:342,0 ino:99614726 uid:0 gid:3 rdev:190,1
O_RDONLY
/devices/pseudo/random at 0:urandom
13: S_IFSOCK mode:0666 dev:348,0 ino:57319 uid:0 gid:0 size:0
O_RDWR FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(16384),SO_RCVBUF(5120)
sockname: AF_UNIX
peername: AF_UNIX /tmp/.ICE-unix/5419
14: S_IFSOCK mode:0666 dev:348,0 ino:9626 uid:0 gid:0 size:0
O_RDWR FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(49640)
sockname: AF_INET 129.156.173.199 port: 57818
peername: AF_INET 129.156.85.12 port: 8080
15: S_IFREG mode:0640 dev:356,23 ino:25644580 uid:14442 gid:10 size:604
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/irc/chrisg at irc.central/.system/2006-07-28.082546.txt
16: S_IFSOCK mode:0666 dev:348,0 ino:25300 uid:0 gid:0 size:0
O_RDWR|O_NONBLOCK FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(49640)
sockname: AF_INET 129.156.173.199 port: 61345
peername: AF_INET 129.156.85.12 port: 8080
17: S_IFSOCK mode:0666 dev:348,0 ino:9581 uid:0 gid:0 size:0
O_RDWR FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(49640)
sockname: AF_INET 129.156.173.199 port: 37779
peername: AF_INET 129.147.177.159 port: 6667
18: S_IFSOCK mode:0666 dev:348,0 ino:63756 uid:0 gid:0 size:0
O_RDWR FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(49680)
sockname: AF_INET 129.156.173.199 port: 57182
peername: AF_INET 192.18.1.15 port: 1080
19: S_IFSOCK mode:0666 dev:348,0 ino:55806 uid:0 gid:0 size:0
O_RDWR|O_NONBLOCK FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(49640)
sockname: AF_INET 129.156.173.199 port: 51942
peername: AF_INET 129.156.85.12 port: 8080
20: S_IFREG mode:0640 dev:356,23 ino:25644581 uid:14442 gid:10 size:929
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/aim/triplettravel/.system/2006-07-28.082547.txt
21: S_IFREG mode:0640 dev:356,23 ino:25702180 uid:14442 gid:10 size:615
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/msn/triplettravel at hotmail.com/.system/2006-07-28.082551.txt
22: S_IFREG mode:0640 dev:356,23 ino:19490797 uid:14442 gid:10 size:1351
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/jabber/cg13442 at im-amer.sun.com/global-
labs at muc.sun.com.chat/2006-07-28.084302.txt
23: S_IFSOCK mode:0666 dev:348,0 ino:27975 uid:0 gid:0 size:0
O_RDWR|O_NONBLOCK FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(49640)
sockname: AF_INET 129.156.173.199 port: 34143
24: S_IFCHR mode:0644 dev:342,0 ino:99614724 uid:0 gid:3 rdev:190,0
O_RDONLY
/devices/pseudo/random at 0:random
25: S_IFREG mode:0640 dev:356,23 ino:25698170 uid:14442 gid:10 size:705
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/irc/triplettravel at sterling.freenode.net/.system/2006-07-28.082549.txt
26: S_IFSOCK mode:0666 dev:348,0 ino:50180 uid:0 gid:0 size:0
O_RDWR FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(49640)
sockname: AF_INET 129.156.173.199 port: 54366
peername: AF_INET 192.18.108.193 port: 9909
27: S_IFREG mode:0640 dev:356,23 ino:25620534 uid:14442 gid:10 size:1351
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/jabber/cg13442 at im-
amer.sun.com/.system/2006-07-28.082603.txt
28: S_IFREG mode:0640 dev:356,23 ino:12788743 uid:14442 gid:10 size:935
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/jabber/cg13442 at im-
amer.sun.com/tardis at muc.sun.com.chat/2006-07-28.082604.txt
29: S_IFIFO mode:0000 dev:349,0 ino:251289 uid:14442 gid:10 size:0
O_RDWR
30: S_IFIFO mode:0000 dev:349,0 ino:251182 uid:14442 gid:10 size:0
O_RDWR
31: S_IFIFO mode:0000 dev:349,0 ino:251183 uid:14442 gid:10 size:0
O_RDWR
32: S_IFSOCK mode:0666 dev:348,0 ino:65048 uid:0 gid:0 size:0
O_RDWR FD_CLOEXEC
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(49640)
sockname: AF_INET 129.156.173.199 port: 35006
peername: AF_INET 129.156.173.22 port: 5222
33: S_IFIFO mode:0000 dev:349,0 ino:251204 uid:14442 gid:10 size:0
O_RDWR
34: S_IFIFO mode:0000 dev:349,0 ino:251205 uid:14442 gid:10 size:0
O_RDWR
35: S_IFREG mode:0640 dev:356,23 ino:25480923 uid:14442 gid:10 size:2150
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/jabber/cg13442 at jabber-
uk.uk.sun.com/.system/2006-07-28.082630.txt
36: S_IFREG mode:0640 dev:356,23 ino:25597160 uid:14442 gid:10 size:2356
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/jabber/cg13442 at jabber-uk.uk.sun.com/pts-
lab-private at public.jabber-uk.uk.sun.com.chat/2006-07-28.082630.txt
37: S_IFREG mode:0640 dev:356,23 ino:25508364 uid:14442 gid:10 size:4696
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/jabber/cg13442 at jabber-uk.uk.sun.com/pts-
lab at public.jabber-uk.uk.sun.com.chat/2006-07-28.082630.txt
38: S_IFIFO mode:0000 dev:349,0 ino:251290 uid:14442 gid:10 size:0
O_RDWR
39: S_IFREG mode:0640 dev:356,23 ino:25484956 uid:14442 gid:10 size:1775
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/jabber/cg13442 at jabber-uk.uk.sun.com/pts-
pt at public.jabber-uk.uk.sun.com.chat/2006-07-28.082630.txt
40: S_IFREG mode:0640 dev:356,23 ino:25487993 uid:14442 gid:10
size:15176
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/jabber/cg13442 at jabber-uk.uk.sun.com/pts-
kernel at talker.jabber-uk.uk.sun.com.chat/2006-07-28.082631.txt
41: S_IFREG mode:0640 dev:356,23 ino:25484957 uid:14442 gid:10 size:5952
O_WRONLY|O_APPEND|O_CREAT
/home/cg13442/.gaim/logs/jabber/cg13442 at jabber-uk.uk.sun.com/pts-
oe at talker.jabber-uk.uk.sun.com.chat/2006-07-28.082631.txt
42: S_IFIFO mode:0000 dev:349,0 ino:251334 uid:14442 gid:10 size:0
O_RDWR
43: S_IFIFO mode:0000 dev:349,0 ino:251335 uid:14442 gid:10 size:0
O_RDWR
44: S_IFIFO mode:0000 dev:349,0 ino:251422 uid:14442 gid:10 size:0
O_RDWR
45: S_IFIFO mode:0000 dev:349,0 ino:251423 uid:14442 gid:10 size:0
O_RDWR
46: S_IFIFO mode:0000 dev:349,0 ino:251592 uid:14442 gid:10 size:0
O_RDWR
47: S_IFIFO mode:0000 dev:349,0 ino:251593 uid:14442 gid:10 size:0
O_RDWR
48: S_IFIFO mode:0000 dev:349,0 ino:251778 uid:14442 gid:10 size:0
O_RDWR
49: S_IFIFO mode:0000 dev:349,0 ino:251779 uid:14442 gid:10 size:0
O_RDWR
50: S_IFIFO mode:0000 dev:349,0 ino:251886 uid:14442 gid:10 size:0
O_RDWR
51: S_IFIFO mode:0000 dev:349,0 ino:251887 uid:14442 gid:10 size:0
O_RDWR
52: S_IFIFO mode:0000 dev:349,0 ino:252425 uid:14442 gid:10 size:0
O_RDWR
53: S_IFIFO mode:0000 dev:349,0 ino:252426 uid:14442 gid:10 size:0
O_RDWR
54: S_IFIFO mode:0000 dev:349,0 ino:254121 uid:14442 gid:10 size:0
O_RDWR
55: S_IFIFO mode:0000 dev:349,0 ino:254122 uid:14442 gid:10 size:0
O_RDWR
56: S_IFIFO mode:0000 dev:349,0 ino:255036 uid:14442 gid:10 size:0
O_RDWR
57: S_IFIFO mode:0000 dev:349,0 ino:255037 uid:14442 gid:10 size:0
O_RDWR
58: S_IFIFO mode:0000 dev:349,0 ino:255665 uid:14442 gid:10 size:0
O_RDWR
59: S_IFIFO mode:0000 dev:349,0 ino:255666 uid:14442 gid:10 size:0
O_RDWR
: estale.eu IA 32 $;
After a few hours it will fall over in a heap as it has run out of file
descriptors.
looking at the souce from sourceforge there appear to be numerous places
where while handling pipes it can leak file descriptors:
if (pipe(child_out) || pipe(child_in)) {
gaim_debug_error("dns",
"Could not create pipes: %s\n",
strerror(errno));
return NULL;
}
If the child_out pipes get created but the child_in ones don't we leak the
child_out ones or in gaim_srv_resolve there are just so many ways the fds
can get leaked when things go wrong. However even when things don't go
wrong it looks like it leaks in[1].
Entry 1 chris.gerhard [2006-07-28 11:39]
[dep, 24Jan2007]
This leak appears to be associated not just with failed connections, but
all connections. (Typically you wouldn't notice it as successful
connections
usually happen only once, but I have a particularly flakey network
connection
that requires gaim to frequently reconnect to my jabber server).
trussing a
fd-leaking gaim shows that each re-connection involves:
400417: pipe() = 14 [24]
400417: pipe() = 25 [26]
400417: close(26) = 0
400417: close(14) = 0
before forking off a resolving thread. It is the other two pipe
endpoint filedescriptors which end up leaked. This appears to
correspond to a call to gaim_srv_resolve() from (in my case)
jabber_login(). Looking at the code in dnssrv.c, I see
gaim_srv_resolve() doing the typical setup thing:
if(pipe(in) || pipe(out)) {
...
}
pid = fork();
...
/* Child */
if (pid == 0)
{
close(out[0]);
close(in[1]);
resolve(in[0], out[1]);
}
close(out[1]);
close(in[0]);
These are the only calls to close() in the whole file. As far as I
can tell, out[1] amd in[0] are never closed in the parent process.
This is consistent with a 2 fd per reconnect leak, and the specific
behavior I'm observing with truss.
Entry 2 david.powell [2007-01-25 00:10]
--
Ticket URL: <http://developer.pidgin.im/ticket/3949>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list