[rrd-developers] Segmentation fault when run from php cli.

admin admin at wirusy.net.pl
Tue Jun 16 22:36:40 CEST 2009


Hello,

I got strange problem. I hope you might help me.

There  is  a  script which works very properly from browser. No errors
and  files  are  generated ok. But when I run this script from command
line I got segmentation fault. All permissions are ok. What can be the
problem?

RRDtool 1.3.8

System:
Linux version 2.6.18-128.el5PAE (mockbuild at builder16.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed Jan 21 11:19:46 EST 2009
(Centos5+Directadmin)

PHP:
PHP 5.2.9 (cli) (built: May 11 2009 23:11:30)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with XCache v1.2.2, Copyright (c) 2005-2007, by mOo
    with the ionCube PHP Loader v3.1.34, Copyright (c) 2002-2009, by ionCube Ltd.

Perl:
perl-5.8.8-18.el5_3.1


Here is example:
[root at server public_html]# php con.php
openvz-6130.rrd
    Segmentation fault
[root at server public_html]#

strace show:
lseek(5, 0, SEEK_SET)                   = 0
getdents(5, /* 41 entries */, 4096)     = 1148
stat64("/home/testuser/rrd/traffic/openvz-6130.rrd", {st_mode=S_IFREG|0777, st_size=71152, ...}) = 0
access("/home/testuser/rrd/traffic/openvz-6130.rrd", R_OK) = 0
lstat64("/home/testuser/rrd/traffic/openvz-6130.rrd", {st_mode=S_IFREG|0777, st_size=71152, ...}) = 0
write(1, "openvz-6130.rrd\r\n    ", 21openvz-6130.rrd
    ) = 21
time(NULL)                              = 1245184220
time(NULL)                              = 1245184220
time(NULL)                              = 1245184220
time(NULL)                              = 1245184220
time(NULL)                              = 1245184220
time(NULL)                              = 1245184220
time(NULL)                              = 1245184220
time(NULL)                              = 1245184220
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2679, ...}) = 0
gettimeofday({1245184220, 320367}, NULL) = 0
time(NULL)                              = 1245184220
time(NULL)                              = 1245184220
stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2679, ...}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
[root at server public_html]#






The php script below:
    <?php

        $di=new DirectoryIterator("/home/testuser/rrd/traffic/");
            $i= 0;
           foreach($di as $file) {
            if( !$file -> isDir() && !$file -> isDot() && $file -> isReadable() && !$file -> isLink() )
            {
                       $i++;
//            if( $i < 3)
//                continue;
    echo $file -> getFilename( ).'
    ';

                $opts = array(
        "--title", "Server traffic ".$file -> getFilename( ),
        "--start", mktime (0,0,0,date("m")  ,date("d"),date("Y")),
        "--step", '300',
        "--width", "600",
        "--height", "480",
        "--vertical-label", "kB/s",
        "--rigid",
        "--color", "BACK#000000",
    "--color", "SHADEA#000000",
    "--color", "SHADEB#000000",
    "--color", "FONT#DDDDDD",
    "--color", "CANVAS#202020",
    "--color", "GRID#666666",
    "--color", "MGRID#AAAAAA",
    "--color", "FRAME#202020",
    "--color", "ARROW#FFFFFF",
//                      "HRULE:60000#0000FF:Maximum allowed",
                      "DEF:in=/home/testuser/rrd/traffic/".$file -> getFilename( ).":incoming:AVERAGE",
                      "DEF:out=/home/testuser/rrd/traffic/".$file -> getFilename( ).":outgoing:AVERAGE",
                      "DEF:tot=/home/testuser/rrd/traffic/".$file -> getFilename( ).":total:AVERAGE",
                      "LINE2:in#0000ff:Incoming Traffic Avg.",
                      "LINE2:out#00ff00:Outgoing Traffic Avg.",
                      "LINE2:tot#ff0000:Total Traffic Avg.",
                      "PRINT:in:AVERAGE:incoming\: %1.2lf b/s",
                      "PRINT:out:AVERAGE:outgoing\: %1.2lf b/s",
                      "PRINT:tot:AVERAGE:total\: %1.2lf b/s"
                 );

  $ret = rrd_graph("/home/testuser/domains/testuser.mydomain.com/public_html/_rrd/".$file -> getFilename( ).".gif", $opts, count($opts));

  if( !is_array($ret) )
  {
    $err = rrd_error();

    echo "rrd_graph() ERROR: $err\n";
  }

             }
           }

?>[

-- 
regards,
Marcin



More information about the rrd-developers mailing list