Re: BUG #14287: psql_history gets wiped out - Mailing list pgsql-bugs

From Rick Otten
Subject Re: BUG #14287: psql_history gets wiped out
Date
Msg-id fcab184f7c55b63146f3653ccfbe5f0c@www.windfish.net
Whole thread Raw
In response to Re: BUG #14287: psql_history gets wiped out  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #14287: psql_history gets wiped out  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs

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, "\\q\n", 3) = 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\333\n"..., 34, MSG_NOSIGNAL, NULL, 0) = 34
sendto(3, "\25\3\3\0\32\220x\377`\200\210Z\256\361U\271I \330\322J\267\32X?\352u\200\267\252\10", 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, "\\q\n", 3) = -1 EIO (Input/output error)
sendto(3, "\27\3\3\0\35Z\35\364\t\263\220\260\316\272\25f\216\314\250\234 \357~niQ\254S&\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 <rotten@windfish.net> writes:
I'm using the repo: deb http://apt.postgresql.org/pub/repos/apt/ 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

 

pgsql-bugs by date:

Previous
From: Rick Otten
Date:
Subject: Re: BUG #14287: psql_history gets wiped out
Next
From: Tom Lane
Date:
Subject: Re: BUG #14287: psql_history gets wiped out