BUG #5731: postmaster sometimes dumps core when handling local connections - Mailing list pgsql-bugs

From Alexander V. Chernikov
Subject BUG #5731: postmaster sometimes dumps core when handling local connections
Date
Msg-id 201010271519.o9RFJm2H088522@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5731: postmaster sometimes dumps core when handling local connections
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5731
Logged by:          Alexander V. Chernikov
Email address:      melifaro@ipfw.ru
PostgreSQL version: 8.4.5
Operating system:   FreeBSD 7.3
Description:        postmaster sometimes dumps core when handling local
connections
Details:

aluminium# gdb `which postgres` postgres.core

GNU gdb 6.1.1 [FreeBSD]



Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Core was generated by `postgres'.
Program terminated with signal 11, Segmentation fault.
.....
#0  0x0000000000638f1a in ConnCreate (serverFd=4) at postmaster.c:1939

1939            port->gss = (pg_gssinfo *) calloc(1, sizeof(pg_gssinfo));
(gdb) bt
#0  0x0000000000638f1a in ConnCreate (serverFd=4) at postmaster.c:1939
#1  0x0000000000637f88 in ServerLoop () at postmaster.c:1384
#2  0x000000000063777b in PostmasterMain (argc=3, argv=0x7fffffffec00) at
postmaster.c:1040
#3  0x00000000005c06da in main (argc=3, argv=0x7fffffffec00) at main.c:188
(gdb) p port
$1 = (Port *) 0x0


This simple patch seem to fix the problem

--- src/backend/postmaster/postmaster.c.orig    2010-10-27
19:07:42.000000000 +0400
+++ src/backend/postmaster/postmaster.c 2010-10-27 19:08:25.000000000 +0400
@@ -1917,7 +1917,7 @@
                if (port->sock >= 0)
                        StreamClose(port->sock);
                ConnFree(port);
-               port = NULL;
+               return NULL;
        }
        else
        {

pgsql-bugs by date:

Previous
From: "xieoy"
Date:
Subject: BUG #5730: The database cluster initialization failed
Next
From: Heikki Linnakangas
Date:
Subject: Re: BUG #5731: postmaster sometimes dumps core when handling local connections