I look for ideas, how to diagnose reason of Emacs freezes (by which I mean taking 100% CPU and being irresponsive for some time). This question is not about any specific case¹ but about approach…
Is it possible to ask Emacs „show me/dump somewhere current stack trace(s) of all currently running Lisp thread(s)”? Or maybe „dump stack trace very 10 seconds somewhere”? Sth I could do to check what's going on once I see my emacs frozen…
Or, is it possible to enable some kind of global profiling (with output put to some disk file at regular intervals) so I could look there for likely culprit?
Or, is there any other trick? What would you do if you saw misbehaving Emacs and bisecting all libraries would not seem promising²?
¹ Currently I experience two problems:
from time to time, Ctrl-Y takes 10-30 seconds (and Emacs takes 100% some CPU core during this time),
from time to time Emacs turns sluggish (albeit works more or less properly), and it turns out one of Emacs processes takes 100% of CPU
Both surely are related to some rogue lisp code (I load plenty of melpa modules) or caused by unexpected relationship of some modules, and it is fairly likely that it is my very specific configuration what makes them appear.
² My current problem appeared after I made major package-update which installed many updated versions of various packages and to which I also added a couple of new modules. Bisecting that doesn't seem promising as sometimes it takes a day or two before the problem appears, reverting to old versions for good also is not sth I would like…