From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#24091: 24.5; High CPU usage at startup while hidden Date: Thu, 28 Jul 2016 21:45:55 -0400 Message-ID: <87shut9pyk.fsf@users.sourceforge.net> References: <24533f31-9fc2-b38e-aaeb-561616cdf77f@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1469756800 30843 80.91.229.3 (29 Jul 2016 01:46:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Jul 2016 01:46:40 +0000 (UTC) Cc: clement.pit@gmail.com, 24091@debbugs.gnu.org To: aiken Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 29 03:46:25 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bSwsY-0002kP-Jg for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Jul 2016 03:46:22 +0200 Original-Received: from localhost ([::1]:56585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSwsS-00029h-E9 for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Jul 2016 21:46:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSwsJ-00028G-3N for bug-gnu-emacs@gnu.org; Thu, 28 Jul 2016 21:46:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSwsE-0003vt-2d for bug-gnu-emacs@gnu.org; Thu, 28 Jul 2016 21:46:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSwsD-0003vM-W9 for bug-gnu-emacs@gnu.org; Thu, 28 Jul 2016 21:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bSwsD-0004TV-Oe for bug-gnu-emacs@gnu.org; Thu, 28 Jul 2016 21:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Jul 2016 01:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24091 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24091-submit@debbugs.gnu.org id=B24091.146975676017191 (code B ref 24091); Fri, 29 Jul 2016 01:46:01 +0000 Original-Received: (at 24091) by debbugs.gnu.org; 29 Jul 2016 01:46:00 +0000 Original-Received: from localhost ([127.0.0.1]:49845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSwsB-0004T8-Nx for submit@debbugs.gnu.org; Thu, 28 Jul 2016 21:45:59 -0400 Original-Received: from mail-it0-f44.google.com ([209.85.214.44]:37241) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSws9-0004Sp-Du; Thu, 28 Jul 2016 21:45:57 -0400 Original-Received: by mail-it0-f44.google.com with SMTP id f6so95485961ith.0; Thu, 28 Jul 2016 18:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=gDUmH/uq6WJp7KyUK/C+x6FNmjMM2Gu52uHqTXn5Zac=; b=eaUuKr7Jx+nKRtAsYlaqxkyyTCg14btiYmE3ZT5fSr4uRO2wFiAiIXWQX7HUSrSMVP kfZSWe0v/lLyY+/3ZvsaNppgyU6cEJal+/vuGB4QtD4ba8unEQ17Y3Geaic21loEOfZZ 5jLSmuld8D4N9vy9wXZTQbEygLQ2/ZCOkSLbs74eIEHSRwPtMslUUJ8/lh7HJkzt8iAL lUS7neZDzirGAk3oj23bYOa2/57Dv5JzzlvAL7FbAxJcSD7KRK5hnRfwcbc6Ewo/XUY6 bSVGeAUyQJjbEwdkTsSJ3Zin0BFpcVqTpOXn9yxDg/SHo1bbhrUn4oVryjKB727IP3II XjxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=gDUmH/uq6WJp7KyUK/C+x6FNmjMM2Gu52uHqTXn5Zac=; b=hkPB8jY/4AQlI3btFcJJ835qdHl/sOt1G26HCqt/uNJkxxB+0aTni++9SJD5iQ/IhD NJ3RWmX6zhXRKq6Yv9kzIARxI41HhFqW6rxygrN3mS84hwuxjJjWIuU/ArMgEV5q+uh8 OIS8sLyWIZClqggzSLLbmhdJDOxZpHA00fd6XAqnpWiucAR1hPyIK4cHpBlMCL9g63W8 /qYvaPySRb3tjWzXknWO9bl0s93WlJZY1EwZBFUS10w8Lw21Q/GstOLEmejyklULFMu5 0NVb7PmMY42eLE/DmlZz7vIehO9mhSoHfhrFn5ISJbbmzBi6Zd4H+L5vSElwgVk3vMOY Y/Qw== X-Gm-Message-State: AEkoouvU5jZ2gnO8YofZzrdYOzE8K+6tYaDO3pizN/QVa2rQGJukzz5CqX5ejTY3A+oRrA== X-Received: by 10.36.33.17 with SMTP id e17mr3379125ita.41.1469756751808; Thu, 28 Jul 2016 18:45:51 -0700 (PDT) Original-Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id b66sm466318itd.0.2016.07.28.18.45.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jul 2016 18:45:51 -0700 (PDT) In-Reply-To: (aiken's message of "Thu, 28 Jul 2016 18:43:38 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) 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:121663 Archived-At: tags 24091 confirmed found 24091 25.1-rc1 quit aiken writes: > Noam: I think my settings are fairly standard, but another way to > reproduce the effect of Emacs launching in a workspace that you're not > currently in (which seems to be the main issue) is to add something like > "assign [class="Emacs24"] 9" to your i3 config. (I've tried this and it > does reproduce the high CPU usage.) Thanks, with this I'm able to reproduce also with the latest emacs-25. I sent SIGSTOP to get a backtrace and found it was in x_make_frame_visible (src/xterm.c). Stepping through it with gdb, I saw it's getting stuck in this loop: /* Process X events until a MapNotify event has been seen. */ while (!FRAME_VISIBLE_P (f)) { /* Force processing of queued events. */ x_sync (f); /* If on another desktop, the deiconify/map may be ignored and the frame never becomes visible. XMonad does this. Prevent an endless loop. */ if (FRAME_ICONIFIED_P (f) && ++tries > 100) break; /* This hack is still in use at least for Cygwin. See http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html. Machines that do polling rather than SIGIO have been observed to go into a busy-wait here. So we'll fake an alarm signal to let the handler know that there's something to be read. We used to raise a real alarm, but it seems that the handler isn't always enabled here. This is probably a bug. */ if (input_polling_used ()) { /* It could be confusing if a real alarm arrives while processing the fake one. Turn it off and let the handler reset it. */ int old_poll_suppress_count = poll_suppress_count; poll_suppress_count = 1; poll_for_input_1 (); poll_suppress_count = old_poll_suppress_count; } if (XPending (FRAME_X_DISPLAY (f))) { XEvent xev; XNextEvent (FRAME_X_DISPLAY (f), &xev); x_dispatch_event (&xev, FRAME_X_DISPLAY (f)); } } I guess we would like Emacs to hit this case: /* If on another desktop, the deiconify/map may be ignored and the frame never becomes visible. XMonad does this. Prevent an endless loop. */ if (FRAME_ICONIFIED_P (f) && ++tries > 100) break; But it seems that FRAME_ICONIFIED_P is returning false, because I see that tries is never incremented.