Thread: Postmaster shuts down after rebuilding database via psql

Postmaster shuts down after rebuilding database via psql

From
"Averbukh Stella"
Date:

Hello,

I experience following problem.  I have postgreSQL installed on sparc10.  During the day, I have to drop and create 100+ tables several times per day.  After I do it in psql, quit it and run my application I get following error:

could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Before I recreate the database, I do ps -aef | grep postmaster.  Bellow is the output of the ps command.

postgres  2866     1   0 16:21:09 pts/5       0:00 /postgres/bin/postmaster
postgres  2869  2866   0 16:21:11 pts/5       0:00 /postgres/bin/postmaster
postgres  2870  2869   0 16:21:11 pts/5       0:00 /postgres/bin/postmaster
postgres  3391  2581   0 09:34:25 pts/1       0:00 grep postmaster
postgres  2877  2866   0 16:24:41 pts/5       0:00 /postgres/bin/postmaster
postgres  2868  2866   0 16:21:11 pts/5       0:29 /postgres/bin/postmaster
postgres  2890  2866   0 16:51:37 pts/5       0:00 /postgres/bin/postmaster

After database was recreated, I do the same ps command but the output is completely different.  The main postmaster process is gone and there are couple of subprocesses that are still hanging there.

$ ps -aef | grep postmaster
postgres  3416     1   0 09:54:59 pts/5       0:01 /postgres/bin/postmaster
postgres  3394     1   0 09:35:29 pts/5       0:03 /postgres/bin/postmaster
postgres  2877     1   0 16:24:41 pts/5       0:00 /postgres/bin/postmaster
postgres  3428  2581   0 10:01:53 pts/1       0:00 grep postmaster

When I try to stop postmaster using pg_ctl, it tells me that it can't stop it because process with pid xxx does not exist.  The postmaster.pid file contains pid of the dead process.

$ more postmaster.pid
2866
/postgres/data
  5432001        39

So to successfully restart postmaster, I have to remove the postmaster.pid file, then kill all other postmaster subprocesses.

Did anybody bump into this problem before and can give me suggestions on how make it more stable?

Thank you.

Stella Averbukh
_________________________________
Senior Software Lead, Arbitron Inc.
Phone: (410) 312-8387
Fax: (410) 312-8614
e-mail: <mailto:stella.averbukh@arbitron.com>

Re: Postmaster shuts down after rebuilding database via psql

From
Tom Lane
Date:
"Averbukh Stella" <Stella.Averbukh@arbitron.com> writes:
> After database was recreated, I do the same ps command but the output is
> completely different.  The main postmaster process is gone and there are
> couple of subprocesses that are still hanging there.

Crashes of the main postmaster process are pretty unusual.  You haven't
given us much of anything to go on though.  Look in the postmaster log
to see if it emits an error message when it quits.  Look for a core dump
file and gdb it to get a stack trace.  (Make sure you are starting the
postmaster under a ulimit setting that allows dumping core.)

What Postgres version is this exactly, and what operating system?
(No, "sparc10" is not an operating system.)

            regards, tom lane