Re: Segfault in pg_stat_activity - Mailing list pgsql-bugs

From Magnus Hagander
Subject Re: Segfault in pg_stat_activity
Date
Msg-id CABUevEzc3eXdbV4B986yh3Jf=DiptG4wFoXqg39Qrq71RuCsWw@mail.gmail.com
Whole thread Raw
In response to Re: Segfault in pg_stat_activity  (Andres Freund <andres@anarazel.de>)
List pgsql-bugs
On Mon, Jul 27, 2015 at 9:46 PM, Andres Freund <andres@anarazel.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/

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Hang on NOTIFY
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #13445: 8.15.1 is missleading regarding array dimensionality