Problems with starting Postgres

Started by Uros Gruberover 25 years ago5 messagesgeneral
Jump to latest
#1Uros Gruber
uros@sir-mag.com

Hi!

I started postgres with -i switch, but when i kill the proces i can't
start it anymore on the same port. I tried this five times and i can
start it now on 5 ports because i have to use everytime a new port.

I look in my /tmp and try to delete postgres files, but still don't
works. There is no proces running. I checked with netstat -a and there
is no open sockets.

This is an error

FATAL: StreamServerPort: bind() failed: Address already in use
Is another postmaster already running on that port?
If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
/usr/local/pgsql/bin/./postmaster: cannot create UNIX stream port

Any clues or help

Version of SQL is 7.0.3 and OS Linux Slack 7.1
Kernel 2.2.16
--
Uroďż˝ Gruber

#2Dominic J. Eidson
sauron@the-infinite.org
In reply to: Uros Gruber (#1)
Re: Problems with starting Postgres

On Sun, 10 Dec 2000, Uro��� Gruber wrote:

I started postgres with -i switch, but when i kill the proces i can't
start it anymore on the same port. I tried this five times and i can
start it now on 5 ports because i have to use everytime a new port.

I look in my /tmp and try to delete postgres files, but still don't
works. There is no proces running. I checked with netstat -a and there
is no open sockets.

Wait for 2 to 4 minutes, and try again. (Don't we set SO_REUSEADDR?)

--
Dominic J. Eidson
"Baruk Khazad! Khazad ai-menu!" - Gimli
-------------------------------------------------------------------------------
http://www.the-infinite.org/ http://www.the-infinite.org/~dominic/

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Uros Gruber (#1)
Re: Problems with starting Postgres

Uro� Gruber <uros@sir-mag.com> writes:

I started postgres with -i switch, but when i kill the proces i can't
start it anymore on the same port. I tried this five times and i can
start it now on 5 ports because i have to use everytime a new port.

FATAL: StreamServerPort: bind() failed: Address already in use
Is another postmaster already running on that port?
If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
/usr/local/pgsql/bin/./postmaster: cannot create UNIX stream port

How are you killing the postmaster?

A plain kill (SIGTERM) should remove the socket file on its way out.
The only thing that wouldn't is kill -9 ... if you're doing it that
way, don't.

regards, tom lane

#4Alessio Bragadini
alessio@albourne.com
In reply to: Uros Gruber (#1)
Re: Problems with starting Postgres

Tom Lane wrote:

A plain kill (SIGTERM) should remove the socket file on its way out.
The only thing that wouldn't is kill -9 ... if you're doing it that
way, don't.

The problem is an unexpected crash/reboot of the machine (which
shouldn't happen, but...) that leaves socket files in /tmp and requires
manual tweaking after the machine is up again. Maybe it's our
installation, but we need a more reliable pg_ctl

--
Alessio F. Bragadini alessio@albourne.com
APL Financial Services http://village.albourne.com
Nicosia, Cyprus phone: +357-2-755750

"It is more complicated than you think"
-- The Eighth Networking Truth from RFC 1925

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alessio Bragadini (#4)
Re: Problems with starting Postgres

Alessio Bragadini <alessio@albourne.com> writes:

The problem is an unexpected crash/reboot of the machine (which
shouldn't happen, but...) that leaves socket files in /tmp and requires
manual tweaking after the machine is up again. Maybe it's our
installation, but we need a more reliable pg_ctl

A lot of people (including me) set up their boot-time script to
unconditionally delete /tmp/.s.PGSQL.5432 before launching the new
postmaster. Of course this is pretty dangerous if you are in the
habit of using the same script for hand restarts, since you might
zap a socket belonging to a live postmaster.

With any luck the problem will go away in 7.1 --- it has what I hope
will prove to be a more robust scheme for deleting old socket files
than the current one.

regards, tom lane