Your message dated Fri, 28 Jul 2006 17:16:52 +0200 with message-id <[🔎] 20060728151652.GA3208@orest.greek0.net> and subject line apt_pkg.GetPkgSrcRecords seems to leak FDs has caused the attached Bug report to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Debian bug tracking system administrator (administrator, Debian Bugs database)
--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: apt_pkg.GetPkgSrcRecords seems to leak FDs
- From: Christian 'Greek0' Aichinger <Greek0@gmx.net>
- Date: Sat, 16 Apr 2005 13:40:19 +0200
- Message-id: <20050416114019.GA911@orest.greek0.net>
Package: python-apt Version: 0.5.10 Severity: normal Tags: patch I've noticed that python-apt leaks FDs (and, as it turned out, memory) when using PkgSrcRecords. Below is a transcript of a python session that shows the bug. ---- START ---- greek0@orest:~$ python Python 2.3.5 (#2, Mar 26 2005, 17:32:32) [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import apt_pkg >>> apt_pkg.init() >>> c = apt_pkg.GetCache() Reading Package Lists... Done Building Dependency Tree... Done >>> [1]+ Stopped python greek0@orest:~$ ps aux | grep [p]ython | tail -n 1 greek0 848 2.4 3.4 17332 13408 pts/9 T 12:40 0:01 python greek0@orest:~$ ls /proc/848/fd/ 0 1 2 greek0@orest:~$ fg 1 python >>> p = apt_pkg.GetPkgSrcRecords(c) >>> p <pkgSrcRecords object at 0x401df610> >>> [1]+ Stopped python greek0@orest:~$ ls /proc/848/fd/ 0 1 10 11 12 13 14 15 16 2 3 4 5 6 7 8 9 greek0@orest:~$ # ^-- ?! greek0@orest:~$ exit There are stopped jobs. greek0@orest:~$ fg 1 python >>> del p >>> del c >>> del apt_pkg >>> [1]+ Stopped python greek0@orest:~$ ls /proc/848/fd/ 0 1 10 11 12 13 14 15 16 2 3 4 5 6 7 8 9 greek0@orest:~$ for i in /proc/848/fd/*; do echo -e "$i\n `readlink $i`"; done /proc/848/fd/0 /dev/pts/9 /proc/848/fd/1 /dev/pts/9 /proc/848/fd/10 /var/lib/apt/lists/ftp.de.debian.org_debian-non-US_dists_testing-proposed-updates_non-US_main_source_Sources /proc/848/fd/11 /var/lib/apt/lists/ftp.de.debian.org_debian_dists_unstable_main_source_Sources /proc/848/fd/12 /var/lib/apt/lists/ftp.de.debian.org_debian-non-US_dists_unstable_non-US_main_source_Sources /proc/848/fd/13 /var/lib/apt/lists/security.debian.org_dists_stable_updates_main_source_Sources /proc/848/fd/14 /var/lib/apt/lists/security.debian.org_dists_stable_updates_contrib_source_Sources /proc/848/fd/15 /var/lib/apt/lists/security.debian.org_dists_stable_updates_non-free_source_Sources /proc/848/fd/16 /var/lib/apt/lists/ftp.de.debian.org_debian_dists_experimental_main_source_Sources /proc/848/fd/2 /dev/pts/9 /proc/848/fd/3 /var/lib/apt/lists/ftp.de.debian.org_debian_dists_stable_main_source_Sources /proc/848/fd/4 /var/lib/apt/lists/ftp.de.debian.org_debian-non-US_dists_stable_non-US_main_source_Sources /proc/848/fd/5 /var/lib/apt/lists/ftp.de.debian.org_debian_dists_stable-proposed-updates_main_source_Sources /proc/848/fd/6 /var/lib/apt/lists/ftp.de.debian.org_debian-non-US_dists_stable-proposed-updates_non-US_main_source_Sources /proc/848/fd/7 /var/lib/apt/lists/ftp.de.debian.org_debian_dists_testing_main_source_Sources /proc/848/fd/8 /var/lib/apt/lists/ftp.de.debian.org_debian-non-US_dists_testing_non-US_main_source_Sources /proc/848/fd/9 /var/lib/apt/lists/ftp.de.debian.org_debian_dists_testing-proposed-updates_main_source_Sources ---- END ---- Investigating the problem showed that PkgSrcRecordsStruct creates a new pkgSrcRecords object in its constructor without deleting it again in the destructor. Fixing this revealed another bug, simmilar to the one described in #304296 (mismatch of Owned and non-Owned function calls, causing a segfault). I've attatched a patch that fixes both problems. -- System Information: Debian Release: 3.1 APT prefers unstable APT policy: (990, 'unstable'), (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.8r20050410 Locale: LANG=de_AT.UTF-8@euro, LC_CTYPE=de_AT.UTF-8@euro (charmap=UTF-8) Versions of packages python-apt depends on: ii apt [libapt-pkg-libc6.3-5-3 0.5.28.6 Advanced front-end for dpkg ii apt-utils [libapt-inst-libc 0.5.28.6 APT utility programs ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an ii libgcc1 1:3.4.3-12 GCC support library ii libstdc++5 1:3.3.5-12 The GNU Standard C++ Library v3 ii python 2.3.5-2 An interactive high-level object-o -- no debconf informationdiff -Nur orig.python-apt-0.5.10/python/pkgsrcrecords.cc python-apt-0.5.10/python/pkgsrcrecords.cc --- orig.python-apt-0.5.10/python/pkgsrcrecords.cc 2003-12-26 18:04:22.000000000 +0100 +++ python-apt-0.5.10/python/pkgsrcrecords.cc 2005-04-16 13:22:20.593046072 +0200 @@ -26,6 +26,9 @@ List.ReadMainList(); Records = new pkgSrcRecords(List); }; + ~PkgSrcRecordsStruct() { + delete Records; + }; }; // PkgSrcRecords Class /*{{{*/ @@ -89,10 +92,10 @@ PyObject_HEAD_INIT(&PyType_Type) 0, // ob_size "pkgSrcRecords", // tp_name - sizeof(CppOwnedPyObject<PkgSrcRecordsStruct>), // tp_basicsize + sizeof(CppPyObject<PkgSrcRecordsStruct>), // tp_basicsize 0, // tp_itemsize // Methods - CppOwnedDealloc<PkgSrcRecordsStruct>, // tp_dealloc + CppDealloc<PkgSrcRecordsStruct>, // tp_dealloc 0, // tp_print PkgSrcRecordsAttr, // tp_getattr 0, // tp_setattrAttachment: signature.asc
Description: Digital signature
--- End Message ---
--- Begin Message ---
- To: 304903@bugs.debian.org
- Subject: Re: apt_pkg.GetPkgSrcRecords seems to leak FDs
- From: Christian Aichinger <Greek0@gmx.net>
- Date: Fri, 28 Jul 2006 17:16:52 +0200
- Message-id: <[🔎] 20060728151652.GA3208@orest.greek0.net>
- Mail-followup-to: Christian Aichinger <Greek0@gmx.net>, 304903@bugs.debian.org
Well, I think this is fixed in unstable by now. Closing. Cheers, Christian AichingerAttachment: signature.asc
Description: Digital signature
--- End Message ---