Closed asmeurer closed 11 years ago
I have no idea, sorry. A few ideas to investigate what is wrong:
make test
. You need carton for that. Install it, or specify the path like this: make CARTON=PATH/TO/carton/bin/carton test
Try with minimal .emacs. You can save the lines you specified in your .emacs to a different file, and then start Emacs by emacs -Q -l PATH/TO/THE/FILE.el
.
Alternatively, you can do make tryout
.
nosetests epc
, though I don't know this is relevant.Is there some other dependency for the tests? I get
Warning: Lisp directory `/Users/aaronmeurer/Documents/emacs-jedi/elpa/install.log': Not a directory
Cannot open load file: mocker
make[1]: *** [test-1] Error 255
make: *** [test] Error 2
If you have carton then it should run without problem. It runs on Travis always like that, though I've never run it on Mac OS.
What is in elpa/
? Can you do something like tree elpa
or find elpa
? Also please paste what is in elpa/install.log.
make tryout
didn't work, but I was still able to reproduce with this minimal startup file. The computer panics when I try to exit emacs.
Noting in elpa
except for elpa/archives/gnu/archive-contents
(this is ~/.emacs.d/elpa
).
Are these libraries loaded from test_emacs.el
are compiled? Did you try removing all *.elc
files?
I mean elpa under emacs-jedi directory.
Oh, duh, you're talking about the elpa referenced by the log. That was because I didn't put the full path to carton the first time.
Removed elc files. Still panics. According to the panic log, it is python, not emacs, that is causing the panic.
So how about testing python-epc?
$nosetests2.7 epc
.....................S....SERROR:epc:EPCClosed()
..................................
----------------------------------------------------------------------
Ran 61 tests in 25.880s
OK (SKIP=2)
The error message showed up is actually OK... So probably run Jedi test? It is not distributed with the module, so you need to get it from github https://github.com/davidhalter/jedi.
Ah, I forgot that we can run Jedi server in debugging mode. Try jedi:toggle-debug-server command: http://tkf.github.com/emacs-jedi/#jedi:toggle-debug-server
You can omit --pdb for just seeing the traceback (if Python could print out something useful).
Jedi tests pass just fine. I'm going to wait to test the server until my computer is not doing anything, so that a panic is not too interrupting.
It doesn't seem to panic in debug mode.
By the way, it also never seems to actually work, though I'm not positive. Is there a minimal way to test that it's using Jedi and not just auto-complete?
Assumedly debug mode doesn't do it because it happens when I exit emacs, and this doesn't stop the server in debug mode.
Try M-x jedi:show-jedi-version
. You don't even need to start python-mode.
Also, checkout options of the server. You can increase logging level.
I have no doubt that Jedi is running, but how do I check that it is actually working?
By the way, just running show version panics on exit.
If jedi:show-jedi-version
pops up a buffer with version info, that means server is working. This command calls a remote command on the server.
panics on exit
Is it always on exit? What happen if you kill all servers before exit? You can do that by M-x epc:controller
then hit K
for each rows.
Yes, the servers are running, but I believe that the actual completion isn't. It's hard to tell, though, because auto-complete does work.
I'll try the increased logging and killing the servers next time my computer isn't doing something.
Same problem here.
I use emacs-24.3 installed from macports and all the rope/ropemacs/ropemode/pymacs/autocomplete stuff.
As soon as I start emacs and start editing a python file, after having performed some pymacs related thing e.g. completion, when I save/exit (C-x S C) OS reboots unexpectedly and on restart I see:
panic(cpu 6 caller 0xffffff800191edba): "negative open count (c, 16, 6)"@/SourceCache/xnu/xnu-2050.22.13/bsd/miscfs/specfs/spec_vnops.c:1813 Backtrace (CPU 6), Frame : Return Address
I've been running emacs macport version on a company laptop (with Lion 10.7.x) and I never faced this issue.
The version details:
Running on Mountain Lion 10.8.3, using macports 2.1.3 and the following macports software versions:
python 2.7.3 emacs 24.3
Here are the relevant package versions installed with pip:
Pymacs==0.25 rope==0.9.4 ropemacs==0.7 ropemode==0.2
Here are the extra things installed under site-lisp:
$ ls -l /opt/local/share/emacs/site-lisp/ | awk '{print $9}'
doctest-mode.el doctest-mode.elc gnuplot-eldoc.el gnuplot-eldoc.elc idna.el magit-bisect.el magit-bisect.elc magit-blame.el magit-blame.elc magit-key-mode.el magit-key-mode.elc magit-stgit.el magit-stgit.elc magit-svn.el magit-svn.elc magit-topgit.el magit-topgit.elc magit-wip.el magit-wip.elc magit.el magit.elc punycode.el pycomplete.el python-mode.el python-mode.elc rebase-mode.el rebase-mode.elc subdirs.el
And the .emacs file:
(add-to-list 'load-path "~/.emacs.d/auto-complete") (add-to-list 'load-path "/opt/local/share/emacs/site-lisp") (autoload 'python-mode "python-mode" "Python Mode." t) (add-to-list 'auto-mode-alist '(".py\'" . python-mode)) (add-to-list 'interpreter-mode-alist '("python" . python-mode)) (require 'python-mode)
(autoload 'pymacs-apply "pymacs") (autoload 'pymacs-call "pymacs") (autoload 'pymacs-eval "pymacs" nil t) (autoload 'pymacs-exec "pymacs" nil t) (autoload 'pymacs-load "pymacs" nil t) (autoload 'pymacs-autoload "pymacs")
(pymacs-load "ropemacs" "rope-") (setq ropemacs-enable-autoimport t)
(require 'auto-complete) (global-auto-complete-mode t)
@dliappis You don't use jedi.el, right? This makes me think that it may be nothing to do with my problem but Emacs launching subproces in Mac OS X.
Does the same thing happen if you do something like M-! ls RET
? Or probably this is needed to be a long lasting process, like M-! sleep 5m & RET
?
@tkf Nope I don't use jedi.el.
I am certain this is totally irrelevant to emacs because I tried using aquamacs instead and after a couple of minutes of fighting around with some source code, I got the same crash.
The commands you mentioned above do not reproduce the problem.
However the problem is always reproducible if pymacs is loaded and I try autocomplete on a class and then try to save/exit emacs.
This problem seems to be somehow related to python (in particular the macports version of python27)
Which version of python are you using?
I am not using Mac OS so I guess @asmeurer's python version is more interesting.
If it is Python, how about M-! python -c "print 'hello'" RET
. You can put sleep or some intense computation in there to check it it crashes your machine. Probably you need to read and write to/from pipe or socket.
Here's some more investigation:
Since I was suspecting python to be a problem, I tried the default python version (2.7.2) installed with OSX Mountain Lion.
I used emacs 24.3 (from macports) and also Aquamacs (based on emacs 23) and in both cases I got the same reboot/crash problem!
The test case is always the same: Edit a python file, try auto-complete for a couple of classes, save the file, exit emacs -> crash happens when exiting emacs.
I even ditched macports and tried homebrew (an alternative package management system for OSX). I installed python 2.7.3 and emacs 24.3 using brew, installed pymacs, python-mode and the rest of the dependencies, leading to the same problem.
I am totally baffled; is there an issue with Mountain Lion, when emacs is launching python processes?
I tried your simple:
M-! python -c "print 'hello'" RET
test which was successful. As you suggested I will try a more intense python computation in the background.
I think this is perhaps the time to raise a bug with Apple?
I am using fink python 2.7.
And yes, this is obviously an apple bug. A kernel panic is by definition a bug in e kernel (unless kernel extensions are involved or there is a hardware issue, which are clearly not the case here). The xnu/.../spec_vnops.c is part of the Mac OS X kernel (xnu is the OS X kernel). Unfortunately, they only release source code for 10.7, and it doesn't even have 1813 lines.
I was just hoping to find a workaround here.
Actually @dliappis what kind of computer do you have? Mine is a 15" retina MacBook Pro.
@asmeurer I am using a MacBook Air Mid 2012.
I am also desperately trying to find a workaround as well, as I can't imagine having to use another editor (used to emacs for too long.)
I have opened a bug in Apple's bug tracking system (13496168); hoping for a quick resolution -- perhaps if you open a case as well they could speed up resolution/increase priority?
As mentioned above any combination I've tried with emacs and python has resulted to the same reboot!
Yes, I will open a bug as well. I remember hearing that Apple considers multiple reports as "votes", so each person who sees this should report the bug. We should also probably open an issue on open radar. And obviously, when it happens, click the report button for the crash report.
Yes, I agree on all points. I am hoping this will be dealt swiftly as a kernel panic is a major issue. This sure is Mountain Lion specific, as my work laptop (Macbook pro 13" with Lion) with similar python+emacs setup has been super stable for a long time.
Probably you can workaround the bug by using different Python version like 3.2 until Apple fix the bug?
How do you switch which Python executable is used?
Also, do Jedi and all the other dependencies work in Python 3? Will it expect the Python sources it analyzes to be Python 3?
Python modules work with 3.2. Jedi running with Python 3 can parse Python 2 code. You need to install modules for Python 3 if you want to complete functions in them, though.
To use Python 3, do make PYTHON=python3 clean requirements
OK, some more testing:
Even if I force quit iterm 2 (command-option-esc), it panics.
It seems that bug is a known one, but so far I don't see any updates on Mountain Lion ... I am really hoping Apple will sort this one out, as it's literally made emacs unusable for python.
This is happening to me too. I hope they sort it out, because my whole workflow is based on Python in emacs. Works fine in Linux but I have to use a Mac for my new job. Has anyone raised a bug with Apple?
@sbrother are you getting it from Jedi or pymacs (or something else)?
As noted above, an issue has been opened, but apple counts multiple reports as "votes" so you should submit it again (and also send them your crash reports when your computer reboots).
I have ropemacs, autocorrect, rope-mode, and pymacs running, so I assume it's related to pymacs? I just submitted a bug report to Apple.
It's something to do with emacs and Python in general. These are the libraries that do it for me, which are just Jedi and its (elisp only) dependencies. Does pymacs also use EPC?
I opened this as bug 13615108. I also put it on open radar.
Does pymacs also use EPC?
No. Pymacs and EPC are different ways of inter-process communication. The similarity I see is that both launch Python process from Emacs.
Come to think of it, this may be the reason why there is no panic in the debug mode. In the debug mode, Python process is launched outside of Emacs. If you remove certain flags such as --pdb
, I think launching EPC server this way is usable.
As I noted, it also doesn't panic if I manually quit it in the EPC controller.
Also as I noted, am not really sure if this is even working at all in any case (but again without a reliable test case I can't be sure). Assumedly something like
import sys
sys.TAB
should complete the functions in the sys
module, no? If so, then it isn't working.
Did you run it w/o --pdb? If you give --pdb, it may hang due to some error. If you don't give it the error is just ignored.
If quitting from EPC controller is fine, then adding a elisp function to kill all EPC processes to kill-emacs-hook should solve this problem.
@asmeurer This should be equivalent to "kill all Jedi EPC servers before kill Emacs". This probably makes emacs-jedi usable for Mac users.
(defun jedi:stop-all-servers ()
(maphash (lambda (_ mngr) (epc:stop-epc mngr))
jedi:server-pool--table))
(add-hook 'kill-emacs-hook #'jedi:stop-all-servers)
Ok, I'll test it when I get the nerves to possibly panic again. Even if this works, it will be living on the edge, because as I noted, if I ever have to kill -9 emacs or force quit the terminal or terminal tab, it will panic.
OK, I think that "works," in the sense that it doesn't panic (yay!). But as I noted before, I'm pretty sure that jedi is not working at all. My completions don't seem to be any better than what I get with just auto-complete. I'll open a new issue for it.
@asmeurer If you need to kill -9
, probably killing subprocesses before that helps... You can use Emacs's daemon mode to save it from accidentally closing tabs.
Today, I just installed
emacs-jedi
, as well as all of its dependencies (except forauto-complete
, which I already had installed). I installed everything from git. I then enabled everything using https://github.com/asmeurer/dotfiles/blob/master/.emacs#L759-785 (except with the last part uncommented.I then tried editing some Python. It worked for a little bit, but then my system kernel panicked! Here is the log
This is in Mac OS X 10.8.3. I'm using a git version of emacs compiled in January, and iTerm2. I tried it a second time, and it panicked again (same log; I can paste them both if you want).
I kind of doubt this is the fault of
emacs-jedi
, but I was wondering if you could help point me in the right direction of who to report this to get it fixed (or at least worked around)?