Bug? 'psql -l' in pg_ctl? - Mailing list pgsql-general

From GH
Subject Bug? 'psql -l' in pg_ctl?
Date
Msg-id 20001126152538.A43903@over-yonder.net
Whole thread Raw
Responses Re: Bug? 'psql -l' in pg_ctl?  (Peter Eisentraut <peter_e@gmx.net>)
Re: Bug? 'psql -l' in pg_ctl?  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Re: Bug? 'psql -l' in pg_ctl?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-general by date:

Previous
From: Michael Ansley
Date:
Subject: RE: [HACKERS] Indexing for geographic objects?
Next
From: teg@redhat.com (Trond Eivind GlomsrØd)
Date:
Subject: Re: PostgreSQL on RedHat High Availability Server.