Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs hangs when running Alchemist during Autocomplete #210

Closed
randre03 opened this issue Feb 26, 2016 · 17 comments
Closed

Emacs hangs when running Alchemist during Autocomplete #210

randre03 opened this issue Feb 26, 2016 · 17 comments

Comments

@randre03
Copy link

I am running Spacemacs (0.105.11) on top of Emacs (24.5.1) on OSX (El Capitan). Whenever I am working on Elixir I do so with Alchemist, but now I have noticed that every time it will hang and I have to force Emacs to restart. I tried to get some more info with "debug-on-error" but for some reason that was not triggered when Emacs froze. It is to the point where I cannot use Alchemist any more, sometimes I cannot even type a single line of code. As best I can tell, it appears to be when trying to access detailed documentation. I have had it happen more than once when typing the idiom "def sum(x), do:" upon reaching the colon after "do". Sorry I don't have any better debugging info for you.
-Roger

@mcginleyr1
Copy link

I'm also encountering this. It is also the alchemist-server on auto completion. I was able to break out of the freeze by grabbing the PID for alchemist-server and killing it from the command line. I am looking for any logs that can help us understand what's going on.

@gausby
Copy link
Contributor

gausby commented Mar 6, 2016

I don't use spacemacs and I haven't got any problems.

It would be helpful if you could get the version numbers of alchemist.el, alchemist-server, and elixir-mode.

@mcginleyr1
Copy link

;;; alchemist.el --- Elixir tooling integration into Emacs

;; Copyright © 2014-2015 Samuel Tonini
;;
;; Author: Samuel Tonini <tonini.samuel@gmail.com>
;; Maintainer: Samuel Tonini <tonini.samuel@gmail.com>
;; URL: http://www.github.com/tonini/alchemist.el
;; Version: 1.7.0
;;; elixir-mode.el --- Major mode for editing Elixir files

;; Copyright 2011-2015 secondplanet
;;           2013-2015 Samuel Tonini, Matt DeBoard, Andreas Fuchs
;; Authors: Humza Yaqoob,
;;          Andreas Fuchs <asf@boinkor.net>,
;;          Matt DeBoard
;;          Samuel Tonini <tonini.samuel@gmail.com>

;; URL: https://github.com/elixir-lang/emacs-elixir
;; Created: Mon Nov 7 2011
;; Keywords: languages elixir
;; Version: 2.2.8
;; Package-Requires: ((emacs "24") (pkg-info "0.4"))
git describe --tags --abbrev=0 | sed 's/^v//'
0.105.4

Feel free to just point me to a good way to debug the server and I can look into this, and update the ticket.

@gausby
Copy link
Contributor

gausby commented Mar 6, 2016

Seems to be the latest and greatest. How about disabling company? Does it stop the freezing?

@mcginleyr1
Copy link

I was actually playing with that last weekend and turning company off does stop the freeze. It's directly related to completion, none of the other functionality causes the freeze.

@gausby
Copy link
Contributor

gausby commented Mar 6, 2016

I've been looking into the issues regarding company and freezes on the spacemacs issue tracker.

It seems that there are some issues with other modes as well, so perhaps some of the solutions works in this case.

@mcginleyr1
Copy link

👍

@randre03
Copy link
Author

randre03 commented Mar 7, 2016

Have not hit upon the solution in any of those issues yet. I do note that there is one issue listed After upgrade to 105 Emacs freezes in nim-mode in auto-complete #4403 that noted the following in the errors they were seeing:

In the Messages buffer I found:

Company: An error occurred in auto-begin
Timeout server response.
Company: An error occurred in auto-begin
Timeout server response.

My errors are

Company: An error occurred in auto-begin
Wrong type argument: stringp, nil
Company: An error occurred in auto-begin
Wrong type argument: stringp, nil

Still wandering in the woods at this point.


From: Martin Gausby notifications@github.com
Sent: Sunday, March 6, 2016 3:10 PM
To: tonini/alchemist.el
Cc: Roger Randall
Subject: Re: [alchemist.el] Emacs hangs when running Alchemist during Autocomplete (#210)

I've been looking into the issues regarding company and freezes on the spacemacs issue tracker.

syl20bnr/spacemacshttps://github.com/syl20bnr/spacemacs/search?utf8=%E2%9C%93&q=company+freeze&type=Issues
github.com
spacemacs - A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs and Vim!

It seems that there are some issues with other modes as well, so perhaps some of the solutions works in this case.

Reply to this email directly or view it on GitHubhttps://github.com//issues/210#issuecomment-192995074.

@tonini
Copy link
Owner

tonini commented Mar 7, 2016

Hi,

First thanks to @gausby to helping the people with the issue out. ❤️

Could it be that you guys using the company-quickhelp mode? https://github.com/expez/company-quickhelp

Recently a few guys from the slack channel realized that the freezing happens when they using it. Alchemist does all the request to the server async and working with callback (filter) functions, so when quickhelp try to call the Alchemist help function to request the server and don't know about the callback functionality at all it will freeze all the time until it gets respond from the filter via filter....

@mcginleyr1
Copy link

hmm it does appear it is on by default https://github.com/syl20bnr/spacemacs/blob/f49792e1206895b7440e24c8193ac5af6c5548c7/layers/auto-completion/packages.el#L27 I'll turn it off later and work on my elixir project to see if turning it off helps. Thanks @tonini and I agree thank you @gausby

@tonini
Copy link
Owner

tonini commented Mar 8, 2016

@fredriks
Copy link

fredriks commented Jun 11, 2016

Hi,

I'm also encountering this issue with company-quickhelp during autocomplete. I am however able to break out of the freeze with Quit and this is the trace from debug-on-quit:

Debugger entered--Lisp error: (quit)
  sit-for(0.01)
  (while (not alchemist-company-doc-lookup-done) (sit-for 0.01))
  alchemist-company--wait-for-doc-buffer()
  alchemist-company-show-documentation(#("Enum.fetch" 0 10 (meta "/2")))
  alchemist-company(doc-buffer #("Enum.fetch" 0 10 (meta "/2")))
  apply(alchemist-company doc-buffer #("Enum.fetch" 0 10 (meta "/2")))
  company--multi-backend-adapter((alchemist-company :with company-yasnippet) doc-buffer #("Enum.fetch" 0 10 (meta "/2")))
  apply(company--multi-backend-adapter (alchemist-company :with company-yasnippet) (doc-buffer #("Enum.fetch" 0 10 (meta "/2"))))
  #[0 "\302 !\203�\303  \300\"\207\303\304  \300#\207" [(doc-buffer #("Enum.fetch" 0 10 (meta "/2"))) company-backend functionp apply company--multi-backend-adapter] 4 "\n\n(fn)"]()
  funcall(#[0 "\302 !\203�\303  \300\"\207\303\304  \300#\207" [(doc-buffer #("Enum.fetch" 0 10 (meta "/2"))) company-backend functionp apply company--multi-backend-adapter] 4 "\n\n(fn)"])
  company-call-backend-raw(doc-buffer #("Enum.fetch" 0 10 (meta "/2")))
  apply(company-call-backend-raw (doc-buffer #("Enum.fetch" 0 10 (meta "/2"))))
  company--force-sync(company-call-backend-raw (doc-buffer #("Enum.fetch" 0 10 (meta "/2"))) (alchemist-company :with company-yasnippet))
  company-call-backend(doc-buffer #("Enum.fetch" 0 10 (meta "/2")))
  company-quickhelp--doc(#("Enum.fetch" 0 10 (meta "/2")))
  company-quickhelp--show()
  apply(company-quickhelp--show nil)
  byte-code("r\301�\302H�\303H\"\210)\301\207" [timer apply 5 6] 4)
  timer-event-handler([t 0 0 500000 nil company-quickhelp--show nil idle 0]

GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.3) of 2016-05-05 on arojas
spacemacs 0.105.21
alchemist 1.8.0
elixir-mode 2.3.1

@hunterboerner
Copy link
Contributor

Any idea on how this can be fixed?

@fredriks
Copy link

I added a workaround in my spacemacs config where I override alchemist-company--wait-for-doc-buffer and just abort if the lookup takes to long.

(defun dotspacemacs/user-config ()
  (eval-after-load "alchemist"
    '(defun alchemist-company--wait-for-doc-buffer ()
      (setf num 50)
      (while (and (not alchemist-company-doc-lookup-done)
                  (> (decf num) 1))
        (sit-for 0.01)))))

Rather ugly hack but it allows me to keep using company-quickhelp with alchemist.

@mcade
Copy link

mcade commented Jul 15, 2016

I'm having the same issue using purcell's emacs setup. to workaround for now disabling company-quickhelp-mode stops it from freezing.

@Trevoke
Copy link
Contributor

Trevoke commented Sep 20, 2016

Yep. I have the same issue. quickhelp works fine for other buffers, but something in the way alchemist works with company creates a problem.

@tonini
Copy link
Owner

tonini commented Sep 21, 2016

Is fixed through 6cd09d0

Thanks for the patience

@tonini tonini closed this as completed Sep 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants