From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#39824: 26.2; timers sometimes stop working when coming back from sleep Date: Fri, 03 Apr 2020 15:35:48 +0300 Message-ID: <83imigwxuj.fsf@gnu.org> References: <83k143zxbm.fsf@gnu.org> <83eeu5j15k.fsf@gnu.org> <874kueb1jj.fsf@hillenius.net> <83tv2ca4bt.fsf@gnu.org> <87lfnf4r80.fsf@hillenius.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="37546"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39824@debbugs.gnu.org To: =?UTF-8?Q?G=C4=B3s?= Hillenius Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 03 14:37:16 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jKLZT-0009gL-AW for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Apr 2020 14:37:15 +0200 Original-Received: from localhost ([::1]:54776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKLZS-0002FI-6F for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Apr 2020 08:37:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54203) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKLZL-0002Ex-5L for bug-gnu-emacs@gnu.org; Fri, 03 Apr 2020 08:37:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKLZI-0002tR-EN for bug-gnu-emacs@gnu.org; Fri, 03 Apr 2020 08:37:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58035) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jKLZF-0002qk-Nh for bug-gnu-emacs@gnu.org; Fri, 03 Apr 2020 08:37:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jKLZF-0005mg-JY for bug-gnu-emacs@gnu.org; Fri, 03 Apr 2020 08:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Apr 2020 12:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39824 X-GNU-PR-Package: emacs Original-Received: via spool by 39824-submit@debbugs.gnu.org id=B39824.158591737222086 (code B ref 39824); Fri, 03 Apr 2020 12:37:01 +0000 Original-Received: (at 39824) by debbugs.gnu.org; 3 Apr 2020 12:36:12 +0000 Original-Received: from localhost ([127.0.0.1]:41348 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKLYR-0005kA-H4 for submit@debbugs.gnu.org; Fri, 03 Apr 2020 08:36:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39001) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jKLYP-0005ji-2L for 39824@debbugs.gnu.org; Fri, 03 Apr 2020 08:36:10 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:46978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jKLYJ-0002MI-8g; Fri, 03 Apr 2020 08:36:03 -0400 Original-Received: from [176.228.60.248] (port=3759 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jKLYH-0007iv-Gk; Fri, 03 Apr 2020 08:36:01 -0400 In-Reply-To: <87lfnf4r80.fsf@hillenius.net> (message from =?UTF-8?Q?G=C4=B3s?= Hillenius on Wed, 01 Apr 2020 09:09:35 +0200) 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: 209.51.188.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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177986 Archived-At: > From: Gijs Hillenius > Cc: 39824@debbugs.gnu.org > Date: Wed, 01 Apr 2020 09:09:35 +0200 > > I need a bit of help with instrumenting this correctly: See below for some ideas. > I've instrumented (run-at-time "10:35" 21600 'org-mobile-push) > > using (evel-defun) C-M-x > > This shows org-mobile-push runs without errors. In *Messages*: > > (snip) > Edebug: edebug-anon11 > Tracing... > Result: [nil 24189 51396 0 21600 org-mobile-push nil nil 0] This time corresponds to 2020-03-27 10:35:00. Did you show the timer before or after the call to timer-inc-time in timer-event-handler, which calls your timer function? If this is after timer-inc-time was called, then the above is the time of the _next_ timer invocation. I think it would be useful to log in *Messages* also the value of current-time when the timer runs. > Creating agendas... > Preparing diary...done > > [...] ten lines equal to this ^ one > > Preparing diary...done > Agenda written to Org file /home/gijs/d/MobileOrg/agendas.org > Creating agendas...done > Saving all Org buffers... done > Copying files... > Writing index file... > Writing checksums... > Files for mobile viewer staged > [nil 24190 7460 0 21600 org-mobile-push nil nil 0] This time corresponds to 2020-03-27 16:35:00, the next time your timer should fire. > M-x list-timers tells me: > > -71245.81 360.00 org-mobile-push > > and eh, a little later, the variable value of list-timers shows: > > ([t 24188 52132 0 21600 org-mobile-push nil nil 0] But this time corresponds to 2020-03-26 16:35:00, i.e. the _previous_ day. How could this have happened? > But then... I guess (eval-defun) has run. I was expecting it to run > again in six hours? I can wait all day, put the laptop to sleep, but > the timer won't repeat. The next day the list-timer will show a minus > sign for org-mobile-push, for example > > -54728.53 360.00 org-mobile-push > > and looking at /home/gijs/d/MobileOrg/agendas.org will show me the files > were updated only when I eval-defun'ed (run-at-time "10:35" 21600 > 'org-mobile-push) the day before. Not at 10:35, not "six hours" later, > not the next morning. So you are saying that the messages in *Messages* that report the update of /home/gijs/d/MobileOrg/agendas.org on 2020-03-27 10:35:00 are a lie, and no update actually happened at that time? That would be surprising, since Emacs says it wrote the file. Or am I missing something? Maybe the time value shown there is the time of the _next_ timer trigger? > Did I evel-defun'ed org-mobile-push, instead of run-at-time? I cannot know that. But what I had in mind was to add 'message' calls in timer-event-handler, where it calls the timer function, increments the time to calculate the next time the timer should run, and sets the first element of the timer vector to nil. Then we might have a better idea what happens there when this strange problem occurs. In particular, I now wonder how come timer-inc-time returned the time for the _previous_ day (assuming it was that function which did it). Thanks.