From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25875: 26.0.50; Hang logging out of MS-Windows Date: Sun, 26 Feb 2017 17:44:51 +0200 Message-ID: <83efylq7m4.fsf@gnu.org> References: <83lgsuqacv.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1488123976 27407 195.159.176.226 (26 Feb 2017 15:46:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 26 Feb 2017 15:46:16 +0000 (UTC) Cc: 25875@debbugs.gnu.org To: Richard Copley , Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 26 16:46:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ci11T-0006FJ-Bh for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Feb 2017 16:46:07 +0100 Original-Received: from localhost ([::1]:47306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ci11X-0002yF-Fk for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Feb 2017 10:46:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ci11R-0002y6-Ha for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2017 10:46:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ci11O-0000DN-HH for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2017 10:46:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58721) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ci11O-0000DH-Cu for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2017 10:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ci11O-00028g-87 for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2017 10:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Feb 2017 15:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25875 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25875-submit@debbugs.gnu.org id=B25875.14881239246156 (code B ref 25875); Sun, 26 Feb 2017 15:46:02 +0000 Original-Received: (at 25875) by debbugs.gnu.org; 26 Feb 2017 15:45:24 +0000 Original-Received: from localhost ([127.0.0.1]:56920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ci10l-0001az-Gc for submit@debbugs.gnu.org; Sun, 26 Feb 2017 10:45:23 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45539) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ci10j-0001TH-7w for 25875@debbugs.gnu.org; Sun, 26 Feb 2017 10:45:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ci10a-0008S1-Rd for 25875@debbugs.gnu.org; Sun, 26 Feb 2017 10:45:15 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ci10a-0008Rx-Ob; Sun, 26 Feb 2017 10:45:12 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2009 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ci10Z-0002nX-UM; Sun, 26 Feb 2017 10:45:12 -0500 In-reply-to: (message from Richard Copley on Sat, 25 Feb 2017 21:07:51 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129821 Archived-At: > From: Richard Copley > Date: Sat, 25 Feb 2017 21:07:51 +0000 > Cc: 25875@debbugs.gnu.org > > On 25 February 2017 at 20:33, Eli Zaretskii wrote: > >> From: Richard Copley > >> Date: Sat, 25 Feb 2017 19:35:28 +0000 > >> > >> On MS Windows, Emacs sometimes hangs when shutting down or logging out. > > > > How did you shut it down in this case? This part: > > > >> #2 0x0000000400266caf in sys_sleep (seconds=1000) > >> at ../../repo/src/w32.c:3075 > >> No locals. > >> #3 0x0000000400238225 in w32_wnd_proc (hwnd=0x1f076a, msg=22, wParam=1, > >> lParam=0) at ../../repo/src/w32fns.c:4805 > > > > seems to indicate that you shut down your Windows session or > > something? > > Yes indeed. Hence "when shutting down or logging out". In this > case shutting down the computer. OK, supporting that is a relatively new feature, so it's little surprise it needs more work. Ken, could you please take a look? As I understand it, this happens because when the input thread gets the WM_ENDSESSION message, it posts it to the main thread and goes on to sleep for 1000 sec, to avoid ending the Emacs process before it finishes orderly shutdown. But if the main thread happens to be inside redisplay, it could invoke one of the function that send messages to the input thread via SendMessage, which waits for the input thread to respond. So we do have a kind of deadlock. One possible idea is to use SendMessageTimeout instead, with some suitably chosen timeout.