Sure enough, the lock file is gone

Started by Peter Eisentrautabout 25 years ago71 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

The 'tmpwatch' program on Red Hat will remove the /tmp/.s.PGSQL.5432.lock
file after the server has run 6 days. This will be a problem.

We could touch (open) the file once every time the ServerLoop() runs
around. It's not perfect but it should work in practice.

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/

#2Bruce Momjian
bruce@momjian.us
In reply to: Peter Eisentraut (#1)
Re: Sure enough, the lock file is gone

The 'tmpwatch' program on Red Hat will remove the /tmp/.s.PGSQL.5432.lock
file after the server has run 6 days. This will be a problem.

We could touch (open) the file once every time the ServerLoop() runs
around. It's not perfect but it should work in practice.

If we have to do it, let's make it an #ifdef __linux__ option.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#3Ross J. Reedstrom
reedstrm@rice.edu
In reply to: Bruce Momjian (#2)
Re: Sure enough, the lock file is gone

On Fri, Jan 26, 2001 at 03:18:13PM -0500, Bruce Momjian wrote:

The 'tmpwatch' program on Red Hat will remove the /tmp/.s.PGSQL.5432.lock
file after the server has run 6 days. This will be a problem.

We could touch (open) the file once every time the ServerLoop() runs
around. It's not perfect but it should work in practice.

If we have to do it, let's make it an #ifdef __linux__ option.

#ifdef BRAINDAMAGED_TMP_CLEANER ?

ISTR mention of non-linux platforms that do this.

Ross

#4Alfred Perlstein
bright@wintelcom.net
In reply to: Peter Eisentraut (#1)
Re: Sure enough, the lock file is gone

* Peter Eisentraut <peter_e@gmx.net> [010126 12:11] wrote:

The 'tmpwatch' program on Red Hat will remove the /tmp/.s.PGSQL.5432.lock
file after the server has run 6 days. This will be a problem.

We could touch (open) the file once every time the ServerLoop() runs
around. It's not perfect but it should work in practice.

Why not have the RPM/configure scripts stick it in where ever redhat
says it's safe to?

--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."

#5Jan Wieck
JanWieck@Yahoo.com
In reply to: Ross J. Reedstrom (#3)
Re: Sure enough, the lock file is gone

Ross J. Reedstrom wrote:

On Fri, Jan 26, 2001 at 03:18:13PM -0500, Bruce Momjian wrote:

The 'tmpwatch' program on Red Hat will remove the /tmp/.s.PGSQL.5432.lock
file after the server has run 6 days. This will be a problem.

We could touch (open) the file once every time the ServerLoop() runs
around. It's not perfect but it should work in practice.

If we have to do it, let's make it an #ifdef __linux__ option.

#ifdef BRAINDAMAGED_TMP_CLEANER ?

ISTR mention of non-linux platforms that do this.

Exactly the way you want it to do (open(2) and close(2) of a
UNIX domain socket) was what I had to do to get an old
Mach3-4.3BSD combo into a kernel-panic.

Better use utime(2) or the like for it.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

#6Peter Eisentraut
peter_e@gmx.net
In reply to: Bruce Momjian (#2)
Re: Sure enough, the lock file is gone

Bruce Momjian writes:

If we have to do it, let's make it an #ifdef __linux__ option.

What does Linux have to do with it? FreeBSD does the same thing, only
every three days. I dont' know whether it's not enabled on a fresh
install, but it's there, you only need to flip the switch. I doubt /tmp
cleaning is such an unusual thing, especially on large sites.

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/

#7Peter Eisentraut
peter_e@gmx.net
In reply to: Jan Wieck (#5)
Re: Sure enough, the lock file is gone

Jan Wieck writes:

Exactly the way you want it to do (open(2) and close(2) of a
UNIX domain socket) was what I had to do to get an old
Mach3-4.3BSD combo into a kernel-panic.

The lock file is an ordinary file.

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#6)
Re: Sure enough, the lock file is gone

Peter Eisentraut <peter_e@gmx.net> writes:

Bruce Momjian writes:

If we have to do it, let's make it an #ifdef __linux__ option.

What does Linux have to do with it? FreeBSD does the same thing, only
every three days. I dont' know whether it's not enabled on a fresh
install, but it's there, you only need to flip the switch. I doubt /tmp
cleaning is such an unusual thing, especially on large sites.

Yes, there are lots of systems that will clean /tmp --- and since the
lock file is an ordinary file (not a socket) pretty much any tmp-cleaner
is going to decide to remove it. I think that I had intended to insert
a periodic touch of the lockfile and forgot to.

Touching it every time through ServerLoop is an overreaction though.
I'd suggest touching it in the checkpoint-process-firing code, which
runs every five minutes (or so?) by default.

regards, tom lane

#9Jan Wieck
JanWieck@Yahoo.com
In reply to: Peter Eisentraut (#7)
Re: Sure enough, the lock file is gone

Peter Eisentraut wrote:

Jan Wieck writes:

Exactly the way you want it to do (open(2) and close(2) of a
UNIX domain socket) was what I had to do to get an old
Mach3-4.3BSD combo into a kernel-panic.

The lock file is an ordinary file.

So the crazy-temp-vacuum-cleaner on linux doesn't touch the
sockets?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

#10Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom Lane (#8)
Re: Sure enough, the lock file is gone

I said:

Yes, there are lots of systems that will clean /tmp --- and since the
lock file is an ordinary file (not a socket) pretty much any tmp-cleaner
is going to decide to remove it. I think that I had intended to insert
a periodic touch of the lockfile and forgot to.

Done now.

regards, tom lane

#11Bruce Momjian
bruce@momjian.us
In reply to: Ross J. Reedstrom (#3)
Re: Sure enough, the lock file is gone

On Fri, Jan 26, 2001 at 03:18:13PM -0500, Bruce Momjian wrote:

The 'tmpwatch' program on Red Hat will remove the /tmp/.s.PGSQL.5432.lock
file after the server has run 6 days. This will be a problem.

We could touch (open) the file once every time the ServerLoop() runs
around. It's not perfect but it should work in practice.

If we have to do it, let's make it an #ifdef __linux__ option.

#ifdef BRAINDAMAGED_TMP_CLEANER ?

ISTR mention of non-linux platforms that do this.

Yes, thank you.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#12Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#10)
Re: Sure enough, the lock file is gone

I said:

Yes, there are lots of systems that will clean /tmp --- and since the
lock file is an ordinary file (not a socket) pretty much any tmp-cleaner
is going to decide to remove it. I think that I had intended to insert
a periodic touch of the lockfile and forgot to.

Done now.

Yes, checkpoint is a good place to put it. Thanks. I still liked the
BRAINDAMAGED_TMP_CLEANER though.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#13Bruce Guenter
bruceg@em.ca
In reply to: Jan Wieck (#9)
Re: Sure enough, the lock file is gone

On Fri, Jan 26, 2001 at 05:06:24PM -0500, Jan Wieck wrote:

So the crazy-temp-vacuum-cleaner on linux doesn't touch the
sockets?

The tmpwatch program that comes with many Linux distributions will only
unlink regular files and empty directories by default.
--
Bruce Guenter <bruceg@em.ca> http://em.ca/~bruceg/

#14GB Clark II
gclarkii@geektech.com
In reply to: Peter Eisentraut (#6)
Re: Sure enough, the lock file is gone

On Fri, 26 Jan 2001, Peter Eisentraut wrote:

Bruce Momjian writes:

If we have to do it, let's make it an #ifdef __linux__ option.

What does Linux have to do with it? FreeBSD does the same thing, only
every three days. I dont' know whether it's not enabled on a fresh
install, but it's there, you only need to flip the switch. I doubt /tmp
cleaning is such an unusual thing, especially on large sites.

Only on a poorly configured FreeBSD box. You do have to turn it on first.
FreeBSD (This is a 4.2-Stable box) will only delete files that have not been
modified within the set number of days. This amount is variable. You can also
tell clean_tmp to ignore any files you wish. This is all configurable via
rc.conf and friends.

GB

--
GB Clark II | Roaming FreeBSD Admin
gclarkii@GeekTech.COM | General Geek
CTHULU for President - Why choose the lesser of two evils?

#15Oliver Elphick
olly@lfix.co.uk
In reply to: GB Clark II (#14)
Re: Sure enough, the lock file is gone

Jan Wieck wrote:

Peter Eisentraut wrote:

Jan Wieck writes:

Exactly the way you want it to do (open(2) and close(2) of a
UNIX domain socket) was what I had to do to get an old
Mach3-4.3BSD combo into a kernel-panic.

The lock file is an ordinary file.

So the crazy-temp-vacuum-cleaner on linux doesn't touch the
sockets?

tmpreaper does - that's why I moved the socket in Debian.

--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Come now, and let us reason together, saith the LORD;
though your sins be as scarlet, they shall be as white
as snow; though they be red like crimson, they shall
be as wool." Isaiah 1:18

#16Florent Guillaume
efgeor@noos.fr
In reply to: Peter Eisentraut (#1)
Re: Sure enough, the lock file is gone

/tmp is for *temporary* files. Such a lock is not a temporary file, it
should go somewhere in /var, why not in /var/lib/pgsql/data ?

Show quoted text

The 'tmpwatch' program on Red Hat will remove the /tmp/.s.PGSQL.5432.lock
file after the server has run 6 days. This will be a problem.

We could touch (open) the file once every time the ServerLoop() runs
around. It's not perfect but it should work in practice.

#17Alessio Bragadini
alessio@sevenseas.org
In reply to: Florent Guillaume (#16)
Re: Re: Sure enough, the lock file is gone

Florent Guillaume:

/tmp is for *temporary* files. Such a lock is not a temporary file,
it should go somewhere in /var, why not in /var/lib/pgsql/data ?

/var/run ?

--
Alessio F. Bragadini alessio@sevenseas.org

#18Bruce Momjian
bruce@momjian.us
In reply to: Oliver Elphick (#15)
Re: Sure enough, the lock file is gone

Jan Wieck wrote:

Peter Eisentraut wrote:

Jan Wieck writes:

Exactly the way you want it to do (open(2) and close(2) of a
UNIX domain socket) was what I had to do to get an old
Mach3-4.3BSD combo into a kernel-panic.

The lock file is an ordinary file.

So the crazy-temp-vacuum-cleaner on linux doesn't touch the
sockets?

tmpreaper does - that's why I moved the socket in Debian.

But you have complete control over the OS, while we don't. The problem
I see of moving it is that only Debian-compiled clients will work on
Debian systems.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#19Lamar Owen
lamar.owen@wgcr.org
In reply to: Florent Guillaume (#16)
Re: Re: Sure enough, the lock file is gone

Florent Guillaume wrote:

/tmp is for *temporary* files. Such a lock is not a temporary file, it
should go somewhere in /var, why not in /var/lib/pgsql/data ?

/var/lib is also not for locks, per FHS.

/var/lock/pgsql (or /var/lock/postgresql....) would be the FHS-mandated
place for such a file.

Comments? _Why_ is the lock in /tmp? Won't the lock always be put into
place by the uid used to run postmaster? Is a _world_ writeable
temporary directory the right place?

7.2 discussion, however, IMHO.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

#20The Hermit Hacker
scrappy@hub.org
In reply to: Lamar Owen (#19)
Re: Re: Sure enough, the lock file is gone

first off, the lock file is put in by an unprivileged user, so /tmp works
on all systems ...

second, /tmp on a large portion of systems gets cleaned out after a
reboot, so there are no 'stray locks' to generally worry about...

On Sat, 27 Jan 2001, Lamar Owen wrote:

Florent Guillaume wrote:

/tmp is for *temporary* files. Such a lock is not a temporary file, it
should go somewhere in /var, why not in /var/lib/pgsql/data ?

/var/lib is also not for locks, per FHS.

/var/lock/pgsql (or /var/lock/postgresql....) would be the FHS-mandated
place for such a file.

Comments? _Why_ is the lock in /tmp? Won't the lock always be put into
place by the uid used to run postmaster? Is a _world_ writeable
temporary directory the right place?

7.2 discussion, however, IMHO.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org

#21Lamar Owen
lamar.owen@wgcr.org
In reply to: The Hermit Hacker (#20)
#22Lamar Owen
lamar.owen@wgcr.org
In reply to: Lamar Owen (#21)
#23Peter Eisentraut
peter_e@gmx.net
In reply to: Lamar Owen (#21)
#24Tom Lane
tgl@sss.pgh.pa.us
In reply to: Lamar Owen (#22)
#25Oliver Elphick
olly@lfix.co.uk
In reply to: Tom Lane (#24)
#26Florent Guillaume
efgeor@noos.fr
In reply to: Tom Lane (#24)
#27Tom Lane
tgl@sss.pgh.pa.us
In reply to: Oliver Elphick (#25)
In reply to: Tom Lane (#24)
#29Tom Lane
tgl@sss.pgh.pa.us
In reply to: Trond Eivind Glomsrød (#28)
#30Lamar Owen
lamar.owen@wgcr.org
In reply to: Peter Eisentraut (#23)
In reply to: Lamar Owen (#30)
#32Oliver Elphick
olly@lfix.co.uk
In reply to: Trond Eivind Glomsrød (#31)
#33Lamar Owen
lamar.owen@wgcr.org
In reply to: Peter Eisentraut (#23)
#34Peter Eisentraut
peter_e@gmx.net
In reply to: Lamar Owen (#33)
#35Lamar Owen
lamar.owen@wgcr.org
In reply to: Peter Eisentraut (#34)
#36Tom Lane
tgl@sss.pgh.pa.us
In reply to: Trond Eivind Glomsrød (#31)
#37Tom Lane
tgl@sss.pgh.pa.us
In reply to: Lamar Owen (#33)
#38Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#34)
In reply to: Tom Lane (#36)
#40Tom Lane
tgl@sss.pgh.pa.us
In reply to: Lamar Owen (#35)
#41Lamar Owen
lamar.owen@wgcr.org
In reply to: Peter Eisentraut (#23)
#42Tom Lane
tgl@sss.pgh.pa.us
In reply to: Trond Eivind Glomsrød (#39)
#43Lamar Owen
lamar.owen@wgcr.org
In reply to: Peter Eisentraut (#34)
#44Lamar Owen
lamar.owen@wgcr.org
In reply to: Oliver Elphick (#32)
#45Lamar Owen
lamar.owen@wgcr.org
In reply to: Peter Eisentraut (#34)
In reply to: Lamar Owen (#44)
In reply to: Tom Lane (#42)
#48Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#38)
#49Tom Lane
tgl@sss.pgh.pa.us
In reply to: Lamar Owen (#43)
#50Tom Lane
tgl@sss.pgh.pa.us
In reply to: Oliver Elphick (#32)
#51The Hermit Hacker
scrappy@hub.org
In reply to: Tom Lane (#50)
#52Lamar Owen
lamar.owen@wgcr.org
In reply to: The Hermit Hacker (#51)
#53Bruce Momjian
bruce@momjian.us
In reply to: Lamar Owen (#52)
#54Tom Lane
tgl@sss.pgh.pa.us
In reply to: The Hermit Hacker (#51)
#55Tom Lane
tgl@sss.pgh.pa.us
In reply to: Lamar Owen (#52)
#56Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#55)
#57The Hermit Hacker
scrappy@hub.org
In reply to: Bruce Momjian (#56)
#58Bruce Momjian
bruce@momjian.us
In reply to: The Hermit Hacker (#57)
#59Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#56)
#60Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#59)
#61Lamar Owen
lamar.owen@wgcr.org
In reply to: Bruce Momjian (#53)
#62Bruce Momjian
bruce@momjian.us
In reply to: Lamar Owen (#61)
#63Oliver Elphick
olly@lfix.co.uk
In reply to: Bruce Momjian (#62)
#64Lamar Owen
lamar.owen@wgcr.org
In reply to: Bruce Momjian (#62)
#65Dominic J. Eidson
sauron@the-infinite.org
In reply to: Oliver Elphick (#63)
#66Tom Lane
tgl@sss.pgh.pa.us
In reply to: Lamar Owen (#64)
#67Oliver Elphick
olly@lfix.co.uk
In reply to: Dominic J. Eidson (#65)
#68Lamar Owen
lamar.owen@wgcr.org
In reply to: Bruce Momjian (#62)
#69Tom Lane
tgl@sss.pgh.pa.us
In reply to: Lamar Owen (#68)
#70Lamar Owen
lamar.owen@wgcr.org
In reply to: Bruce Momjian (#62)
#71Ross J. Reedstrom
reedstrm@rice.edu
In reply to: Bruce Momjian (#12)