Re: Fix for pg_stat_activity putting client hostaddr into appname field - Mailing list pgsql-hackers

From Edmund Horner
Subject Re: Fix for pg_stat_activity putting client hostaddr into appname field
Date
Msg-id CAMyN-kAXaGfOZpAjECy2sHGmN4KaxToDv9s9UB-GBZxO4rZ+Bw@mail.gmail.com
Whole thread Raw
In response to Fix for pg_stat_activity putting client hostaddr into appname field  (Edmund Horner <ejrh00@gmail.com>)
List pgsql-hackers
I sent the original in haste, and now I need to make some corrections... sigh.

> Subject: Fix for pg_stat_activity putting client hostaddr into appname field

Actually, it's the hostname appears in the appname field.

> I noticed when querying pg_stat_activity (in 10.1):

10.1 was where I first noticed the bug, but it's still present in master.

> I've tracked this down to bootstrap/pgstat.c.

Should be postmaster/pgstat.c.

> In the case of my query, the pointers for st_appname in the aux processes happen to point into the
BackendClientHostnameBuffersegment.
 

To be clear, I think this is a memory error.  These rogue pointers
could do a lot more damage than merely pointing to the wrong strings.

> It's an extra 3 kB ...

A rough estimate, that was also wrong.  7 aux processes * (1024 bytes
activity + 64 for hostname + 64 for appname) = about 8 kB.

I do apologise for the confusion!

Edmund


pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Re: JIT compiling with LLVM v12
Next
From: Thomas Munro
Date:
Subject: Re: Updating parallel.sgml's treatment of parallel joins