Re: psql won't stayed connected - Mailing list pgsql-admin

From Tom Lane
Subject Re: psql won't stayed connected
Date
Msg-id 14653.1092062704@sss.pgh.pa.us
Whole thread Raw
In response to Re: psql won't stayed connected  ("Kevin Izzet" <Kevin.Izzet@nsc.com>)
List pgsql-admin
"Kevin Izzet" <Kevin.Izzet@nsc.com> writes:
> Below is an extract from a truss of the psql login, looks fine to me,

Not really.  Here we have the successful connection to the server:

> 937:    send(4, "\0\0\0 #\003\0\0 u s e r".., 35, 0)    = 35
> 937:    sigaction(SIGPIPE, 0xFFBEEAC8, 0xFFBEEB48)      = 0
> 937:    poll(0xFFBEED78, 1, -1)                         = 1
> 937:    recv(4, " R\0\0\0\b\0\0\0\0 N\0\0".., 16384, 0) = 75
> 937:    write(2, " D E B U G :     I n i t".., 21)      = 21
> 937:    poll(0xFFBEED78, 1, -1)                         = 1
> 937:    recv(4, " S\0\0\01E c l i e n t _".., 16384, 0) = 155

and here is psql doing its normal initialization:

> 937:    access("/home/kevini/.psqlrc-7.4.3", 4)         Err#2 ENOENT
> 937:    access("/home/kevini/.psqlrc", 4)               Err#2 ENOENT
> 937:    getcontext(0xFFBEEDE0)
> 937:    sigaction(SIGINT, 0xFFBEEED8, 0xFFBEEF58)       = 0
> 937:    ioctl(0, TCGETA, 0xFFBEE9BC)                    Err#6 ENXIO
> 937:    fstat64(0, 0xFFBEEA30)                          = 0
> 937:    brk(0x0004CC48)                                 = 0
> 937:    brk(0x0004EC48)                                 = 0

and here it's trying to read the first command from stdin,
and getting EOF back:

> 937:    read(0, 0x0004ADB4, 8192)                       = 0

whereupon it quite correctly decides to close up shop:

> 937:    sigaction(SIGINT, 0xFFBEEED8, 0xFFBEEF58)       = 0
> 937:    sigaction(SIGPIPE, 0xFFBEECC0, 0xFFBEED40)      = 0
> 937:    send(4, " X\0\0\004", 5, 0)                     = 5
> 937:    sigaction(SIGPIPE, 0xFFBEECC0, 0xFFBEED40)      = 0
> 937:    close(4)                                        = 0
> 937:    sigaction(SIGPIPE, 0xFFBEEF10, 0xFFBEEF90)      = 0
> 937:    llseek(0, 0, SEEK_CUR)                          = 0
> 937:    _exit(0)

So why the heck is it getting EOF from stdin?  You're not doing
anything as silly as "psql </dev/null" are you?

            regards, tom lane

pgsql-admin by date:

Previous
From: Robert Treat
Date:
Subject: Re: [PORTS] PostgreSQL Upgrade recommendations
Next
From: "Kevin Izzet"
Date:
Subject: Re: psql won't stayed connected