Re: BUG #14287: psql_history gets wiped out

From: Rick Otten <rotten(at)windfish(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14287: psql_history gets wiped out
Date: 2016-08-12 14:17:04
Message-ID: fcab184f7c55b63146f3653ccfbe5f0c@www.windfish.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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, "\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 <rotten(at)windfish(dot)net> 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/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-08-12 14:50:01 Re: BUG #14287: psql_history gets wiped out
Previous Message Rick Otten 2016-08-12 14:14:16 Re: BUG #14287: psql_history gets wiped out