Skip site navigation (1) Skip section navigation (2)

Re: Questions about pid file creation code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Questions about pid file creation code
Date: 2007-04-02 20:11:35
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> writes:
> 1) Is there still some reason have negative value in

Just to distinguish postmasters from standalone backends in the error
messages.  I think that's still useful.

> 2) Why 100? What race condition should happen? This piece of code looks 
> like kind of magic.

There are at least two race cases identified in the comments in the

> 3) Why pid checking and cleanup is in postgres? I think it is role of 
> pg_ctl or init scripts.

Let's see, instead of one place in the postgres code we should do it in
N places in different init scripts, and just trust to luck that a
particular installation is using an init script that knows to do that?
I don't think so.  Besides, how is the init script going to remove it
again?  It won't still be running when the postmaster exits.

> 4) The following condition is buggy, because atoi function does not have 
> defined result if parameter is not valid number.

>   if (other_pid <= 0)

It's not actually trying to validate the syntax of the lock file, only
to make certain it doesn't trigger any unexpected behavior in kill().
I don't think I've yet seen any reports that suggest that more syntax
checking of the lock file would be a useful activity.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Bruce MomjianDate: 2007-04-02 20:33:25
Subject: Bonjour patch
Previous:From: David FetterDate: 2007-04-02 20:10:05
Subject: Re: [HACKERS] Arrays of Complex Types

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group