Query failure after upgrade from 0.x to 1.x

The forum for help and support with FreeNATS as well as any useful hints and tips
dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: Query failure after upgrade from 0.x to 1.x

Post by dave » Wed Sep 24, 2008 11:36 pm

Well I'm scratching my head. I'm sure it'll turn out to be something really simple I've screwed up though.

Ok... can you try the following:

Create a file in server/base/site/tests called something like tcpdebug.php and in it put the code at the bottom of this post (n.b. you can do this with the file manager if you chmod 777 the directory).

Then set the system variable (Configuration - System Settings - System Variables) site.include.tests to 1 (it should be there set to 0).

Now... in the system info page you should see TCP Debug.

Add a TCP Debug test to your test node and run it again from the command-line. This should show if something is going wrong with the config being passed down or with the actual connection.

Cheers,

Dave.




Code for server/base/site/tests/tcpdebug.php:

Code: Select all

<?php // tcpdebug.php -- Debug TCP test module
global $NATS;

if (isset($NATS))
{
class FreeNATS_TCP_Debug extends FreeNATS_Local_Test
	{
		
	function DoTest($testname,$param,$hostname,$timeout,$params)
		{ 
		echo "Called for ".$hostname." port ".$param." timeout ".$timeout."\n";
		$timer=new TFNTimer();
		$ip=ip_lookup($hostname);
		echo $hostname." => ".$ip."\n";
		if ($ip=="0") return -2; // lookup failed
		echo "Lookup Successful\n";
		$errno=0;
		$errstr="";
		$timer->Start();
		echo "Doing fsockopen()\n";
		$fp=fsockopen($ip,$param,$errno,$errstr,$timeout);
		$elapsed=$timer->Stop();
		echo "FP is : ";
		echo $fp;
		echo "\n";
		if ($fp===false) return -1; // open failed
		echo "Closing\n";
		@fclose($fp);
		return $elapsed;
		}
		
	function Evaluate($result) 
		{
		if ($result<0) return 2; // failure
		return 0; // else success
		}
	
	function DisplayForm(&$row)
		{
		echo "<table border=0>";
		echo "<tr><td align=left>";
		echo "TCP Port :";
		echo "</td><td align=left>";
		echo "<input type=text name=testparam size=30 maxlength=128 value=\"".$row['testparam']."\">";
		echo "</td></tr>";
		echo "</table>";
		}
		
	}
	
$params=array();
$NATS->Tests->Register("tcpdebug","FreeNATS_TCP_Debug",$params,"TCP Debug Connect",1,"FreeNATS TCP Debug");
$NATS->Tests->SetUnits("tcpdebug","Seconds","s");
}


?>

paullanders
Posts: 92
Joined: Thu Sep 04, 2008 9:48 pm

Re: Query failure after upgrade from 0.x to 1.x

Post by paullanders » Thu Sep 25, 2008 4:01 pm

Hi Dave. Here are the results:

NATS Tester Script Starting: Node test_node
Test ID: 125250 (Started at 09:52:28 25/09/2008)

NodeID: test_node
Ping Test: Yes
Ping Returned: 0.001
Ping Test: Passed
Doing Local Tests
Test: tcp (80)
Result: -1
Eval: 0
Recording Test
Test: dns (66.230.0.20)
Result: 0.001
Eval: 0
Recording Test
Test: tcpdebug (80)
Called for 66.230.4.134 port 80 timeout 0
66.230.4.134 => 66.230.4.134
Lookup Successful
Doing fsockopen()

Warning: fsockopen(): unable to connect to 66.230.4.134:80 (Connection timed out) in /opt/freenats/server/base/site/tests/tcpdebug.php on line 21
FP is :
Result: -1
Eval: 2
Recording Test
Nodeside Testing
Highest Alert Level: 2
Alert Count : 1
Alerts: TCP debug failed,

Finished Tests... Finishing Off
Summary: Tester 125250 Highest Level 2, Alerts 1
NATS Stopped... Finished

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: Query failure after upgrade from 0.x to 1.x

Post by dave » Thu Sep 25, 2008 4:16 pm

Right - I think it's a timeout issue.

I am looking at a codefix for it but for the moment can you try setting the "custom timeout" in one of the TCP tests to be 60 seconds and then see if that succeeds?

Cheers,

Dave.

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: Query failure after upgrade from 0.x to 1.x

Post by dave » Thu Sep 25, 2008 4:29 pm

Ok I have replicated it and am now certain it's timeout. I had ruled that out as the 0 seemed to be working ok for default. In fact this was working ok for stuff pretty close to 0 (1-5ms) but not beyond.

Anyway... I've just put up 1.01.7b which has this fixed for the TCP and UDP tests. There are two new system variables test.tcp.timeout and test.udp.timeout but if they're unset or 0 then the hardcoded 60second default is used (you can still override on a per-test basis with custom timeout).

I hope that will solve it!

Cheers,

Dave.

paullanders
Posts: 92
Joined: Thu Sep 04, 2008 9:48 pm

Re: Query failure after upgrade from 0.x to 1.x

Post by paullanders » Thu Sep 25, 2008 5:00 pm

Works beautifully! Thank you! :D

dave
Site Admin
Posts: 260
Joined: Fri May 30, 2008 9:09 pm
Location: UK
Contact:

Re: Query failure after upgrade from 0.x to 1.x

Post by dave » Thu Sep 25, 2008 5:29 pm

Excellent. Weird how the timeout worked but there you go.

Glad all is ok :D

Cheers,

Dave.

Post Reply