Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYDmg-0005Nc-TO for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Aug 2016 14:50:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bYDmg-0004q4-G3 for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Aug 2016 14:50:06 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bYDmf-0004ia-5S for pgsql-bugs@postgresql.org; Fri, 12 Aug 2016 14:50:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bYDmc-0003Ol-I4 for pgsql-bugs@postgresql.org; Fri, 12 Aug 2016 14:50:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u7CEo1Ik027414; Fri, 12 Aug 2016 10:50:01 -0400 From: Tom Lane To: Rick Otten cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14287: =?UTF-8?Q?psql=5Fhistory=20gets=20wiped=20?= =?UTF-8?Q?out?= In-reply-to: References: <20160811183456.GA656368@alvherre.pgsql> <15159.1470941747@sss.pgh.pa.us> <24679.1470950130@sss.pgh.pa.us> Comments: In-reply-to Rick Otten message dated "Fri, 12 Aug 2016 10:17:04 -0400" Date: Fri, 12 Aug 2016 10:50:01 -0400 Message-ID: <27413.1471013401@sss.pgh.pa.us> 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 Rick Otten writes: > And here is what the last few lines of the strace look like when I close > the (ssh terminal) window: > --- SIGHUP {si_signo=SIGHUP, si_code=SI_USER, si_pid=95075, si_uid=5432} > --- > +++ killed by SIGHUP +++ So the issue seems to be that psql is getting killed by SIGHUP before it can write the history file (in this example), or in the midst of writing the history file (in your problem cases), depending on timing. The weird thing here is that psql is able to see EOF on stdin and begin taking actions in response to that before SIGHUP arrives. I'm not sure if that's expected or not. That seems like a deliberately created race condition, which is seldom a good idea. Anyway it seems like your behavioral change must boil down to a timing change in either the kernel or sshd. There's nothing in psql that changed in this area, and probably not in libedit either. We could maybe try to prevent this by blocking signals while writing the history file, but I'm not exactly convinced that would be a good idea. It's probably be better to pester kernel & sshd people about whether they changed anything here. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs