On 03/26/2018 04:20 PM, Noam Postavsky wrote:
Michał, is the binding of buffer-undo-list significant for
your reproduction (i.e., did the original crash happen in an
undo-disabled buffer)?
Yes, originally it crashed with buffer-undo-list bound to t.


Today I was able to reproduce this crash without using Ivy. It crashes much faster (typically about 15 seconds):

(progn
  (package-initialize)
  (require 'yasnippet)

  (defun crash (key)
    (save-restriction
      (narrow-to-region 1 1)
      (insert " " key)
      (yas-expand)))

  (with-current-buffer "*scratch*"
    (yas-minor-mode-on)
    (let ((buffer-undo-list t))
      (while t
        (erase-buffer)
        (dolist (key '("def" "ah"))
          (run-with-idle-timer 0.0 nil #'crash key)
          (crash key))))))


Also, If I remove calls to save-restriction and narrow-to-region, Emacs doesn't crash. Or at least, it was running fine for 30 minutes until I killed Emacs.