unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Change in vc-git ls-files-unknown makes emacs hang
@ 2019-12-19 14:16 Filipp Gunbin
  2019-12-19 14:41 ` Dmitry Gutov
  2019-12-19 20:45 ` Change in vc-git ls-files-unknown makes emacs hang Stefan Monnier
  0 siblings, 2 replies; 14+ messages in thread
From: Filipp Gunbin @ 2019-12-19 14:16 UTC (permalink / raw)
  To: emacs-devel; +Cc: andreyk.mad

Hi, this commit makes Emacs hang and become unusable, this happens when
loading the desktop.  Quitting doesn't unfreeze, so I can't get the
backtrace.  I'm on macOS, tty emacs.

commit 1a2445c45f901d9d939f2992dd8e616e5d7cb9ca
Author: Andrii Kolomoiets <andreyk.mad@gmail.com>
Date:   Tue Dec 17 01:49:34 2019 +0200
  Make ls-files-unknown only return proper files, not directories

I can't tell the reason of the hang, but reverting it helps.

Andrii, could you please look into it, or revert?

Thanks.
Filipp



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-19 14:16 Change in vc-git ls-files-unknown makes emacs hang Filipp Gunbin
@ 2019-12-19 14:41 ` Dmitry Gutov
  2019-12-19 20:44   ` Filipp Gunbin
  2019-12-19 20:45 ` Change in vc-git ls-files-unknown makes emacs hang Stefan Monnier
  1 sibling, 1 reply; 14+ messages in thread
From: Dmitry Gutov @ 2019-12-19 14:41 UTC (permalink / raw)
  To: emacs-devel, andreyk.mad

Hi Filipp,

On 19.12.2019 16:16, Filipp Gunbin wrote:
> Hi, this commit makes Emacs hang and become unusable, this happens when
> loading the desktop.  Quitting doesn't unfreeze, so I can't get the
> backtrace.  I'm on macOS, tty emacs.

I'm the one who reviewed that patch.

Could you figure out under what circumstances that code 
(vc-git-dir-status-goto-stage which triggers the freeze) gets called 
while loading the desktop? In particular, for which directory (but which 
list of files is passed to vc-git-dir-status-files might also be 
important). And after you figure that out, does VC-Dir work okay in it?

Since backtrace is hard to get, how about some print-debugging with 
logging to a file? write-region should help.

UUIC, the only case where this change should lead to a performance 
problem is a Git repository with lots of unregistered files. Ones not 
hidden by gitignore.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-19 14:41 ` Dmitry Gutov
@ 2019-12-19 20:44   ` Filipp Gunbin
  2019-12-19 22:42     ` Dmitry Gutov
  0 siblings, 1 reply; 14+ messages in thread
From: Filipp Gunbin @ 2019-12-19 20:44 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: andreyk.mad, emacs-devel

Hi Dmitry,

Yes, I caught it, and this:

> UUIC, the only case where this change should lead to a performance
> problem is a Git repository with lots of unregistered files. Ones not
> hidden by gitignore.

is exactly my use case.  I have git repo right in my home dir, mainly
for dot-files.  Most other stuff there is in .gitignore, but there're
some not-ignored directories with large amount of files, like .ivy2 with
cache of jars from ivy repositories.

And vc-dir there (or in a subdirectory) leads to a freeze.

HTH, Filipp



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-19 14:16 Change in vc-git ls-files-unknown makes emacs hang Filipp Gunbin
  2019-12-19 14:41 ` Dmitry Gutov
@ 2019-12-19 20:45 ` Stefan Monnier
  1 sibling, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2019-12-19 20:45 UTC (permalink / raw)
  To: emacs-devel; +Cc: andreyk.mad

> Hi, this commit makes Emacs hang and become unusable, this happens when
> loading the desktop.  Quitting doesn't unfreeze, so I can't get the
> backtrace.  I'm on macOS, tty emacs.

kill -USR2 <emacspid>


        Stefan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-19 20:44   ` Filipp Gunbin
@ 2019-12-19 22:42     ` Dmitry Gutov
  2019-12-20  7:33       ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Gutov @ 2019-12-19 22:42 UTC (permalink / raw)
  To: emacs-devel, andreyk.mad

On 19.12.2019 22:44, Filipp Gunbin wrote:

> Yes, I caught it, and this:
> 
>> UUIC, the only case where this change should lead to a performance
>> problem is a Git repository with lots of unregistered files. Ones not
>> hidden by gitignore.
> 
> is exactly my use case.  I have git repo right in my home dir, mainly
> for dot-files.  Most other stuff there is in .gitignore, but there're
> some not-ignored directories with large amount of files,

Then, first of all, you know the workaround: add some gitignore entries.

> like .ivy2 with
> cache of jars from ivy repositories.

I wonder: how many files?

And it would be helpful, of course, to figure out which code calls it 
during desktop-read. It's probably not VC-Dir, or you would have have 
noticed it much earlier. Maybe some third-party code?

> And vc-dir there (or in a subdirectory) leads to a freeze.

I'm hesitant to revert it because VC-Dir really doesn't deal with the 
previous format very well (meaning, directories with statuses returned 
only sometimes).

And before the latest change you couldn't easily register new files from 
the VC-Dir  buffer if the directory they are in is also new.

So, opinions welcome.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-19 22:42     ` Dmitry Gutov
@ 2019-12-20  7:33       ` Eli Zaretskii
  2019-12-20 10:52         ` Filipp Gunbin
  2019-12-21 21:51         ` Proced signals (was: Change in vc-git ls-files-unknown makes emacs hang) Juri Linkov
  0 siblings, 2 replies; 14+ messages in thread
From: Eli Zaretskii @ 2019-12-20  7:33 UTC (permalink / raw)
  To: Dmitry Gutov, Filipp Gunbin; +Cc: andreyk.mad, emacs-devel

> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Fri, 20 Dec 2019 00:42:24 +0200
> 
> So, opinions welcome.

My HO is that we need to understand better which code causes the
freeze, before we can discuss solutions.

Filipp, please produce a backtrace during the freeze, either by using
SIGUSR2, as Stefan suggested, or by attaching a debugger, and post the
backtrace.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-20  7:33       ` Eli Zaretskii
@ 2019-12-20 10:52         ` Filipp Gunbin
  2019-12-20 14:13           ` Dmitry Gutov
  2019-12-21 21:51         ` Proced signals (was: Change in vc-git ls-files-unknown makes emacs hang) Juri Linkov
  1 sibling, 1 reply; 14+ messages in thread
From: Filipp Gunbin @ 2019-12-20 10:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, monnier, andreyk.mad, Dmitry Gutov

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

On 20/12/2019 09:33 +0200, Eli Zaretskii wrote:

>> From: Dmitry Gutov <dgutov@yandex.ru>
>> Date: Fri, 20 Dec 2019 00:42:24 +0200
>>
>> So, opinions welcome.
>
> My HO is that we need to understand better which code causes the
> freeze, before we can discuss solutions.
>
> Filipp, please produce a backtrace during the freeze, either by using
> SIGUSR2, as Stefan suggested, or by attaching a debugger, and post the
> backtrace.

Hi, please find the trace in the attach (it's large).

Stefan, thanks for the advice.


[-- Attachment #2: trace--vc-git-after-dir-status-stage.txt --]
[-- Type: text/plain, Size: 14633 bytes --]

Debugger entered--Lisp error: (quit)
  directory-file-name("/Users/fgunbin/.gradle/wrapper/dists/gradle-5.6.4-...")
  #f(compiled-function (entry1 entry2) #<bytecode 0x1ffee568dde9>)((".gradle/wrapper/dists/gradle-5.6.4-all/ankdp27end7..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6.4-all/ankdp27end7..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)))
  sort(((".wget-hsts" unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) ...) #f(compiled-function (entry1 entry2) #<bytecode 0x1ffee568dde9>))
  vc-dir-update(((".wget-hsts" unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) ...) #<buffer *vc-dir*<fgunbin>>)
  #f(compiled-function (entries &optional more-to-come) #<bytecode 0x1ffee5c1f6d9>)(((".wget-hsts" unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) (".gradle/wrapper/dists/gradle-5.6..." unregistered #s(vc-git-extra-fileinfo :old-perm 0 :new-perm 0 :rename-state nil :orig-name nil)) ...) nil)
  vc-git-after-dir-status-stage(#s(vc-git-dir-status-state :stage nil :files nil :update-function #f(compiled-function (entries &optional more-to-come) #<bytecode 0x1ffee5c1f6d9>) :hash #<hash-table equal 61743/63108 0x1ffee586fb01>))
  #f(compiled-function () #<bytecode 0x1ffee5c21789>)()
  vc-exec-after(#f(compiled-function () #<bytecode 0x1ffee5c21789>))
  vc--process-sentinel(#<process git> #f(compiled-function () #<bytecode 0x1ffee5c21789>))
  #f(compiled-function (p msg) #<bytecode 0x1ffee5c217ad>)(#<process git> "finished\n")
  apply(#f(compiled-function (p msg) #<bytecode 0x1ffee5c217ad>) (#<process git> "finished\n"))
  #f(advice-wrapper :after #f(advice-wrapper :after #f(advice-wrapper :after ignore #f(compiled-function (p msg) #<bytecode 0x1ffee5c216a9>)) #f(compiled-function (p msg) #<bytecode 0x1ffee5c21731>)) #f(compiled-function (p msg) #<bytecode 0x1ffee5c217ad>))(#<process git> "finished\n")

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-20 10:52         ` Filipp Gunbin
@ 2019-12-20 14:13           ` Dmitry Gutov
  2019-12-20 15:36             ` Filipp Gunbin
  0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Gutov @ 2019-12-20 14:13 UTC (permalink / raw)
  To: Eli Zaretskii, emacs-devel, andreyk.mad, monnier

[-- Attachment #1: Type: text/plain, Size: 804 bytes --]

On 20.12.2019 12:52, Filipp Gunbin wrote:

>> Filipp, please produce a backtrace during the freeze, either by using
>> SIGUSR2, as Stefan suggested, or by attaching a debugger, and post the
>> backtrace.
> 
> Hi, please find the trace in the attach (it's large).

Thank you. It doesn't exactly answer my question about desktop-read (did 
you really have an old VC-Dir buffer in that saved session?), but it 
shows one bottleneck. One that is even prominently decorated with an old 
comment saying "this is VERY inefficient". :-)

Here's a patch you can try. It should help to an extent. And if it's the 
main bottleneck, we can optimize further, e.g. by eliminating the 
expand-file-name calls.

But if in the end you should see one very long VC-Dir buffer, which can 
be a usability problem on its own.

[-- Attachment #2: vc-dir-update-faster.diff --]
[-- Type: text/x-patch, Size: 1708 bytes --]

diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index e225978592..ad25e8aa53 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -390,19 +390,22 @@ vc-dir-update
     ;; We assume the ewoc is sorted too, which should be the
     ;; case if we always add entries with vc-dir-update.
     (setq entries
+          (let ((entry-dirs
+                 (mapcar (lambda (entry)
+                           (cons (file-name-directory
+                                  (directory-file-name (expand-file-name (car entry))))
+                                 entry))
+                         entries)))
 	  ;; Sort: first files and then subdirectories.
-	  ;; XXX: this is VERY inefficient, it computes the directory
-	  ;; names too many times
-	  (sort entries
-		(lambda (entry1 entry2)
-		  (let ((dir1 (file-name-directory
-			        (directory-file-name (expand-file-name (car entry1)))))
-			(dir2 (file-name-directory
-			       (directory-file-name (expand-file-name (car entry2))))))
-		    (cond
-		     ((string< dir1 dir2) t)
-		     ((not (string= dir1 dir2)) nil)
-		     ((string< (car entry1) (car entry2))))))))
+            (mapcar #'cdr
+                    (sort entry-dirs
+                          (lambda (pair1 pair2)
+                            (let ((dir1 (car pair1))
+                                  (dir2 (car pair2)))
+                              (cond
+                               ((string< dir1 dir2) t)
+                               ((not (string= dir1 dir2)) nil)
+                               ((string< (cadr pair1) (cadr pair2))))))))))
     ;; Insert directory entries in the right places.
     (let ((entry (car entries))
 	  (node (ewoc-nth vc-ewoc 0))

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-20 14:13           ` Dmitry Gutov
@ 2019-12-20 15:36             ` Filipp Gunbin
  2019-12-20 15:40               ` Dmitry Gutov
  0 siblings, 1 reply; 14+ messages in thread
From: Filipp Gunbin @ 2019-12-20 15:36 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Eli Zaretskii, monnier, andreyk.mad, emacs-devel

Dmitry, thanks, it helps - no freezes and no visible delays now, at
least not yet.

On 20/12/2019 16:13 +0200, Dmitry Gutov wrote:

> Thank you. It doesn't exactly answer my question about desktop-read (did
> you really have an old VC-Dir buffer in that saved session?), but it
> shows one bottleneck. One that is even prominently decorated with an old
> comment saying "this is VERY inefficient". :-)

When I was trying to generate trace, I started & killed (-s USR2) emacs
several times, and saw that desktop had several buffers which could
trigger the problem.

Filipp



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-20 15:36             ` Filipp Gunbin
@ 2019-12-20 15:40               ` Dmitry Gutov
  2019-12-20 17:14                 ` Filipp Gunbin
  0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Gutov @ 2019-12-20 15:40 UTC (permalink / raw)
  To: Eli Zaretskii, emacs-devel, andreyk.mad, monnier

On 20.12.2019 17:36, Filipp Gunbin wrote:
> Dmitry, thanks, it helps - no freezes and no visible delays now, at
> least not yet.

Very good.

Does the resulting VC-Dir buffer look usable?

> When I was trying to generate trace, I started & killed (-s USR2) emacs
> several times, and saw that desktop had several buffers which could
> trigger the problem.

So there were several VC-Dir buffers like that in that session?



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-20 15:40               ` Dmitry Gutov
@ 2019-12-20 17:14                 ` Filipp Gunbin
  2019-12-20 22:18                   ` Dmitry Gutov
  0 siblings, 1 reply; 14+ messages in thread
From: Filipp Gunbin @ 2019-12-20 17:14 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Eli Zaretskii, monnier, andreyk.mad, emacs-devel

On 20/12/2019 17:40 +0200, Dmitry Gutov wrote:

> On 20.12.2019 17:36, Filipp Gunbin wrote:
>> Dmitry, thanks, it helps - no freezes and no visible delays now, at
>> least not yet.
>
> Very good.
>
> Does the resulting VC-Dir buffer look usable?

Yes, currently no problems.  I'm in emacs with the patch now, will post
if anything appears in the neartime.

>> When I was trying to generate trace, I started & killed (-s USR2) emacs
>> several times, and saw that desktop had several buffers which could
>> trigger the problem.
>
> So there were several VC-Dir buffers like that in that session?

My feeling was that any dired buffer for a directory underneath home dir
(where .git is) also invoked freeze.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Change in vc-git ls-files-unknown makes emacs hang
  2019-12-20 17:14                 ` Filipp Gunbin
@ 2019-12-20 22:18                   ` Dmitry Gutov
  0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Gutov @ 2019-12-20 22:18 UTC (permalink / raw)
  To: Eli Zaretskii, emacs-devel, andreyk.mad, monnier

On 20.12.2019 19:14, Filipp Gunbin wrote:

>> Does the resulting VC-Dir buffer look usable?
> 
> Yes, currently no problems.  I'm in emacs with the patch now, will post
> if anything appears in the neartime.

Thank you. I've pushed that change as 2c8f153 now.

>> So there were several VC-Dir buffers like that in that session?
> 
> My feeling was that any dired buffer for a directory underneath home dir
> (where .git is) also invoked freeze.

If you are using diff-hl-dired-mode, maybe. But it shouldn't suffer from 
the same problem.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Proced signals (was: Change in vc-git ls-files-unknown makes emacs hang)
  2019-12-20  7:33       ` Eli Zaretskii
  2019-12-20 10:52         ` Filipp Gunbin
@ 2019-12-21 21:51         ` Juri Linkov
  2019-12-22 17:02           ` Eli Zaretskii
  1 sibling, 1 reply; 14+ messages in thread
From: Juri Linkov @ 2019-12-21 21:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, Filipp Gunbin, andreyk.mad, Dmitry Gutov

>> So, opinions welcome.
>
> My HO is that we need to understand better which code causes the
> freeze, before we can discuss solutions.
>
> Filipp, please produce a backtrace during the freeze, either by using
> SIGUSR2, as Stefan suggested, or by attaching a debugger, and post the
> backtrace.

BTW, why proced.el doesn't support SIGUSR2?  Is this because
some standard doesn't declare SIGUSR2 as "portable"?



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Proced signals (was: Change in vc-git ls-files-unknown makes emacs hang)
  2019-12-21 21:51         ` Proced signals (was: Change in vc-git ls-files-unknown makes emacs hang) Juri Linkov
@ 2019-12-22 17:02           ` Eli Zaretskii
  0 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2019-12-22 17:02 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel, fgunbin, andreyk.mad, dgutov

> From: Juri Linkov <juri@linkov.net>
> Cc: Dmitry Gutov <dgutov@yandex.ru>,  Filipp Gunbin <fgunbin@fastmail.fm>,
>   andreyk.mad@gmail.com,  emacs-devel@gnu.org
> Date: Sat, 21 Dec 2019 23:51:18 +0200
> 
> BTW, why proced.el doesn't support SIGUSR2?  Is this because
> some standard doesn't declare SIGUSR2 as "portable"?

No, we already have there some signals that are less portable than
others.  I guess it wasn't deemed "important" enough; feel free to
add.



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-12-22 17:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-19 14:16 Change in vc-git ls-files-unknown makes emacs hang Filipp Gunbin
2019-12-19 14:41 ` Dmitry Gutov
2019-12-19 20:44   ` Filipp Gunbin
2019-12-19 22:42     ` Dmitry Gutov
2019-12-20  7:33       ` Eli Zaretskii
2019-12-20 10:52         ` Filipp Gunbin
2019-12-20 14:13           ` Dmitry Gutov
2019-12-20 15:36             ` Filipp Gunbin
2019-12-20 15:40               ` Dmitry Gutov
2019-12-20 17:14                 ` Filipp Gunbin
2019-12-20 22:18                   ` Dmitry Gutov
2019-12-21 21:51         ` Proced signals (was: Change in vc-git ls-files-unknown makes emacs hang) Juri Linkov
2019-12-22 17:02           ` Eli Zaretskii
2019-12-19 20:45 ` Change in vc-git ls-files-unknown makes emacs hang Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).