POPEN timed out with perl script

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

cyspak
Posts: 20
Joined: Tue Feb 21, 2006 8:11 am

POPEN timed out with perl script

Post by cyspak »

Hello,

I have a strange problem with an external perl script.

Sometimes it works, sometimes not...

This is a short script who get the round trip time (like ping.pl).
When i launch manually, the script return always the good output.

When i enable the DEGUG logging, i have :

Code: Select all

02/24/2006 04:29:10 PM - CACTID: Poller[0] Host[57] DS[250] SCRIPT: /usr/bin/perl /usr/local/cacti/scripts/rtt.pl 10.3.1.1, output: rtt1:6.31 rtt2:14.2 rtt3:22.0
02/24/2006 04:29:10 PM - CACTID: Poller[0] Host[55] DS[249] WARNING: Result from SCRIPT not valid. Partial Result: ...
02/24/2006 04:29:10 PM - CACTID: Poller[0] Host[55] DS[249] SCRIPT: /usr/bin/perl /usr/local/cacti/scripts/rtt.pl 10.2.1.4, output: U
02/24/2006 04:29:35 PM - CACTID: Poller[0] Host[58] ERROR: The POPEN timed out
02/24/2006 04:29:40 PM - CACTID: Poller[0] Host[58] DS[248] WARNING: Result from SCRIPT not valid. Partial Result: ...
02/24/2006 04:29:40 PM - CACTID: Poller[0] Host[58] DS[248] SCRIPT: /usr/bin/perl /usr/local/cacti/scripts/rtt.pl 10.0.0.1, output: U
So, here, the first resquest works but it works randomly...
Why popen() get time out ??

Thanks for your help.

PS : i use cacti-0.8.6g with rrdtool-1.2.11, php 5.1.1
Last edited by cyspak on Mon Feb 27, 2006 10:33 am, edited 2 times in total.
[size=75]|Fedora Core 4| Cacti 0.8.6h | cactid 0.8.6g | MySQL 4.1.16 | PHP 5.1.1 | Apache 2.2.0 | RRDtool 1.2.11 |[/size]
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

What is the runtime of your script? Please time this with time <cmd>
Reinhard
cyspak
Posts: 20
Joined: Tue Feb 21, 2006 8:11 am

Post by cyspak »

The time of my script is really short :

Code: Select all

[root@localhost scripts]# time perl rtt.pl 10.1.1.1
rtt1:36.0 rtt2:52.5 rtt3:52.7
real    0m0.174s
user    0m0.017s
sys     0m0.026s
It may take 3 seconds for a bad response time but not more.
I think that the timeout for the scripts is set to 25 seconds.
cyspak
Posts: 20
Joined: Tue Feb 21, 2006 8:11 am

Post by cyspak »

With a simple script who print a result directly (rtt1:10 rtt2:20 rtt3:30), if i put a sleep of 1 second, i have the same problem. Without it works...
:(
Last edited by cyspak on Mon Feb 27, 2006 4:55 am, edited 1 time in total.
[size=75]|Fedora Core 4| Cacti 0.8.6h | cactid 0.8.6g | MySQL 4.1.16 | PHP 5.1.1 | Apache 2.2.0 | RRDtool 1.2.11 |[/size]
cyspak
Posts: 20
Joined: Tue Feb 21, 2006 8:11 am

Post by cyspak »

Is it possible that cactid failed to set the stream_set_timeout ??
[size=75]|Fedora Core 4| Cacti 0.8.6h | cactid 0.8.6g | MySQL 4.1.16 | PHP 5.1.1 | Apache 2.2.0 | RRDtool 1.2.11 |[/size]
cyspak
Posts: 20
Joined: Tue Feb 21, 2006 8:11 am

Post by cyspak »

Anyone know why cactid doesn't wait less 1 second to get a result of a perl script ??

I read that the output must be return in 1 print command.


This is my script :

Code: Select all

#!/usr/bin/perl
use strict;

my @tab = (64,512,1024);
my $i = 1;
my $output;
foreach my $size (sort {$a <=> $b} @tab){
        my $ping = `ping -c 1 -s $size $ARGV[0] | grep icmp_seq`;
        $ping =~ m/(.*time=)(.*) (ms|usec)/;
        my $rtt = $2;
        $rtt = 'U' if($rtt eq "");
        $output .= " " if($i != 1);
        $output .= "rtt".$i.":".$rtt;
        $i++;
}
print $output;
print "\n";
exit 1;
[size=75]|Fedora Core 4| Cacti 0.8.6h | cactid 0.8.6g | MySQL 4.1.16 | PHP 5.1.1 | Apache 2.2.0 | RRDtool 1.2.11 |[/size]
cyspak
Posts: 20
Joined: Tue Feb 21, 2006 8:11 am

Post by cyspak »

I have the same problem with a basic php script :

Code: Select all

<?php

sleep(1);

echo ('rtt1:20 rtt2:40 rtt3:60') . "\n";

?>
[size=75]|Fedora Core 4| Cacti 0.8.6h | cactid 0.8.6g | MySQL 4.1.16 | PHP 5.1.1 | Apache 2.2.0 | RRDtool 1.2.11 |[/size]
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I attempted to code around this issue, but it is not Cactid that is the issue. I am attempting to block on the pipe, but due to issues in glibc (certain versions) it is not working. Can you please check you glibc version and attempt an update and see if that correct the issue?

Please post your results. I will again look at the code as well.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Ok, I looked at the code and found that I provided the work around in the script server but left it off on normal script calls. The issue remains that the glibc changed the default behavior from blocking to non-blocking which is all technical jargon for something changed outside of Cactid. Can you please open a bug at the following site and reference this post.

Thanks,

TheWitness

http://bugs.cacti.net
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
cyspak
Posts: 20
Joined: Tue Feb 21, 2006 8:11 am

Post by cyspak »

Ok thank you !!

I reported the bug here :
http://bugs.cacti.net/view.php?id=714

I hope it'll be resolved soon...
[size=75]|Fedora Core 4| Cacti 0.8.6h | cactid 0.8.6g | MySQL 4.1.16 | PHP 5.1.1 | Apache 2.2.0 | RRDtool 1.2.11 |[/size]
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

If you upgrade/downgrade glibc, you can fix it right away.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
cyspak
Posts: 20
Joined: Tue Feb 21, 2006 8:11 am

Post by cyspak »

Hello,

Sorry for my late answer, i was a bit busy.

So i updated my glibc version to 2.3.6-2 on my Fedora Core 4 and there's the same problem !!
What is the correct glibc version ?

Thanks.

Cyspak
[size=75]|Fedora Core 4| Cacti 0.8.6h | cactid 0.8.6g | MySQL 4.1.16 | PHP 5.1.1 | Apache 2.2.0 | RRDtool 1.2.11 |[/size]
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I have made a change to SVN that should aleviate the issue with glibc. Please test and confirm your findings both here and in the bug report.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
egironda
Posts: 45
Joined: Mon Dec 19, 2005 6:44 pm

Post by egironda »

I have version 2.2 and have this problem... is there another fix, or a patch? I can't seem to get any of the code from the svn repository to compile, but maybe I'm just missing something...
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

If you have been able to compile one of the previous versions, you should be able to compile what is in SVN by taking the each of the *.c files and replacing them with the contents of SVN "BRANCH_0_8_6" and all should be Ok. If you are not familiar with SVN, you can just go to the main page in Cacti.net and web browse to each file and download 1 at a time.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest