Re: crash on bad database connect - Mailing list pgsql-hackers-win32

From Bruce Momjian
Subject Re: crash on bad database connect
Date
Msg-id 200404161257.i3GCv9U00168@candle.pha.pa.us
Whole thread Raw
In response to crash on bad database connect  ("Merlin Moncure" <merlin.moncure@rcsonline.com>)
List pgsql-hackers-win32
Merlin Moncure wrote:
> Right now, when I try and connect to a database on psql that doesn't
> exist, it crashes the postmaster.  All connections, etc. are from
> localhost.  Does anybody else get this?
> 
> Merlin
> 
> 
> LOG:  database system was shut down at 2004-04-15 17:35:00 Eastern
> Daylight Time
> LOG:  checkpoint record is at 0/A9A068
> LOG:  redo record is at 0/A9A068; undo record is at 0/0; shutdown TRUE
> LOG:  next transaction ID: 819; next OID: 25404
> LOG:  database system is ready
> FATAL:  database "Merlin.Moncure" does not exist
> LOG:  server process (PID 2764) exited with unexpected status 128
> LOG:  terminating any other active server processes
> WARNING:  terminating connection because of crash of another server
> process
> DETAIL:  The postmaster has commanded this server process to roll back
> the current transaction and e
> xit, because another server process exited abnormally and possibly
> corrupted shared memory.
> HINT:  In a moment you should be able to reconnect to the database and
> repeat your command.
> LOG:  all server processes terminated; reinitializing
> FATAL:  could not attach to proper memory at fixed address:
> shmget(key=5432001, addr=00F60000) faile
> d: No such file or directory

Sorry, this was caused by my fix to make SIGTERM safe.  I had forgotten
to deal with Warn_restart_ready properly.  Patch attached and applied.

Thanks for the report.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/utils/error/elog.c,v
retrieving revision 1.133
diff -c -c -r1.133 elog.c
*** src/backend/utils/error/elog.c    11 Apr 2004 00:54:45 -0000    1.133
--- src/backend/utils/error/elog.c    16 Apr 2004 12:55:49 -0000
***************
*** 448,453 ****
--- 448,457 ----
              if (in_fatal_exit)
                  ereport(PANIC, (errmsg("fatal error during fatal exit, giving up")));
  
+             /* not safe to longjump */
+             if (!Warn_restart_ready || proc_exit_inprogress)
+                 proc_exit(proc_exit_inprogress || !IsUnderPostmaster);
+ 
              /* We will exit the backend by simulating a client EOF */
              in_fatal_exit = true;
          }

pgsql-hackers-win32 by date:

Previous
From: "Merlin Moncure"
Date:
Subject: psql compiled with msys
Next
From: "Magnus Hagander"
Date:
Subject: Re: psql compiled with msys