Thread: Postgres server goes in recovery mode repeteadly

Postgres server goes in recovery mode repeteadly

From
kunal sharma
Date:
Hi ,
        We are using Postgres 8.4 and its been found going into recovery mode couple of times. The server process seems to fork another child process which is another postgres server running under same data directory and after some time it goes away while the old server is still running. There were few load issues on the server but the load didnt went above "32".

   We are running opensuse 10.2 x86_64 with 32Gb of physical memory.
Checking the logs I found that theres a segmentation fault ,
 

Sep 26 05:39:54 pace kernel: postgres[28694]: segfault at 0000000000000030 rip 000000000066ba8c rsp 00007fffd364da30 error 4

gdb dump shows this

Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libnss_files.so.2...done.
Loaded symbols for /lib64/libnss_files.so.2
0x00002ad6d7b8c2b3 in __select_nocancel () from /lib64/libc.so.6
(gdb)


  Any suggestions what is causing this segmentation fault?

Re: Postgres server goes in recovery mode repeteadly

From
Andrew Dunstan
Date:

kunal sharma wrote:
> Hi ,
>         We are using Postgres 8.4 and its been found going into
> recovery mode couple of times. The server process seems to fork
> another child process which is another postgres server running under
> same data directory and after some time it goes away while the old
> server is still running. There were few load issues on the server but
> the load didnt went above "32".
>
>    We are running opensuse 10.2 x86_64 with 32Gb of physical memory.
> Checking the logs I found that theres a segmentation fault ,
>
>
> Sep 26 05:39:54 pace kernel: postgres[28694]: segfault at
> 0000000000000030 rip 000000000066ba8c rsp 00007fffd364da30 error 4
>
> gdb dump shows this
>
> Reading symbols from /lib64/libdl.so.2...done.
> Loaded symbols for /lib64/libdl.so.2
> Reading symbols from /lib64/libm.so.6...done.
> Loaded symbols for /lib64/libm.so.6
> Reading symbols from /lib64/libc.so.6...done.
> Loaded symbols for /lib64/libc.so.6
> Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
> Loaded symbols for /lib64/ld-linux-x86-64.so.2
> Reading symbols from /lib64/libnss_files.so.2...done.
> Loaded symbols for /lib64/libnss_files.so.2
> 0x00002ad6d7b8c2b3 in __select_nocancel () from /lib64/libc.so.6
> (gdb)
>
>
>
>

Please try to get a backtrace from gdb.

cheers

andrew

Re: [ADMIN] Postgres server goes in recovery mode repeteadly

From
Tom Lane
Date:
kunal sharma <ksharma.linux@gmail.com> writes:
>         We are using Postgres 8.4 and its been found going into recovery

8.4.what?  (If not 8.4.1, an update would be the first thing to try.)

> Checking the logs I found that theres a segmentation fault ,

> Sep 26 05:39:54 pace kernel: postgres[28694]: segfault at 0000000000000030
> rip 000000000066ba8c rsp 00007fffd364da30 error 4

> gdb dump shows this

> Reading symbols from /lib64/libdl.so.2...done.
> Loaded symbols for /lib64/libdl.so.2
> Reading symbols from /lib64/libm.so.6...done.
> Loaded symbols for /lib64/libm.so.6
> Reading symbols from /lib64/libc.so.6...done.
> Loaded symbols for /lib64/libc.so.6
> Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
> Loaded symbols for /lib64/ld-linux-x86-64.so.2
> Reading symbols from /lib64/libnss_files.so.2...done.
> Loaded symbols for /lib64/libnss_files.so.2
> 0x00002ad6d7b8c2b3 in __select_nocancel () from /lib64/libc.so.6
> (gdb)

A segfault inside select() seems fairly unlikely.  I suspect that you
used the wrong executable or otherwise got the wrong result here.
Please double-check, and next time show the whole stack trace ("bt")
not just the top function.

            regards, tom lane

Re: Postgres server goes in recovery mode repeteadly

From
kunal sharma
Date:
gdb backtrce-


(gdb) bt full
#0  0x00002ad6d7b8c2b3 in __select_nocancel () from /lib64/libc.so.6
No symbol table info available.
#1  0x00000000005a39bc in ServerLoop () at postmaster.c:1304
        timeout = {tv_sec = 55, tv_usec = 352000}
        rmask = {fds_bits = {24, 0 <repeats 15 times>}}
        selres = <value optimized out>
        readmask = {fds_bits = {24, 0 <repeats 15 times>}}
        nSockets = 5
        now = 1254241068
        last_touch_time = 1254238950
        __func__ = "ServerLoop"
#2  0x00000000005a4dba in PostmasterMain (argc=3, argv=0xb1e3d0) at postmaster.c:1040
        fpidfile = (FILE *) 0x3
        opt = <value optimized out>
        status = <value optimized out>
        userDoption = 0x1 <Address 0x1 out of bounds>
        __func__ = "PostmasterMain"
#3  0x0000000000553b5e in main (argc=3, argv=0xb1e3d0) at main.c:188
No locals.
(gdb)

2009/9/29 Andrew Dunstan <andrew@dunslane.net>


kunal sharma wrote:
Hi ,
       We are using Postgres 8.4 and its been found going into recovery mode couple of times. The server process seems to fork another child process which is another postgres server running under same data directory and after some time it goes away while the old server is still running. There were few load issues on the server but the load didnt went above "32".

  We are running opensuse 10.2 x86_64 with 32Gb of physical memory.
Checking the logs I found that theres a segmentation fault ,
 
Sep 26 05:39:54 pace kernel: postgres[28694]: segfault at 0000000000000030 rip 000000000066ba8c rsp 00007fffd364da30 error 4

gdb dump shows this

Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libnss_files.so.2...done.
Loaded symbols for /lib64/libnss_files.so.2
0x00002ad6d7b8c2b3 in __select_nocancel () from /lib64/libc.so.6
(gdb)


 

Please try to get a backtrace from gdb.

cheers

andrew

Re: [ADMIN] Postgres server goes in recovery mode repeteadly

From
Tom Lane
Date:
kunal sharma <ksharma.linux@gmail.com> writes:
> gdb backtrce-
> (gdb) bt full
> #0  0x00002ad6d7b8c2b3 in __select_nocancel () from /lib64/libc.so.6
> No symbol table info available.
> #1  0x00000000005a39bc in ServerLoop () at postmaster.c:1304
>         timeout = {tv_sec = 55, tv_usec = 352000}

I think what you're showing us is a stack trace of an idle postmaster
process, not the process that crashed.

            regards, tom lane

Re: Postgres server goes in recovery mode repeteadly

From
daveg
Date:
On Tue, Sep 29, 2009 at 09:52:06PM +0530, kunal sharma wrote:
> Hi ,
>         We are using Postgres 8.4 and its been found going into recovery
> mode couple of times. The server process seems to fork another child process
> which is another postgres server running under same data directory and after
> some time it goes away while the old server is still running. There were few
> load issues on the server but the load didnt went above "32".
> 
>    We are running opensuse 10.2 x86_64 with 32Gb of physical memory.
> Checking the logs I found that theres a segmentation fault ,
> 
> 
> Sep 26 05:39:54 pace kernel: postgres[28694]: segfault at 0000000000000030
> rip 000000000066ba8c rsp 00007fffd364da30 error 4
> 
> gdb dump shows this
> 
> Reading symbols from /lib64/libdl.so.2...done.
> Loaded symbols for /lib64/libdl.so.2
> Reading symbols from /lib64/libm.so.6...done.
> Loaded symbols for /lib64/libm.so.6
> Reading symbols from /lib64/libc.so.6...done.
> Loaded symbols for /lib64/libc.so.6
> Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
> Loaded symbols for /lib64/ld-linux-x86-64.so.2
> Reading symbols from /lib64/libnss_files.so.2...done.
> Loaded symbols for /lib64/libnss_files.so.2
> 0x00002ad6d7b8c2b3 in __select_nocancel () from /lib64/libc.so.6
> (gdb)
> 
>   Any suggestions what is causing this segmentation fault?

I work with Kunal and have been looking into this. It appears to be the same
as the bug described in:
 http://archives.postgresql.org/pgsql-bugs/2009-09/msg00355.php

as I have localized it to a NULL pointer deference in
RelationCacheInitializePhase2() as well. Tom speculates in:
 http://archives.postgresql.org/pgsql-bugs/2009-09/msg00372.php

that large numbers of table drops might trigger this. The system in question
creates and drops temp tables at a high rate which tends to confirm this. 

-dg

-- 
David Gould       daveg@sonic.net      510 536 1443    510 282 0869
If simplicity worked, the world would be overrun with insects.


Re: Postgres server goes in recovery mode repeteadly

From
Alvaro Herrera
Date:
daveg escribió:

> I work with Kunal and have been looking into this. It appears to be the same
> as the bug described in:
> 
>   http://archives.postgresql.org/pgsql-bugs/2009-09/msg00355.php
> 
> as I have localized it to a NULL pointer deference in
> RelationCacheInitializePhase2() as well. Tom speculates in:
> 
>   http://archives.postgresql.org/pgsql-bugs/2009-09/msg00372.php
> 
> that large numbers of table drops might trigger this. The system in question
> creates and drops temp tables at a high rate which tends to confirm this. 

Did you test the patch posted by Tom?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Postgres server goes in recovery mode repeteadly

From
daveg
Date:
On Fri, Oct 02, 2009 at 10:41:07AM -0400, Alvaro Herrera wrote:
> daveg escribió:
> 
> > I work with Kunal and have been looking into this. It appears to be the same
> > as the bug described in:
> > 
> >   http://archives.postgresql.org/pgsql-bugs/2009-09/msg00355.php
> > 
> > as I have localized it to a NULL pointer deference in
> > RelationCacheInitializePhase2() as well. Tom speculates in:
> > 
> >   http://archives.postgresql.org/pgsql-bugs/2009-09/msg00372.php
> > 
> > that large numbers of table drops might trigger this. The system in question
> > creates and drops temp tables at a high rate which tends to confirm this. 
> 
> Did you test the patch posted by Tom?

We are testing it since last night in our test environment. If it does not
break anything (unlikely) we will deploy it next week. However, since the
problem is only occasional, only happens every few days on one of 50+ hosts,
it will take some extended time without further segfaults to say anything
confident about the patches effectiveness.

-dg
-- 
David Gould       daveg@sonic.net      510 536 1443    510 282 0869
If simplicity worked, the world would be overrun with insects.


Re: Postgres server goes in recovery mode repeteadly

From
daveg
Date:
On Fri, Oct 02, 2009 at 07:57:13PM -0700, daveg wrote:
> On Fri, Oct 02, 2009 at 10:41:07AM -0400, Alvaro Herrera wrote:
> > daveg escribió:
> > 
> > > I work with Kunal and have been looking into this. It appears to be the same
> > > as the bug described in:
> > > 
> > >   http://archives.postgresql.org/pgsql-bugs/2009-09/msg00355.php
> > > 
> > > as I have localized it to a NULL pointer deference in
> > > RelationCacheInitializePhase2() as well. Tom speculates in:
> > > 
> > >   http://archives.postgresql.org/pgsql-bugs/2009-09/msg00372.php
> > > 
> > > that large numbers of table drops might trigger this. The system in question
> > > creates and drops temp tables at a high rate which tends to confirm this. 
> > 
> > Did you test the patch posted by Tom?
> 
> We are testing it since last night in our test environment. If it does not
> break anything (unlikely) we will deploy it next week. However, since the
> problem is only occasional, only happens every few days on one of 50+ hosts,
> it will take some extended time without further segfaults to say anything
> confident about the patches effectiveness.

We have had this deployed in our test and production environments for a 
couple weeks now. We have not seen any further instance of the problem.
Without the patch, we would have expected to see at least a few by now.
So the patch appears to be effective.

-dg
-- 
David Gould       daveg@sonic.net      510 536 1443    510 282 0869
If simplicity worked, the world would be overrun with insects.


Re: Postgres server goes in recovery mode repeteadly

From
Tom Lane
Date:
daveg <daveg@sonic.net> writes:
> We have had this deployed in our test and production environments for a 
> couple weeks now. We have not seen any further instance of the problem.
> Without the patch, we would have expected to see at least a few by now.
> So the patch appears to be effective.

Cool, thanks for the follow-up.
        regards, tom lane