Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYDGp-00045k-Gd for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Aug 2016 14:17:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bYDGp-0003z4-3P for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Aug 2016 14:17:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bYDGo-0003yn-Iq for pgsql-bugs@postgresql.org; Fri, 12 Aug 2016 14:17:10 +0000 Received: from mail.windfish.net ([2001:4801:7824:104:ca47:84ed:ff10:50ea]) by magus.postgresql.org with esmtps (TLS1.1:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bYDGk-0004nA-Q4 for pgsql-bugs@postgresql.org; Fri, 12 Aug 2016 14:17:10 +0000 Received: by mail.windfish.net (Postfix, from userid 33) id 911D8765C4; Fri, 12 Aug 2016 10:17:04 -0400 (EDT) To: pgsql-bugs@postgresql.org Subject: Re: BUG #14287: =?UTF-8?Q?psql=5Fhistory=20gets=20wiped=20?= =?UTF-8?Q?out?= X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_0266b188a86cf6023d95e842c7b81685" Date: Fri, 12 Aug 2016 10:17:04 -0400 From: Rick Otten In-Reply-To: <24679.1470950130@sss.pgh.pa.us> References: <20160811183456.GA656368@alvherre.pgsql> <15159.1470941747@sss.pgh.pa.us> <24679.1470950130@sss.pgh.pa.us> Message-ID: X-Sender: rotten@windfish.net User-Agent: Roundcube Webmail/1.0.3 X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --=_0266b188a86cf6023d95e842c7b81685 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Here is what the last few lines of the strace look like during a normal exit: rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 write(1, "\qn", 3) = 3 sendto(3, "273335220x377`200210Z255251374X335206207r21212230271206246250v4375333n"..., 34, MSG_NOSIGNAL, NULL, 0) = 34 sendto(3, "253332220x377`200210Z256361U271I 330322J26732X?352u20026725210", 31, MSG_NOSIGNAL, NULL, 0) = 31 close(3) = 0 rt_sigaction(SIGPIPE, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f263ea4ccb0}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f263ea4ccb0}, 8) = 0 open("/postgresql/.psql_history", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3 fchmod(3, 0600) = 0 fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f263f9e4000 open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 4 fstat(4, {st_mode=S_IFREG|0644, st_size=26258, ...}) = 0 mmap(NULL, 26258, PROT_READ, MAP_SHARED, 4, 0) = 0x7f263f9dd000 close(4) = 0 futex(0x7f263edd5a70, FUTEX_WAKE_PRIVATE, 2147483647) = 0 write(3, "_HiStOrY_V2_nselect\040*\040from"..., 663) = 663 close(3) = 0 munmap(0x7f263f9e4000, 4096) = 0 exit_group(0) = ? +++ exited with 0 +++ And here is what the last few lines of the strace look like when I close the (ssh terminal) window: read(0, 0x7ffd1140ff30, 1) = -1 EIO (Input/output error) ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffd1140ff00) = -1 EIO (Input/output error) ioctl(0, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B38400 opost isig icanon echo ...}) = -1 EIO (Input/output error) rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT TERM CONT TSTP WINCH], [], 8) = 0 rt_sigaction(SIGINT, {0x7fb2dbc68920, [], SA_RESTORER|SA_RESTART, 0x7fb2daf38cb0}, NULL, 8) = 0 rt_sigaction(SIGTSTP, {SIG_DFL, [], SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) = 0 rt_sigaction(SIGHUP, {SIG_DFL, [], SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) = 0 rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) = 0 rt_sigaction(SIGCONT, {SIG_DFL, [], SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) = 0 rt_sigaction(SIGWINCH, {SIG_DFL, [], SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 write(1, "\qn", 3) = -1 EIO (Input/output error) sendto(3, "273335Z35364t26322026031627225f216314250234 357~niQ254S&255gl"..., 34, MSG_NOSIGNAL, NULL, 0) = 34 --- SIGHUP {si_signo=SIGHUP, si_code=SI_USER, si_pid=95075, si_uid=5432} --- +++ killed by SIGHUP +++ I can send the full strace outputs if someone really wants them. On 2016-08-11 17:15, Tom Lane wrote: > Rick Otten writes: > >> I'm using the repo: deb http://apt.postgresql.org/pub/repos/apt/ [1] trusty-pgdg main 9.5 That repo version is using _libedit_, not _libreadline_: > > Hmm. Our general experience is that libedit is buggier than libreadline, > but I've not heard of this particular symptom before. It might be > entertaining to see if you can strace psql while it's doing this. > Something like > > strace -o some.file psql ... usual parameters ... > ... issue a command or two just to be sure there's history to write > ... close window > > and then look at the last few dozen lines of some.file. > > regards, tom lane Links: ------ [1] http://apt.postgresql.org/pub/repos/apt/ --=_0266b188a86cf6023d95e842c7b81685 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

Here is what the last few lines of the strace look like during a normal = exit:

rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = =3D 0
write(1, "\\q\n", 3) =3D 3
sendto(3, "\27\3\3\0\35\220x\377= `\200\210Z\255\251\374X\335\206\207\r\21\212\230\271\206\246\250\v\4\375\33= 3\n"..., 34, MSG_NOSIGNAL, NULL, 0) =3D 34
sendto(3, "\25\3\3\0\32\220= x\377`\200\210Z\256\361U\271I \330\322J\267\32X?\352u\200\267\252\10", 31, = MSG_NOSIGNAL, NULL, 0) =3D 31
close(3) =3D 0
rt_sigaction(SIGPIPE= , {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f263ea4ccb0}, {SIG_DFL, [], SA_R= ESTORER|SA_RESTART, 0x7f263ea4ccb0}, 8) =3D 0
open("/postgresql/.psql_= history", O_WRONLY|O_CREAT|O_TRUNC, 0666) =3D 3
fchmod(3, 0600) =3D 0<= br />fstat(3, {st_mode=3DS_IFREG|0600, st_size=3D0, ...}) =3D 0
mmap(N= ULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =3D 0x7f= 263f9e4000
open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache",= O_RDONLY) =3D 4
fstat(4, {st_mode=3DS_IFREG|0644, st_size=3D26258, = =2E..}) =3D 0
mmap(NULL, 26258, PROT_READ, MAP_SHARED, 4, 0) =3D 0x7f2= 63f9dd000
close(4) =3D 0
futex(0x7f263edd5a70, FUTEX_WAKE_PRIVATE= , 2147483647) =3D 0
write(3, "_HiStOrY_V2_\nselect\\040*\\040from"..= =2E, 663) =3D 663
close(3) =3D 0
munmap(0x7f263f9e4000, 4096) =3D= 0
exit_group(0) =3D ?
+++ exited with 0 +++

 

And here is what the last few lines of the strace look like when I close= the (ssh terminal) window:

 

read(0, 0x7ffd1140ff30, 1) =3D -1 EIO (Inp= ut/output error)
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEX= T_DEVICE or TCGETS, 0x7ffd1140ff00) =3D -1 EIO (Input/output error)
io= ctl(0, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B38400 opost= isig icanon echo ...}) =3D -1 EIO (Input/output error)
rt_sigprocmask= (SIG_BLOCK, [HUP INT QUIT TERM CONT TSTP WINCH], [], 8) =3D 0
rt_sigac= tion(SIGINT, {0x7fb2dbc68920, [], SA_RESTORER|SA_RESTART, 0x7fb2daf38cb0}, = NULL, 8) =3D 0
rt_sigaction(SIGTSTP, {SIG_DFL, [], SA_RESTORER, 0x7fb2= daf38cb0}, NULL, 8) =3D 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTO= RER, 0x7fb2daf38cb0}, NULL, 8) =3D 0
rt_sigaction(SIGHUP, {SIG_DFL, []= , SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) =3D 0
rt_sigaction(SIGTERM, {= SIG_DFL, [], SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) =3D 0
rt_sigaction= (SIGCONT, {SIG_DFL, [], SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) =3D 0
r= t_sigaction(SIGWINCH, {SIG_DFL, [], SA_RESTORER, 0x7fb2daf38cb0}, NULL, 8) = =3D 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) =3D 0
write(1, "\\= q\n", 3) =3D -1 EIO (Input/output error)
sendto(3, "\27\3\3\0\35Z\35\3= 64\t\263\220\260\316\272\25f\216\314\250\234 \357~niQ\254S&\255gl"..., = 34, MSG_NOSIGNAL, NULL, 0) =3D 34
--- SIGHUP {si_signo=3DSIGHUP, si_co= de=3DSI_USER, si_pid=3D95075, si_uid=3D5432} ---
+++ killed by SIGHUP = +++

 

I can send the full strace outputs if someone really wants them.

 

 

On 2016-08-11 17:15, Tom Lane wrote:

Rick Otten <rotten@windfish=
=2Enet> writes:
I'm using the repo: deb http://apt.postgresql.org/pub/repos/apt/ tr= usty-pgdg main 9.5 That repo version is using _libedit_, not _libreadline_:=
Hmm.  Our general experience is that libedit is buggier than libreadli=
ne,
but I've not heard of this particular symptom before.  It might be
entertaining to see if you can strace psql while it's doing this.
Something like

    strace -o some.file psql ... usual parameters ...
    ... issue a command or two just to be sure there's history to write
    ... close window

and then look at the last few dozen lines of some.file.

			regards, tom lane

 

--=_0266b188a86cf6023d95e842c7b81685--