Xymon Mailing List Archive search

TCPtest open connection issue

list Jeremy Laidman
Fri, 08 Apr 2016 00:41:58 +0000
Message-Id: <user-af5cc9c738e6@xymon.invalid>

Hi Phil

On Thu, Apr 7, 2016 at 3:27 PM Phil Crooker <user-e8e31cd73303@xymon.invalid>
wrote:
I'm having a problem with a spurious error reported by xymonnet on
upgrading to 4.3.27:

Error output:

TCPtest error 1 seen on open connection for žo.cvs
TCPtest error 1 seen on open connection for ° |.squid
TCPtest error 1 seen on open connection for  v.squid
TCPtest error 1 seen on open connection for s.squid

If I substitute an earlier version of xymonnet (4.3.21), the error
disappears. I put the 4.3.27 version back in, restart, and the errors
return. There is nothing wrong with the hostname and these tests are not
producing any 'real' errors. I am testing for a squid service on 5 hosts
and cvs on one.
This is in some new code introduced in v4.3.25, to give more detailed
errors for some connected-but-fail error conditions when doing TCP tests.
Previously, it was a binary result: either the EXPECT string matched, or
the test failed in some way, without any indication as to why.  (You didn't
say if you've defined [cvs] and [squid] sections in protocols.cfg, but I'm
assuming you have.)

The error is probably benign - error 1 means timeout (although it's not
clear to me how a timeout condition can exist on a connected socket, but
maybe it's an expect error condition).  More importantly, the message
appears to be displaying a memory location that has not been initialised,
which suggests a stray or incorrectly-cast pointer is being used for the
hostname.

I think the offending bit of code (in xymonnet.c) is this:

    errprintf("TCPtest error %d seen on open connection for %s.%s\n",
tcptest->errcode, test->host, test->service->testname);

and should be something like this (untested):

    errprintf("TCPtest error %d seen on open connection for %s.%s\n",
tcptest->errcode, test->host->hostname, test->service->testname);

If you feel like testing this out, you can do so without replacing your
entire Xymon installation.  Simply adjust xymonnet.c and recompile, copy
the newly made xymonnet into /tmp/xymonnet, and adjust the CMD line in
tasks.cfg to use /tmp/xymonnet instead of xymonnet.

This won't stop the error message.  But instead you'll see the target
hostname in place of hieroglyphics.  To stop the message, you need to find
out what's causing the fault.  If this is happening on every test, you
might find something interesting in a packet dump.  Alternatively, check
the logs of the service at the other end to see if it tells you what the
problem is.

Cheers
Jeremy