Re: psql won't stayed connected

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Izzet" <Kevin(dot)Izzet(at)nsc(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: psql won't stayed connected
Date: 2004-08-09 14:45:04
Message-ID: 14653.1092062704@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Kevin Izzet" <Kevin(dot)Izzet(at)nsc(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2004-08-09 14:53:28 Re: PostgreSQL Upgrade recommendations
Previous Message Robert Treat 2004-08-09 14:38:23 Re: [PORTS] PostgreSQL Upgrade recommendations