tonini/alchemist.el

*Alchemist-IEx* randomly hangs on various occasions

whysoserious opened this issue · 3 comments

Alchemist-IEx hangs randomly when I hit enter to and send Elixir expression to be evaluated. I saw this happening on both Emacs 24 and 25,on Ubuntu and MacOS and on Elixir 1.4 and 1.5. Depending on a project it happens very rarely (once every ca. 8 hours) or extremely often (every couple of times I hit enter).

@tonini I was unable to reproduce it with 100% accuracy but I have some time free till the end of the week so I can try to debug and fix that bug. Please take a look at data below and maybe you'll be able to give me some good advice where I should start working on that.

My current configuration:
Kernel: Linux sarin 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:48 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
OS: Ubuntu 16.04.2 LTS
Emacs version: GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2017-05-06
Elixir version: 1.5.0

Stacktraces obtained by kill -SIGUSR2 <emacs_pid>:

Debugger entered--entering a function:
* company-pre-command()
  recursive-edit()
  debug(lambda)
* command-error-default-function((quit) "" nil)
  recursive-edit()
  debug(lambda)
* sml/-this-buffer-changed(1 5 0)
  accept-process-output(#<process Alchemist-IEx> nil)
  alchemist-iex-wait-for-prompt(#<process Alchemist-IEx>)
  #[(line) "\303�!\210\304�!b\210\305	\306P!\210\n`\307\223\210\310�	\306P\"\207" [proc line comint-last-input-end alchemist-iex-wait-for-prompt process-mark insert-before-markers "\n" nil comint-send-string] 4](#("Enum.map([1, 2. 3], &M.incr)" 0 8 (fontified t) 8 9 (fontified t) 9 17 (fontified t) 17 27 (fontified t) 27 28 (fontified t)))
  mapcar(#[(line) "\303�!\210\304�!b\210\305	\306P!\210\n`\307\223\210\310�	\306P\"\207" [proc line comint-last-input-end alchemist-iex-wait-for-prompt process-mark insert-before-markers "\n" nil comint-send-string] 4] (#("Enum.map([1, 2. 3], &M.incr)" 0 8 (fontified t) 8 9 (fontified t) 9 17 (fontified t) 17 27 (fontified t) 27 28 (fontified t))))
  -map(#[(line) "\303�!\210\304�!b\210\305	\306P!\210\n`\307\223\210\310�	\306P\"\207" [proc line comint-last-input-end alchemist-iex-wait-for-prompt process-mark insert-before-markers "\n" nil comint-send-string] 4] (#("Enum.map([1, 2. 3], &M.incr)" 0 8 (fontified t) 8 9 (fontified t) 9 17 (fontified t) 17 27 (fontified t) 27 28 (fontified t))))
  alchemist-iex--send-command(#<process Alchemist-IEx> #("Enum.map([1, 2. 3], &M.incr)" 0 8 (fontified t) 8 9 (fontified t) 9 17 (fontified t) 17 27 (fontified t) 27 28 (fontified t)))
  comint-send-input()
  funcall-interactively(comint-send-input)
  #<subr call-interactively>(comint-send-input nil nil)
  apply(#<subr call-interactively> comint-send-input (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> comint-send-input nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (comint-send-input nil nil))
  call-interactively(comint-send-input nil nil)
  command-execute(comint-send-input)
Debugger entered--entering a function:
* sml/-this-buffer-changed(1 5 0)
  accept-process-output(#<process Alchemist-IEx> nil)
  alchemist-iex-wait-for-prompt(#<process Alchemist-IEx>)
  #[(line) "\303�!\210\304�!b\210\305	\306P!\210\n`\307\223\210\310�	\306P\"\207" [proc line comint-last-input-end alchemist-iex-wait-for-prompt process-mark insert-before-markers "\n" nil comint-send-string] 4](#("quote do: &Substance.bar/0" 0 9 (fontified t) 9 11 (fontified t) 11 26 (fontified t)))
  mapcar(#[(line) "\303�!\210\304�!b\210\305	\306P!\210\n`\307\223\210\310�	\306P\"\207" [proc line comint-last-input-end alchemist-iex-wait-for-prompt process-mark insert-before-markers "\n" nil comint-send-string] 4] (#("quote do: &Substance.bar/0" 0 9 (fontified t) 9 11 (fontified t) 11 26 (fontified t))))
  -map(#[(line) "\303�!\210\304�!b\210\305	\306P!\210\n`\307\223\210\310�	\306P\"\207" [proc line comint-last-input-end alchemist-iex-wait-for-prompt process-mark insert-before-markers "\n" nil comint-send-string] 4] (#("quote do: &Substance.bar/0" 0 9 (fontified t) 9 11 (fontified t) 11 26 (fontified t))))
  alchemist-iex--send-command(#<process Alchemist-IEx> #("quote do: &Substance.bar/0" 0 9 (fontified t) 9 11 (fontified t) 11 26 (fontified t)))
  comint-send-input()
  funcall-interactively(comint-send-input)
  #<subr call-interactively>(comint-send-input nil nil)
  apply(#<subr call-interactively> comint-send-input (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> comint-send-input nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (comint-send-input nil nil))
  call-interactively(comint-send-input nil nil)
  command-execute(comint-send-input)
Debugger entered--entering a function:
* beacon--vanish(1 1)
  accept-process-output(#<process Alchemist-IEx> nil)
  alchemist-iex-wait-for-prompt(#<process Alchemist-IEx>)
  #[(line) "\303�!\210\304�!b\210\305	\306P!\210\n`\307\223\210\310�	\306P\"\207" [proc line comint-last-input-end alchemist-iex-wait-for-prompt process-mark insert-before-markers "\n" nil comint-send-string] 4](#("&Substance.bar/0" 0 10 (fontified t src-block t font-lock-fontified t) 10 15 (fontified t src-block t font-lock-fontified t) 15 16 (fontified t rear-nonsticky t src-block t font-lock-fontified t)))
  mapcar(#[(line) "\303�!\210\304�!b\210\305	\306P!\210\n`\307\223\210\310�	\306P\"\207" [proc line comint-last-input-end alchemist-iex-wait-for-prompt process-mark insert-before-markers "\n" nil comint-send-string] 4] (#("&Substance.bar/0" 0 10 (fontified t src-block t font-lock-fontified t) 10 15 (fontified t src-block t font-lock-fontified t) 15 16 (fontified t rear-nonsticky t src-block t font-lock-fontified t))))
  -map(#[(line) "\303�!\210\304�!b\210\305	\306P!\210\n`\307\223\210\310�	\306P\"\207" [proc line comint-last-input-end alchemist-iex-wait-for-prompt process-mark insert-before-markers "\n" nil comint-send-string] 4] (#("&Substance.bar/0" 0 10 (fontified t src-block t font-lock-fontified t) 10 15 (fontified t src-block t font-lock-fontified t) 15 16 (fontified t rear-nonsticky t src-block t font-lock-fontified t))))
  alchemist-iex--send-command(#<process Alchemist-IEx> #("&Substance.bar/0" 0 10 (font-lock-fontified t src-block t fontified t) 10 15 (font-lock-fontified t src-block t fontified t) 15 16 (font-lock-fontified t src-block t rear-nonsticky t fontified t)))
  comint-send-input()
  funcall-interactively(comint-send-input)
  #<subr call-interactively>(comint-send-input nil nil)
  apply(#<subr call-interactively> comint-send-input (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> comint-send-input nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (comint-send-input nil nil))
  call-interactively(comint-send-input nil nil)
  command-execute(comint-send-input)

Probably duplicate of #297

kuwze commented

I have the same issue. IEx is hanging with very simple input almost as soon as I start trying to use it. I am using very simple code as I have just started to learn Elixir, so it's not like I am working on some big project.

uname -a

Linux machine 4.10.0-33-generic #37-Ubuntu SMP Fri Aug 11 10:55:28 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

using Ubuntu 17.04.

Emacs --version

GNU Emacs 25.1.1

elixir --version

Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.5.1

and I installed Erlang/Elixir from the debian package recommended by the Elixir website:
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb

Also see #326