Bug#640574: libcyrus-imap-perl22: Cyrus::SIEVE::managesieve leaks file handles
Sven Mueller
sven at incase.de
Tue Sep 6 16:33:43 UTC 2011
On Mon, September 5, 2011 9:42 pm, Jörg Ludwig wrote:
I think I tracked the problem down. See attached patch.
The function (installafile) opens a stream with fopen, but never does an
fclose. And it doesn't seem to call any function that should do the fclose
either.
Regards,
Sven
> Subject: libcyrus-imap-perl22: Cyrus::SIEVE::managesieve leaks file
> handles
> Package: libcyrus-imap-perl22
> Version: 2.2.13-19+squeeze1
> Severity: normal
>
> *** Please type your report below this line ***
> I noticed that the sieve_put_file_withdest function from
> Cyrus::SIEVE::managesieve leaves one file handle open on each call.
> Hence I can call it only 1021 times before it fails. I attached a small
> perl script to show the error.
>
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Cyrus::SIEVE::managesieve;
>
> my $fn = "/tmp/sieve_fh_bug";
> my $script = "sieve";
> my $act = "test1";
> my $pw = "12345";
>
> system "touch", $fn and die $!;
> for (1..999999)
> {
> print "$_\n";
> my $h = sieve_get_handle("localhost",
> sub {$act}, sub {"cyrus"}, sub {$pw}, sub {""})
> or die "cannot connect to sieve server as user $act\n";
> sieve_put_file_withdest($h, $fn, $script) and die sieve_get_error($h);
> sieve_logout($h) and die sieve_get_error($h);
> }
>
>
> strace outputs:
> open("/tmp/sieve_fh_bug", O_RDONLY) = 1022
> ...
> open("/tmp/sieve_fh_bug", O_RDONLY) = 1023
> ...
> open("/tmp/sieve_fh_bug", O_RDONLY) = -1 EMFILE (Too many open files)
>
>
> As a workaround you can set the file handle limit to high values.
> I reported this bug to pkg-cyrus-imapd-debian-devel in mid 2008 and just
> found out that it is still in Debian squeeze.
>
>
> -- System Information:
> Debian Release: 6.0.2
> APT prefers stable-updates
> APT policy: (500, 'stable-updates'), (500, 'stable')
> Architecture: amd64 (x86_64)
>
> Kernel: Linux 2.6.26-2-xen-amd64 (SMP w/2 CPU cores)
> Locale: LANG=de_DE.UTF-8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
>
> Versions of packages libcyrus-imap-perl22 depends on:
> ii libc6 2.11.2-10 Embedded GNU C Library:
> Shared lib
> ii libdb4.7 4.7.25-9 Berkeley v4.7 Database
> Libraries [
> ii libsasl2-2 2.1.23.dfsg1-7 Cyrus SASL - authentication
> abstra
> ii libssl0.9.8 0.9.8o-4squeeze1 SSL shared libraries
> ii perl 5.10.1-17squeeze2 Larry Wall's Practical
> Extraction
> ii perl-base [perlapi-5.1 5.10.1-17squeeze2 minimal Perl system
>
> libcyrus-imap-perl22 recommends no packages.
>
> libcyrus-imap-perl22 suggests no packages.
>
> -- no debconf information
>
>
> --
> Mit freundlichen Grüßen
>
> Jörg Ludwig
>
> IServ GmbH
> Rebenring 33
> 38106 Braunschweig
>
> Telefon: 0531-2243666-0
> Fax: 0531-2243666-9
> Mobil: 0179-9101055
> E-Mail: joerg.ludwig at iserv.eu
> Internet: iserv.eu
>
> USt.-IdNr.: DE265149425
> Registergericht: Amtsgericht Braunschweig
> Registernummer: HRB 201822
> Geschäftsführer: Jörg Ludwig
>
>
>
>
> _______________________________________________
> Pkg-Cyrus-imapd-Debian-devel mailing list
> Pkg-Cyrus-imapd-Debian-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-cyrus-imapd-debian-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: request-fix-filehandle-leakage.patch
Type: text/x-diff
Size: 438 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-cyrus-imapd-debian-devel/attachments/20110906/657deb7a/attachment-0001.patch>
More information about the Pkg-Cyrus-imapd-Debian-devel
mailing list