#252 PDL constructor segfaults with arrayrefs from RRDs::fetch

core (120)

RRDs::fetch reads data from an RRD file and returns it as array reference. The format is exactly that of a two-dimensional pdl. However, when the data is passed to the pdl constructor, a segmentation fault occurs in pdl_avref.

The attached sample code reproduces the issue. You will need the RRDs module and rrdtool for it to run (install librrds-perl on debian).

I can reproduce this both with the 2.4.5 package from Ubuntu and with the 2.4.7 CPAN module.


  • Jonas Wagner

    Jonas Wagner - 2010-12-17

    Small perl script to reproduce the error

  • Jonas Wagner

    Jonas Wagner - 2010-12-17

    The version of PDL used to reproduce the problem

  • Jonas Wagner

    Jonas Wagner - 2010-12-17

    I've tried cloning the data with Storable::dclone => same problem

    Manually cloning the data, however, does not produce a segfault:

    my @clone;
    push @clone, [ @$_ ] foreach (@$data);
    my $p1 = pdl \@clone; # no segfault here...
    print STDERR "pdl info: ", $p1->info, "\n";

  • Chris Marshall

    Chris Marshall - 2010-12-17

    Thanks for reporting the problem. We have another ticket
    related to this issue which is the top priority for the planned
    New Years release of PDL-2.4.8 and I've bumped the
    priority of this ticket to match.

  • Chris Marshall

    Chris Marshall - 2010-12-17
    • priority: 5 --> 9
  • Chris Marshall

    Chris Marshall - 2010-12-17

    I was wondering if you had tried this with the
    latest CPAN Developers release? It still has
    problems but many of the pre-PDL-2.4.7 ones
    have been fixed.

    You can download the source from:
    and then use the standard perl module
    build process:

    (1) extract the source directory and cd there
    (2) perl Makefile.PL
    (3) make
    (4) make test

    Now you should be able to run your sample
    code with this PDL using a line like:

    perl -Mblib test_pdl.pl

  • Jonas Wagner

    Jonas Wagner - 2010-12-20

    Tried today with the 2.4.7_007 release. The problem seems to be fixed there!

    Thanks a lot for your work.

    Unrelated hint: The only strange thing I noticed about 2.4.7_007 was a bad plan in t/plplot.t
    t/plplot.t (Wstat: 8 Tests: 15 Failed: 0)
    Non-zero wait status: 8
    Parse errors: Bad plan. You planned 35 tests but ran 15.

  • Chris Marshall

    Chris Marshall - 2010-12-20

    PDL-2.4.7_007 is a developers release and
    not an official release so you can expect that
    not everything works as expected. I'm glad
    that your problem appears to be fixed.

    I'm leaving this ticket open pending the planned
    PDL-2.4.8 official release. I'll let you know when
    the pre-release is available for testing. At that
    time it would be a great if you could check things
    out once more to confirm that no regressions were

  • Chris Marshall

    Chris Marshall - 2010-12-20
    • status: open --> open-remind
  • Chris Marshall

    Chris Marshall - 2011-03-20


    With the CHM/PDL-2.4.7_012.tar.gz CPAN developers release,
    it appears that a final fix to the constructor bug is in. I'm
    marking this ticket Pending to close in 2 weeks unless I hear
    back from you that the latest code breaks the previous fix.

    It would be greatly appreciated if you could confirm that
    your problem remains fixed. Just download the latest
    PDL release from
    The release announcement is at

    Extract the tar file, change to the source directory, do the
    usual: perl Makefile.PL; make; make test to build and verify.
    Then you should be able to run your test program with that
    PDL via perl -Mblib rrd-test-script.pl.

    Thanks in advance,

  • Chris Marshall

    Chris Marshall - 2011-03-20
    • status: open-remind --> pending-fixed
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

  • SourceForge Robot

    • status: pending-fixed --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks