Re: Fix for pg_stat_activity putting client hostaddr into appname field

From: Edmund Horner <ejrh00(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix for pg_stat_activity putting client hostaddr into appname field
Date: 2018-03-28 22:28:11
Message-ID: CAMyN-kAXaGfOZpAjECy2sHGmN4KaxToDv9s9UB-GBZxO4rZ+Bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 BackendClientHostnameBuffer segment.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-03-28 22:32:51 Re: Updating parallel.sgml's treatment of parallel joins
Previous Message David Steele 2018-03-28 22:24:53 Re: JIT compiling with LLVM v12