X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,SPF_NEUTRAL X-Spam-Check-By: sourceware.org Message-ID: <4F3A7357.4010505@cs.utoronto.ca> Date: Tue, 14 Feb 2012 09:44:39 -0500 From: Ryan Johnson User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120129 Thunderbird/10.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: File operations really slow in emacs References: <4F35C1E0 DOT 2020308 AT cs DOT utoronto DOT ca> <20120211101158 DOT GC9823 AT calimero DOT vinschen DOT de> <4F3910B2 DOT 3070905 AT cs DOT utoronto DOT ca> <4F3A63AF DOT 7010905 AT cs DOT utoronto DOT ca> <20120214135246 DOT GA25918 AT calimero DOT vinschen DOT de> In-Reply-To: <20120214135246.GA25918@calimero.vinschen.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 14/02/2012 8:52 AM, Corinna Vinschen wrote: > On Feb 14 08:37, Ryan Johnson wrote: >> Bump? > Stagger! > >> On 13/02/2012 8:31 AM, Ryan Johnson wrote: >>> On 11/02/2012 5:11 AM, Corinna Vinschen wrote: >>>> On Feb 10 20:18, Ryan Johnson wrote: >>>>> Hi all, >>>>> >>>>> For some reason file operations have become very slow inside emacs >>>>> starting yesterday. It's especially painful when saving a file >>>>> that's managed by mercurial (more than 20 seconds!), but I've seen >>>>> it on the command line as well (x-server takes a similar amount of >>>>> time to start, for example). I'm running the latest everything and >>>>> I've run rebaseall. I verified that Windows Defender did not >>>>> silently re-enable itself since I last disabled it (you can't >>>>> actually uninstall it) and no other BLODA are present on my machine. >>>>> The problem persists across reboots. >>>>> >>>>> I have vague memories that this has turned up in the past (maybe >>>>> 12-15 months ago?) but Google isn't turning up anything. Attaching >>>>> strace to emacs during the save makes it take a full 35 seconds and >>>>> reports the following: >>>>> >>>>> $ cat emacs.strace | awk '{if ($1> 1000000) { print }}' | grep -v >>>>> timer_thread >>>>> 26910790 26912157 [main] emacs-X11 5188 child_copy: dll bss - hp >>>>> 0x264 low 0x611FC000, high 0x61230770, res 1 >>>>> 1128419 2125655 [main] python2.6 5188 read: read(5, 0x8009DB60, >>>>> 65536) blocking >>>>> 25850184 32830582 [main] python2.6 5188 stat_worker: 0 = >>>>> (\??\C:\cygwin\cygdrive,0x28BB68) >>>> ^^^^^^^^^^^^^^^^^^^^^^^ >>>> This looks suspicious. I assume you're suffering from SMB network >>>> scanning. >>> is there a workaround? Neither "always run elevated" nor "always >>> keep all network drives mounted" seems like a reasonable >>> requirement > What are you expecting? Was my reply in > http://cygwin.com/ml/cygwin/2012-02/msg00375.html not sufficient? The reply explains why running elevated avoids the problem -- apparently a side-effect of Windows' user token handling. It does not explain why it's a good idea to always run elevated to get a side effect that compensates for bad behavior which is arguably a bug (though that's what I'm doing right now for lack of a better option -- I often work off-grid, so I can't always have all network drives mapped). AFAICT, `stat /cydrive` runs into trouble because it enumerates all drive letters using GetFileAttributes, and only counts local drives as "links" to the "directory" : 2 + ndrives - nfloppies - nnonlocal. This relies on the fact (a side effect?) that GetFileAttributes returns ERROR_BAD_NETPATH for network shares (but apparently only after timing out an attempt to connect disconnected ones). Not sure what happens for USB drives (are they "floppies" ?). Is there no other way to enumerate the local drives, and even if there isn't, does anybody actually care about that particular link count? AFAIK, directory link counts only matter when you want to run fsck (which cygwin doesn't have) or delete a directory. Even if cygwin's rm pays attention to link counts, which I doubt, anyone issuing `rm -rf /cygdrive` has far bigger problems on their hands. Ryan -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple