pcp
[Top] [All Lists]

Re: [pcp] pmhostname failing - urgent

To: "Frank Ch. Eigler" <fche@xxxxxxxxxx>, Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Subject: Re: [pcp] pmhostname failing - urgent
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Sun, 17 Nov 2013 22:02:30 -0500 (EST)
Cc: pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <20131117123128.GG8993@xxxxxxxxxx>
References: <000201cee1ed$6a1171f0$3e3455d0$@internode.on.net> <20131115193341.GD8993@xxxxxxxxxx> <5286804D.5010107@xxxxxxxxxxxxxxxx> <20131115203919.GE8993@xxxxxxxxxx> <52868ED9.90209@xxxxxxxxxxxxxxxx> <20131115230044.GF8993@xxxxxxxxxx> <52887E9F.9010403@xxxxxxxxxxxxxxxx> <20131117123128.GG8993@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: L7Fi92euee8CPmBkolmglFhUDUOrLw==
Thread-topic: pmhostname failing - urgent

----- Original Message -----
> ...
> That 0x...7ffff address indicates that the "Unknown Host" string is
> not coming from the heap, but from the executable's text/data section.
> That makes no sense, looking at even 3.8.0..HEAD code, as
> src/libpcp/src/auxconnect.c says:
> 
> char *
> __pmHostEntGetName(__pmHostEnt *he)
> {
>     if ... {
>        if (he->name == NULL)
>            he->name = "Unknown Host";
>     }
>     return strdup(he->name);
> }
> 
> That is, it should only ever return heap pointers.  Could you by any

I think there's the bug though - he->name still contains the pointer
to the non-heap string.  If we later free that (via "he"), badness
will surely result.

> Actually that "Unknown Host" is not an appropriate response anyway,
> when that function can already return NULL due to -ENOMEM, so it

The pmlogger code appears to deal with a null return here, falling
back to some other pmcd_host value its got stashed away, so that is
probably the best fix all round.  A quick audit of the other callers
also suggests they all have suitable fallback code.

It remains a mystery as to why getnameinfo(3) is failing on these
host(s) but that part seems unlikely to be a PCP problem.

cheers.

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>