From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sullivan Beck Newsgroups: gmane.emacs.bugs Subject: bug#4954: 23.1; Emacs hangs when two run-at-time calls in effect Date: Wed, 18 Nov 2009 20:29:10 -0500 Message-ID: <4B049F66.2020104@ufl.edu> References: <4B0415BC.9010400@ufl.edu> Reply-To: Sullivan Beck , 4954@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1258595274 11523 80.91.229.12 (19 Nov 2009 01:47:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Nov 2009 01:47:54 +0000 (UTC) Cc: 4954@emacsbugs.donarmstrong.com To: Lennart Borgman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 19 02:47:47 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NAw7e-0004bk-Ul for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Nov 2009 02:47:47 +0100 Original-Received: from localhost ([127.0.0.1]:46352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAw7e-00006c-DN for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Nov 2009 20:47:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAw7N-0008N7-8O for bug-gnu-emacs@gnu.org; Wed, 18 Nov 2009 20:47:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAw7I-0008In-D0 for bug-gnu-emacs@gnu.org; Wed, 18 Nov 2009 20:47:28 -0500 Original-Received: from [199.232.76.173] (port=39260 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAw7I-0008Ia-8l for bug-gnu-emacs@gnu.org; Wed, 18 Nov 2009 20:47:24 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:39088) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NAw7H-0005Rs-FK for bug-gnu-emacs@gnu.org; Wed, 18 Nov 2009 20:47:23 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAJ1lKGV028296; Wed, 18 Nov 2009 17:47:21 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id nAJ1Z3lR027007; Wed, 18 Nov 2009 17:35:03 -0800 Resent-Date: Wed, 18 Nov 2009 17:35:03 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Sullivan Beck Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Thu, 19 Nov 2009 01:35:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4954 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4954-submit@emacsbugs.donarmstrong.com id=B4954.125859415226485 (code B ref 4954); Thu, 19 Nov 2009 01:35:03 +0000 Original-Received: (at 4954) by emacsbugs.donarmstrong.com; 19 Nov 2009 01:29:12 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from smtp.ufl.edu (smtp03.osg.ufl.edu [128.227.74.70]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nAJ1TAOX026482 for <4954@emacsbugs.donarmstrong.com>; Wed, 18 Nov 2009 17:29:11 -0800 Original-Received: from [192.168.0.100] (ip24-136-37-175.ga.at.cox.net [24.136.37.175]) (authenticated bits=0) by smtp.ufl.edu (8.14.0/8.14.0/3.0.0) with ESMTP id nAJ1T6bb019167 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 18 Nov 2009 20:29:09 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4pre) Gecko/20090915 Thunderbird/3.0b4 In-Reply-To: X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5, 1.2.40, 4.0.166 definitions=2009-11-18_09:2009-11-16, 2009-11-18, 2009-11-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-0908210000 definitions=main-0911180260 X-UFL-Spam-Level: * X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Wed, 18 Nov 2009 20:47:28 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:32694 Archived-At: On 11/18/2009 6:36 PM, Lennart Borgman wrote: > On Wed, Nov 18, 2009 at 4:41 PM, Sullivan Beck wrote: > >> I wrote two simple emacs extensions, both of which use the run-at-time >> function periodically write some information to a file. When one or the >> other is loaded, emacs works fine. When both are loaded, emacs will work >> fine for a while, and then suddently start behaving very sluggishly. >> Keyboard input will not be printed on the screen for 2-4 seconds. It >> never seems to recover (though the periodic work should only take a >> fraction of a second) and eventually, I have to kill emacs and restart. >> >> I'll include both extensions below, though I don't believe that either >> of them are directly related to the cause of the problem... it just >> happened that they both use run-at-time. >> > Hi Sullivan, > > I do not know what causes the hang, but I can guess. In both your > extensions you are saving data to a file. I wonder if that operation > is syncronous? If it is then all Emacs can do is to wait there. (File > operations can be both async and sync and I do not know what Emacs is > doing.) > > It could be... and I certainly considered the fact that perhaps both were trying to do something at the same time and were blocking each other somehow. My problem with this is that the slowness doesn't go away once it's started. If the two saves are EXACTLY in sync with each other (and it's possible... I gave them both a 5 minute interval, and they were initialized right after each other), I wouldn't be surprised to see emacs become sluggish for a few seconds every 5 minutes. The problem is that once the sluggishness starts, it persists for several minutes. I've never tried to outwait it for too long of a time, but I've certainly given it 2-3 minutes, and the sluggishness persists. If the two operations can't figure out in that time how to get their writes done, I'd say that it has to be a bug in that code. I'll bet that your suggestion of starting up a run-with-idle-timer would be a good workaround (and I may or may not do it... probably not since the workaround I've already got is good enough for me). I mainly submitted the bug so that whoever is in charge of the code that runs the timer may look at it. I'm probably at a point where I'm satisfied with what I've got, at least for the time being. Anyway, thanks for the reply. > A way to work around the trouble is perhaps to rewrite your scheduling > of the saving operations. Here is one suggestion: > > - Instead of saving immediately in the timer start a second timer with > run-with-idle-timer. > - In that timer do the saving. > > This makes the chance that the saving will occur while you are typing > a bit smaller, but it does not avoid the trouble totally. > >