Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZJoQr-0003pn-9l for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Jul 2015 19:51:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZJoQq-0004Ca-MG for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Jul 2015 19:51:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZJoQE-0003Tn-P5 for pgsql-bugs@postgresql.org; Mon, 27 Jul 2015 19:50:50 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZJoQC-0000kc-2n for pgsql-bugs@postgresql.org; Mon, 27 Jul 2015 19:50:50 +0000 Received: from intern.anarazel.de (ns1.anarazel.de [217.115.131.41]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id B5AA6860003; Mon, 27 Jul 2015 21:50:36 +0200 (CEST) Date: Mon, 27 Jul 2015 21:46:57 +0200 From: Andres Freund To: "Peter J. Holzer" Cc: Magnus Hagander , pgsql-bugs@postgresql.org Subject: Re: Segfault in pg_stat_activity Message-ID: <20150727194657.GH5106@alap3.anarazel.de> References: <20150727192033.GB11689@hjp.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150727192033.GB11689@hjp.at> X-Pg-Spam-Score: -5.5 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi Peter, Magnus, On 2015-07-27 21:20:33 +0200, Peter J. Holzer wrote: > Since I've installed 9.5alpha1 a week ago, I've seen several segfaults > in the log file: Thanks for reporting the issue. I guess you have several ssl enabled connections? > Core was generated by `postgres: postgres template1 [local] SELECT '. > Program terminated with signal SIGSEGV, Segmentation fault. > #0 0x00007fb94d314289 in memcpy (__len=200, __src=0x7fb948719ad8, __dest=0x7fb94f4c1bb0) at /usr/include/x86_64-linux-gnu/bits/string3.h:51 > 51 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); > (gdb) bt > #0 0x00007fb94d314289 in memcpy (__len=200, __src=0x7fb948719ad8, __dest=0x7fb94f4c1bb0) at /usr/include/x86_64-linux-gnu/bits/string3.h:51 > #1 pgstat_read_current_status () at /tmp/buildd/postgresql-9.5-9.5~alpha1/build/../src/backend/postmaster/pgstat.c:3000 > #2 0x00007fb94d318db1 in pgstat_read_current_status () at /tmp/buildd/postgresql-9.5-9.5~alpha1/build/../src/backend/postmaster/pgstat.c:2434 Uh. I think I see what's going on here. Magnus, could it be that you didn't intend the += for localsslstatus?: /* Only valid entries get included into the local array */ if (localentry->backendStatus.st_procpid > 0) { BackendIdGetTransactionIds(i, &localentry->backend_xid, &localentry->backend_xmin); localentry++; localappname += NAMEDATALEN; localactivity += pgstat_track_activity_query_size; #ifdef USE_SSL localsslstatus += sizeof(PgBackendSSLStatus); #endif localNumBackends++; } because that'll forward localsslstatus not one, but uh, something like 200. I think just replacing the above += with 1 might fix the issue. Can't test just now. Greetings, Andres Freund -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs