DarwinAwardWinner / ido-completing-read-plus

Fancy completion all over Emacs, not just for buffers and files.
GNU General Public License v3.0
241 stars 31 forks source link

ido-cr+ hangs in Info-menu #151

Closed patxoca closed 6 years ago

patxoca commented 6 years ago

In order to reproduce this behaviour with emacs -Q evaluate the following code (adjust directories as required):

(push "/home/aroda/.emacs.d/elpa/ido-completing-read+-4.7" load-path)
(push "/home/aroda/.emacs.d/elpa/s-1.12.0" load-path)
(push "/home/aroda/.emacs.d/elpa/memoize-1.1" load-path)

(require 'ido)
(ido-mode 1)

(require 'ido-completing-read+)
(ido-ubiquitous-mode 1)

Then type C-h i m e m a c s (the actual search is irrelevant) and keep pressing the previous/next keys. After some key presses it will block. I've been unable to spot a pattern, keep pressing previous/next randomly for a while.

In emacs 25.2.1 and emacs 25.3.1 CPU usage gets 100%. If started with -nwit dumps core. In graphical mode pressing C-g repeatedly regains control. In emacs 26.0.91 it displays a warning but no hang:

Warning (ido-cr+): Disabling dynamic update due to error: (circular-list ("realpath" "readlink" "pwd" "ptx" "pr" "printf" "printenv" "pooltype" "pltotf" "pktype" "pktogf" "pathchk" "patgen" "patch" "paste" "od" "numfmt" "nproc" "nohup" "nl" "nice" "mv" "mpost" "mltex" "mktemp" "mknod" "mkfifo" "mkdir" "mft" "mf" "md5sum" "ls" "logname" "locate" "ln" "link" "kill" "join" ... )

For now I've blacklisted Info-menu in my config.

DarwinAwardWinner commented 6 years ago

Sure enough, I can reproduce this on my computer. I'll look into it when I get the chance.

DarwinAwardWinner commented 6 years ago

This is likely related to #146.

patxoca commented 6 years ago

I've tried applying the patch from #146 and still hangs, in emacs 25.x. Tomorrow I'll do some more testing.

DarwinAwardWinner commented 6 years ago

Yeah, #146 isn't actually fixed yet. I was just making the link between the two issues since they seem to be related.

DarwinAwardWinner commented 6 years ago

Ok, I figured out how to consistently reproduce this: after typing C-h i m e m a c s, press the right arrow, then wait a few seconds, then press the right arrow again, and wait a few more seconds, and then Emacs will hang. Thus, the code causing the hang is likely part of the dynamic update code which runs on an idle timer. For some reason it only hangs the second time the idle timer runs.

I managed to get a backtrace from this, but emacs hung permanently afterward, so I couldn't copy the backtrace. Regardless, it seems the error was happening in ido-chop, which I would expect to hang like this on a circular list. So it seems likely that this bug has a common cause with #146.

DarwinAwardWinner commented 6 years ago

Additionally, after the first time pressing the right arrow and then waiting for idle, the list of completions updated in a way that did not preserve the current match, which also indicates a bug in the dynamic update code.

patxoca commented 6 years ago

I can reproduce the hang with the procedure you describe.

I was playing with ido-cr+ and setting ido-cr+-dynamic-update-idle-time to 25 (effectively disabling dynamic updates ... I think ... I don't understand most of ido-cr+ or what dynamic updates are for) removed the hang. This seems to confirm that dynamic update code is somehow involved in the bug (?).

patxoca commented 6 years ago

Thanks for fixing the issue!