[Bug 307183] Re: poldek leaks fds with packages.ndir.dscr.gz

Elan Ruusamäe glen at delfi.ee
Sat May 22 14:32:20 CEST 2010


some more notes from jbj, perhaps useful if somebody eventually tries to
fix it

17:35:07  jbj> glen: there's a loop to close the 1st 100 fdno's in rpm. so the quick fix is to increase 100 -> ???
17:35:44  jbj> but you appear to have an rpmdb opened multiple times. likely "works" but noplace close to being sensible.
17:36:56  jbj> you also appear to be opening all indices all the time. again "works" but the cure is worse than the disease, being able to do lazy opens in chroot.
17:38:35  jbj> rpm itself shouldn't need anywhere near 100 fdno's. ever.
17:39:03  jbj> maybe 40 afdnos are used simultaneously.
17:40:07  jbj> note that FD_CLOEXEC (or whatever the flag is) is also set religously by rpm itself. bdb does too iirc, but varies w version.

-- 
poldek leaks fds with packages.ndir.dscr.gz
https://bugs.launchpad.net/bugs/307183
You received this bug notification because you are subscribed to PLD
Linux.

Status in poldek: New
Status in PLD Linux Distribution: New

Bug description:
attached obfuscated output of:
$ valgrind --track-fds=yes poldek --up

additionally poldek should close fds before invoking subprocess.
such wrapper could be useful all over the code:

16:34:10 @jbj>     fdno = open(path, flags, mode);
16:34:10 @jbj>     if (fdno < 0) return NULL;
16:34:10 @jbj>     if (fcntl(fdno, F_SETFD, FD_CLOEXEC)) {
16:34:10 @jbj>         (void) close(fdno);
16:34:11 @jbj>         return NULL;
16:34:11 @jbj>     }




More information about the pld-bugs mailing list