Bug? 'psql -l' in pg_ctl?

From: GH <grasshacker(at)over-yonder(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Bug? 'psql -l' in pg_ctl?
Date: 2000-11-26 21:25:38
Message-ID: 20001126152538.A43903@over-yonder.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Er, did anybody notice trouble when starting Postgres if a password has
been set for user pgsql?

On my FreeBSD 5.0-20000528-CURRENT box, psql -l (from pg_ctl)
sucks down a big 28% cpu.

Here is the relevant section of the startup script:

start)
[ -d /usr/local/pgsql/lib ] && /sbin/ldconfig -m /usr/local/pgsql/lib
[ -x /usr/local/pgsql/bin/pg_ctl ] && {
su -l pgsql -c \
'exec /usr/local/pgsql/bin/pg_ctl -w start > /usr/local/pgsql/errlog
2>&1' &
echo -n ' pgsql'
}
;;

Postgres will start, but I still have that psql -l process cycling
waiting for a password...
errlog shows "DEBUG: Data Base System is in production state..."

Ah hah, I think I founnd the source of this and the file descriptor
problem (for those of you who are familiar with it):

in pg_ctl there is a loop to check if the postgres server is "accessible"
yet:

# wait for postmaster starting up
if [ "$wait" = 1 ];then
cnt=0
$ECHO_N "Waiting for postmaster starting up.."$ECHO_C
while :
do
if psql -l >/dev/null 2>&1
then
break;
else
$ECHO_N "."$ECHO_C
cnt=`expr $cnt + 1`
if [ $cnt -gt 60 ];then
$ECHO "$CMDNAME: postmaster does not start up"
exit 1
fi
sleep 1
fi
done
$ECHO "done."
fi

That damn loop has brought down two of my servers already.
It seems like a bloody bad idea to have such a thing in a startup script,
eh? Or am I maybe just not supposed to set a password for pgsql?

Either way, any suggestions?

gh

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Trond Eivind =?iso-8859-1?q?Glomsr=d8d?= 2000-11-26 21:25:43 Re: PostgreSQL on RedHat High Availability Server.
Previous Message selkovjr 2000-11-26 19:15:20 Re: [HACKERS] Indexing for geographic objects?