* bug#14156: 24.3.50; Timer firing after being canceled
@ 2013-04-08 0:50 Stefan Monnier
2013-04-08 2:09 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2013-04-08 0:50 UTC (permalink / raw)
To: 14156; +Cc: Michael Heerdegen
[-- Attachment #1: Type: text/plain, Size: 49 bytes --]
Submitting it as a bug-report
Stefan
[-- Attachment #2: Type: message/rfc822, Size: 6356 bytes --]
From: Michael Heerdegen <michael_heerdegen@web.de>
To: emacs-devel@gnu.org
Cc: Tomohiro Matsuyama <tomo@cx4a.org>
Subject: 24.3.50; Timer firing after being canceled
Date: Sun, 07 Apr 2013 21:53:24 +0200
Message-ID: <87ip3yw217.fsf@web.de>
Hi,
This report is about the following problem (bug) raised in
gnu.emacs.devel by Tomohiro Matsuyama:
,----------------------------------------------------------------------
| Hi,
|
| I have found a problem that cancel-timer will not work in a particular
| situation where the timer takes more time to execute than a
| rescheduling interval of the timer. Here is the reproducible code:
|
| (setq my-timer
| (run-with-timer
| nil 0.1
| (lambda ()
| (when my-timer
| (cancel-timer my-timer)
| (setq my-timer nil)
| (sit-for 0.3)))))
|
| After evaluating this code several times, you may see "zombie" timers
| in timer-list, though the code intends to keep at most one timer.
`----------------------------------------------------------------------
I can reproduce this problem. And I have a test case that proves that
timers that have been canceled (i.e., removed from `timer-list') are
still called from C:
--8<---------------cut here---------------start------------->8---
(defvar my-timer nil)
(defun start-the-timer ()
(interactive)
(setq my-timer
(run-with-timer
0 0.1
(lambda ()
(cancel-timer my-timer)
(sit-for 0.3)))))
(advice-add 'timer-event-handler :before
(lambda (timer)
(when (and (eq timer my-timer)
(not (memq my-timer timer-list)))
(message "Why is this ever reached?"))))
--8<---------------cut here---------------end--------------->8---
If you call `start-the-timer', you get the message "Why is this ever
reached?" over and over. This obviously should not happen.
Thanks,
Michael.
In GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
of 2013-04-04 on dex, modified by Debian
(emacs-snapshot package, version 2:20130403-1)
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
System Description: Debian GNU/Linux 7.0 (wheezy)
Configured using:
`configure --build x86_64-linux-gnu --host x86_64-linux-gnu
--prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib
--localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man
--with-pop=yes
--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.3.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3.50/site-lisp:/usr/share/emacs/site-lisp
--without-compress-info --with-crt-dir=/usr/lib/x86_64-linux-gnu/
--with-x=yes --with-x-toolkit=gtk3 --with-imagemagick=yes
CFLAGS='-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2'
CPPFLAGS='-D_FORTIFY_SOURCE=2' LDFLAGS='-g -Wl,--as-needed
-znocombreloc''
Important settings:
value of $LC_ALL: de_DE.utf8
value of $LC_TIME: C
value of $LANG: de_DE.utf8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Dired by name
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#14156: 24.3.50; Timer firing after being canceled
2013-04-08 0:50 bug#14156: 24.3.50; Timer firing after being canceled Stefan Monnier
@ 2013-04-08 2:09 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2013-04-08 2:09 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 14156
> If you call `start-the-timer', you get the message "Why is this ever
> reached?" over and over. This obviously should not happen.
As mentioned elsewhere, this seems to be due to patch
revno: 110138
fixes bugs: http://debbugs.gnu.org/12447 http://debbugs.gnu.org/12326
I installed the patch below which seems to fix it.
Stefan
=== modified file 'lisp/emacs-lisp/timer.el'
--- lisp/emacs-lisp/timer.el 2013-01-13 01:23:48 +0000
+++ lisp/emacs-lisp/timer.el 2013-04-08 01:53:53 +0000
@@ -314,7 +314,11 @@
(save-current-buffer
(apply (timer--function timer) (timer--args timer)))
(error (message "Error in timer: %S" err)))
- (if retrigger
+ (when (and retrigger
+ ;; If the timer's been canceled, don't "retrigger" it
+ ;; since it might still be in the copy of timer-list kept
+ ;; by keyboard.c:timer_check (bug#14156).
+ (memq timer timer-list))
(setf (timer--triggered timer) nil)))
(error "Bogus timer event"))))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-08 2:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08 0:50 bug#14156: 24.3.50; Timer firing after being canceled Stefan Monnier
2013-04-08 2:09 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.