From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan =?UTF-8?Q?Dj=C3=A4rv?= Newsgroups: gmane.emacs.bugs Subject: bug#12326: 24.2.50; js2-mode freezes on current trunk Date: Sun, 2 Sep 2012 18:06:30 +0200 Message-ID: <2F6F9AFA-23C7-4480-BBDD-288CEB5E88C6@swipnet.se> References: <504284CE.3040203@yandex.ru> <44BE28C5-1BC9-4346-873D-84D052F2A338@swipnet.se> <50435939.6070104@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1346602064 8361 80.91.229.3 (2 Sep 2012 16:07:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Sep 2012 16:07:44 +0000 (UTC) Cc: 12326@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 02 18:07:43 2012 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 1T8Ci6-00040I-6W for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Sep 2012 18:07:42 +0200 Original-Received: from localhost ([::1]:49121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8Ci3-0001Wj-HJ for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Sep 2012 12:07:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8Ci0-0001Wc-Gl for bug-gnu-emacs@gnu.org; Sun, 02 Sep 2012 12:07:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8Chz-0003U5-8o for bug-gnu-emacs@gnu.org; Sun, 02 Sep 2012 12:07:36 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8Chz-0003U0-5K for bug-gnu-emacs@gnu.org; Sun, 02 Sep 2012 12:07:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1T8CjO-0006ki-77 for bug-gnu-emacs@gnu.org; Sun, 02 Sep 2012 12:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jan =?UTF-8?Q?Dj=C3=A4rv?= Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Sep 2012 16:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12326 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12326-submit@debbugs.gnu.org id=B12326.134660208525889 (code B ref 12326); Sun, 02 Sep 2012 16:09:02 +0000 Original-Received: (at 12326) by debbugs.gnu.org; 2 Sep 2012 16:08:05 +0000 Original-Received: from localhost ([127.0.0.1]:34682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T8CiS-0006jV-Om for submit@debbugs.gnu.org; Sun, 02 Sep 2012 12:08:05 -0400 Original-Received: from mailout.attendit.se ([83.140.103.4]:50958) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T8CiP-0006j4-Tw for 12326@debbugs.gnu.org; Sun, 02 Sep 2012 12:08:03 -0400 Original-Received: from mail01.melmac.se (mail01.melmac.se [62.20.26.80]) by mailout.attendit.se (Postfix) with ESMTP id 6C4BE5009B for <12326@debbugs.gnu.org>; Sun, 2 Sep 2012 18:00:48 +0200 (CEST) Original-Received: (qmail 26986 invoked by uid 89); 2 Sep 2012 16:06:11 -0000 Original-Received: from h-46-59-42-18.na.cust.bahnhof.se (HELO coolsville.localdomain) (boel.djarv@bdtv.se@46.59.42.18) by mail01.melmac.se with ESMTPA; 2 Sep 2012 16:06:11 -0000 Original-Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id 832B07FA05E; Sun, 2 Sep 2012 18:06:31 +0200 (CEST) In-Reply-To: <50435939.6070104@yandex.ru> X-Mailer: Apple Mail (2.1486) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:63678 Archived-At: Hello. 2 sep 2012 kl. 15:03 skrev Dmitry Gutov : > Hi Jan, >=20 > On 02.09.2012 12:35, Jan Dj=E4rv wrote: >> 1 sep 2012 kl. 23:57 skrev Dmitry Gutov : >>=20 >>> js2-mode freezes during editing in some buffers. >>>=20 >>> This has been a long-standing complaint on Mac OS X port, but now it >>> affect Linux and Windows users too, see >>> https://github.com/mooz/js2-mode/issues/49 >>>=20 >>> Bisecting the Bazaar history (on a Windows machine) points to the >>> month-old commit no 109470, which adds one line in `timer_check_2'. >>>=20 >>=20 >> The reason for that line is to make timer_check return the time to = the next timeout, not the time to some random timer. >=20 > How was it random? AFAICT, your line just breaks out of the "while" = loop when a ripe timer is found, and so `timer_check_2' returns 0 time, = and its caller (timer_check) calls it again. > And before that the while loop in `timer_check_2' just ran until it = reached the end of timers lists, or found a non-ripe timer. >=20 > I think the main difference is, previously, `timer_check_2' was called = only once, so `now' and `idleness_now' were calculated at that time, and = all timers were checked for ripeness against those values. >=20 > Now `now' and `idleness_now' are recalculated after each time a ripe = timer fires, which is arguably more correct (some time has passed, after = all), but doesn't leave the room for the event loop to detect new = keypresses and update `timer_idleness_start_time'. That is not the problem. Previously timer_check_2 found a timer to run, ran that, and continued = to search in the list. If the timer callback added a timer, it may happen that that timer is = inserted in the front of the list, and not checked by timer_check_2. Now timer_check_2 finds a timer, runs that, and then returns so = timer_check can call timer_check_2 again. This makes timer_check_2 = start over, checking from the beginning of the list. >=20 >> When a dialog i shown, the time to the next time is checked with = timer_check and when that time is reached, the timer is run. If = timer_check returns an out of order time, timers are not run when they = should be. >=20 > Didn't they they just run a little late, due to the time values, = against which the difference was calculated, being slightly outdated? The case I had was one repeating 20 second timer, and one repeating 2 = second timer. The 2 second timer would be run once, then timer_check_2 would return = the difference to the 20 second timer, thus skipping some 10 invokations = of the 2 second timer. >=20 >> I'm surprised that js2 functions with undefined behaviour and not = with defined behaviour. >=20 > Looks like the previous behavior was more conservative. And wrong. >=20 > I think js2-mode is only unusual in that it may schedule a new timer = from within a timer callback function. It may be that some timing issues in the handling of the timer lists = still remain. Jan D.