Ray Stell <stellr@cns.vt.edu> writes:
> On Thu, May 27, 2010 at 12:49:49PM -0400, Tom Lane wrote:
>> That is in the right place, isn't it. That would suggest that
>> get_ps_display() is returning a wrong length on Ray's machine.
>> It works okay here, but since that's platform-specific code that
>> hardly proves much. Ray, what platform is this exactly?
> [postgres ~]$ cat /etc/issue
> Red Hat Enterprise Linux Server release 5.5 (Tikanga)
OK, I can reproduce it when I try on my Fedora box. The problem is that
log_connections emits a log message before init_ps_display() has been
called, and the ps_status.c logic isn't careful to ensure that it
returns something sane in that case. It accidentally failed to fail
too badly before I changed the elog.c logic, because there'd be an
embedded null after the program name in most cases. I suppose people
might even have thought that printing "postmaster" or "postgres" for
%i was intended behavior there.
I think the most useful fix is to create a static variable to hold the
notional strlen(ps_buffer), which will initialize to zero, and then
we can use that instead of groveling over the string in get_ps_display.
Should improve performance a tad as well as fixing this problem.
Will work on that.
regards, tom lane