Invalid pg_hba.conf => Postgres crash
Hi all,
running postgres 7.4.1
2 different behavior:
- Inserting the following invalid line on pg_hba.conf
host all all 127.0.0.1 trust sameuser # HANG
the future connections will hang leaving a postgres process
running
- Inserting the following line instead will crash postgres
host all 127.0.0.1 trust sameuser # CRASH
#psql kalman
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
and in the log:
LOG: server process (PID 17656) was terminated by signal 11
LOG: terminating any other active server processes
LOG: all server processes terminated; reinitializing
LOG: database system was interrupted at 2004-04-24 12:27:37 CEST
LOG: checkpoint record is at 0/4877FD38
LOG: redo record is at 0/4877FD38; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 195700; next OID: 5718523
LOG: database system was not properly shut down; automatic recovery in
progress
LOG: record with zero length at 0/4877FD78
LOG: redo is not required
LOG: database system is ready
Regards
Gaetano Mendola
Gaetano Mendola <mendola@bigfoot.com> writes:
host all all 127.0.0.1 trust sameuser # HANG
the future connections will hang leaving a postgres process
running
- Inserting the following line instead will crash postgres
host all 127.0.0.1 trust sameuser # CRASH
I was able to reproduce the crash but not the hang. Would you see if
the attached patch fixes both symptoms on your machine?
regards, tom lane
Index: ip.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/libpq/ip.c,v
retrieving revision 1.23
diff -c -r1.23 ip.c
*** ip.c 12 Sep 2003 20:18:51 -0000 1.23
--- ip.c 24 Apr 2004 20:09:21 -0000
***************
*** 67,74 ****
*/
int
getaddrinfo_all(const char *hostname, const char *servname,
! const struct addrinfo * hintp, struct addrinfo ** result)
{
#ifdef HAVE_UNIX_SOCKETS
if (hintp != NULL && hintp->ai_family == AF_UNIX)
return getaddrinfo_unix(servname, hintp, result);
--- 67,77 ----
*/
int
getaddrinfo_all(const char *hostname, const char *servname,
! const struct addrinfo *hintp, struct addrinfo **result)
{
+ /* not all versions of getaddrinfo() zero *result on failure */
+ *result = NULL;
+
#ifdef HAVE_UNIX_SOCKETS
if (hintp != NULL && hintp->ai_family == AF_UNIX)
return getaddrinfo_unix(servname, hintp, result);
Tom Lane wrote:
I was able to reproduce the crash but not the hang. Would you see if
the attached patch fixes both symptoms on your machine?
Yes, problem gone.
I discover however that what I was believing an hang was in reality
just a delayed crash.
Regards
Gaetano Mendola