Re: Warning: Don't delete those /tmp/.PGSQL.* files

From: GH <grasshacker(at)over-yonder(dot)net>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Warning: Don't delete those /tmp/.PGSQL.* files
Date: 2000-11-26 00:59:32
Message-ID: 20001125185932.A39544@over-yonder.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Sat, Nov 25, 2000 at 06:40:12PM -0500, some SMTP stream spewed forth:
> GH <grasshacker(at)over-yonder(dot)net> writes:
> > FATAL 1: ReleaseLruFile: No open files available to be closed
> > ............................................................pg_ctl:
> > postmaster does not start up
>
> > After that, all postgres processes die and the cycle begins again on
> > subsequent attempts to start postgres.
> > At one point I would receive some "Too many open files" (or similar)
> > error with postgres holding more than 750 file descriptors -- almost
> > entirely consisting of socket streams.
> > What is the significance of "ReleaseLruFile" and how can I repair this?
>
> > This is using FreeBSD 4.1-RELEASE and Postgres 7.0.2.
>
> 7.0.3 will probably help --- the message is coming out of some
> inappropriate error recovery code that we fixed in 7.0.3.
>
> The underlying problem, however, is that you are running out of kernel
> file table slots (ENFILE or EMFILE error return from open()). Not
> enough info here to tell why that's happening.

Well, through some research of my own I have discovered that the file
issue is somehow related to our startup script:
/usr/local/etc/rc.d/pgsql.sh.
I am not sure how familiar you are with FreeBSD's startup process, but
it will suffice to say that this script expects one of three arguments:
start, stop, or status -- apparently corresponding to the options of
pg_ctl.

When I start the postgres server manually, it runs relatively fine.
i.e.
# su -l pgsql /usr/local/pgsql/bin/pg_ctl -w start > /usr/local/pgsql/errlog 2>&1 &

Here is pgsql.sh:

#!/bin/sh

# $FreeBSD: ports/databases/postgresql7/files/pgsql.sh.tmpl,v 1.8
2000/05/25 09:35:25 andreas Exp $
#
# For postmaster startup options, edit $PGDATA/postmaster.opts.default
# Preinstalled options are -i -o "-F"

case $1 in
start)
[ -d /usr/local/pgsql/lib ] && /sbin/ldconfig -m /usr/local/pgsql/lib
# Clean up by Matt
# This is a really bad idea, unless we are absolutely certain that there
# are no postgres processes running or that we feel like restoring
# from a recent backup. ;-) gh
rm -f /tmp/.s.PGSQL*
[ -x /usr/local/pgsql/bin/pg_ctl ] && {
su -l pgsql \
/usr/local/pgsql/bin/pg_ctl -w start >
/usr/local/pgsql/errlog 2>&1 &
# /usr/local/pgsql/bin/pg_ctl -w start -o "-B 64 -N 32" start >
/usr/local/pgsql/errlog 2>&1 &
echo -n ' pgsql'
}
;;

stop)
[ -x /usr/local/pgsql/bin/pg_ctl ] && {
su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl -w -m fast stop'
}
;;

status)
[ -x /usr/local/pgsql/bin/pg_ctl ] && {
su -l pgsql -c 'exec /usr/local/pgsql/bin/pg_ctl status'
}
;;

*)
echo "usage: `basename $0` {start|stop|status}" >&2
exit 64
;;
esac

EOF

running this script with "start" causes the postgres server to start,
run out of files, and then shutdown. Postgres is useable until it runs
out of files and shuts down.

Thanks.

gh

>
> regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff MacDonald 2000-11-26 01:12:58 Re: Very queer errors with Postgres/PHP
Previous Message rob 2000-11-26 00:52:13 Integrity Relationships

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2000-11-26 01:03:44 Re: tcl/FreeBSD 4.2-STABLE, multiple TCL versions installed
Previous Message Larry Rosenman 2000-11-26 00:53:29 Re: tcl/FreeBSD 4.2-STABLE, multiple TCL versions installed