Package: librrds-perl
Version: 1.3.1-3
Severity: important

Perl scripts using RRDs and running continuously take too much memory:
e.g. several dozen of MBs. For instance, after 30 hours:

  PID USER     PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
 2651 lefevre   20   0  117M 80588  4548 S  0.0 31.6  2h48:00 perl /home/lefevre

This makes the machine very slow, almost unusable (it is an old
machine with not much memory), with a load average that can go
up to 7, in particular because I have several of such scripts.
I've attached the one corresponding to the above line.

I didn't have such problems in the past.

Since the used memory increases, I suspect a new memory leak.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (900, 'testing'), (900, 'stable'), (200, 'unstable')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.25-2-powerpc
Locale: LANG=POSIX, LC_CTYPE=en_US.ISO8859-1 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages librrds-perl depends on:
ii  libc6                         2.7-13     GNU C Library: Shared libraries
ii  librrd4                       1.3.1-3    Time-series data storage and displ
ii  perl                          5.10.0-13  Larry Wall's Practical Extraction 
ii  perl-base [perlapi-5.10.0]    5.10.0-13  minimal Perl system

librrds-perl recommends no packages.

librrds-perl suggests no packages.

-- no debconf information
#!/usr/bin/env perl

use strict;
use Filesys::DiskSpace;
use RRDs;

my $RCSID = '$Id: disk-update 2770 2004-03-17 22:39:32Z lefevre $';
my ($proc) = $RCSID =~ /^.Id: (\S+) / or die;

@ARGV or die "Usage: $proc <rrdfile> [ <webdir> ]\n";

my $file = shift;
-f $file or die "$proc: RRDtool file isn't a plain file\n";
-r $file or die "$proc: RRDtool file isn't readable\n";
-w $file or die "$proc: RRDtool file isn't writable\n";

my $wdir = shift;
if (defined $wdir)
  { -d $wdir or die "$proc: $wdir isn't a directory\n"; }

my %t = (
  'day'   => 1,
  'week'  => 6,
  'month' => 24,
  'year'  => 288);

for(;;)
  {
    my $time = time;
    my $root = (df '/')[2];
    my $home = (df '/home')[2];
    time - $time < 3
      and RRDs::update ($file, "$time:$root:$home");
    &rrdgraph('root', '/dev/hda4');
    &rrdgraph('home', '/dev/hda5');
    sleep 60;
  }

sub rrdgraph
  {
    defined $wdir or return;
    my ($name,$fs) = @_;
    foreach (qw/day week month year/)
      {
        RRDs::graph ("$wdir/$name-$_.png", '-a', 'PNG',
          '-h', 200, '-v', $fs, '-b', 1024,
          '--start', -120000*$t{$_},
          "DEF:kavg=$file:$name:AVERAGE", "CDEF:avg=kavg,1024,*",
          "DEF:kmax=$file:$name:MAX",     "CDEF:max=kmax,1024,*",
          "AREA:avg#00ff00", "LINE1:max#ff0000");
      }
  }

Reply via email to