Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id AABC0632979 for ; Thu, 27 May 2010 15:23:16 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 52271-01; Thu, 27 May 2010 18:23:09 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 879F86325E4; Thu, 27 May 2010 15:23:09 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o4RIN6ij004977; Thu, 27 May 2010 14:23:06 -0400 (EDT) To: Ray Stell cc: alvherre , pgsql-admin , pgsql-hackers@postgresql.org Subject: Re: command tag logging In-reply-to: <20100527172547.GA9472@cns.vt.edu> References: <20100526210833.GA14469@cns.vt.edu> <1274908611-sup-6661@alvh.no-ip.org> <3713.1274978989@sss.pgh.pa.us> <20100527172547.GA9472@cns.vt.edu> Comments: In-reply-to Ray Stell message dated "Thu, 27 May 2010 13:25:47 -0400" Date: Thu, 27 May 2010 14:23:06 -0400 Message-ID: <4976.1274984586@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.51 tagged_above=-10 required=5 tests=BAYES_05=-0.5, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/273 X-Sequence-Number: 34746 Ray Stell 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