Re: Segfault in pg_stat_activity

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Segfault in pg_stat_activity
Date: 2015-08-09 13:07:37
Message-ID: CABUevEzc3eXdbV4B986yh3Jf=DiptG4wFoXqg39Qrq71RuCsWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jul 27, 2015 at 9:46 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:

> 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?:
>

That looks like a leftover from when the whole struct was in there, and not
just a pointer. Yikes.

I have no idea how that managed to pass through my testing. I certainly
tried it out with multiple SSL connections. I must've fxxored something in
my build so I was testing the wrong thing :S

I see Tom has fixed it -- thanks!

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2015-08-10 00:08:49 Re: BUG #13445: 8.15.1 is missleading regarding array dimensionality
Previous Message Tom Lane 2015-08-07 19:40:18 Re: Hang on NOTIFY