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

Spacemacs gets stuck for a few seconds and hogs CPU(100% usage) from time to time #1369

Closed
x-ji opened this issue Apr 25, 2015 · 25 comments
Closed

Comments

@x-ji
Copy link
Contributor

x-ji commented Apr 25, 2015

Now #1300 is solved, Emacs no longer eats up memory and totally freezes. (Update: #1300 now happened again as well...) However, I still encounter random situations where Emacs just ramps up its CPU usage all the way to 100% from time to time, and gets stuck for at least 5 seconds. It happens almost every 30 seconds now.

The first screenshot is when CPU usage peaks. Subsequently it drops rapidly to only about 1% and Emacs responds normally again.

screenshot 2015-04-25 17 11 58
screenshot 2015-04-25 17 12 04
screenshot 2015-04-25 17 12 09

When this happens I'm not doing anything except for navigating a file using Vim bindings. It's weird because I've erased all the variables set via Custom but it doesn't help.

Also, pressing SPC and mouse-clicking on Emacs could both also induce the issue.

I think other users mentioned similar situations in both #1300 (comment) and #868 (comment)

@x-ji
Copy link
Contributor Author

x-ji commented Apr 25, 2015

Deleted both .emacs.d and .spacemacs and did a fresh reinstall again... This time didn't add any private layer and things seem to be working. Let me just suppose for now it's induced by some package not playing well with Spacemacs.

@x-ji x-ji closed this as completed Apr 25, 2015
@danielwuz
Copy link
Contributor

FYI, I recently ran into an issue of noticeable stuck when doing copy and paste. I eventually was able to find out it's related to pbcopy in osx layer, not sure why that happened, still need to look further into this problem.

@x-ji
Copy link
Contributor Author

x-ji commented Apr 26, 2015

Now it happened again... without any private layer. And Emacs just stuck at 100% CPU forever. Also the incessant memory increase is back.

screenshot 2015-04-26 21 52 43

I'm not sure whether it could be related to #1263 ...

At such a state of affairs I'm afraid I won't be able to use Spacemacs until I figure out what's happening at all...

@x-ji x-ji reopened this Apr 26, 2015
@tuhdo
Copy link
Contributor

tuhdo commented Apr 26, 2015

If no layer is included, probably it's the problem of your Emacs build. Maybe instead of emacs-mac-port, you should give Emacs for Mac OS X latest build (24.5) a try, since the new version fixed crashing bug in 24.4. If that doesn't work and you still have patient, probably try the development version Emacs 25.

@x-ji
Copy link
Contributor Author

x-ji commented Apr 26, 2015

@tuhdo Will give it a try. The only issue with Emacs for Mac OS X compared with emacs-mac-port is the powerline color issue, right?

@balajisivaraman
Copy link
Contributor

I'm having this problem as well, on OSX 10.9.5. I've tried with Emacs 24.5.1 Universal, the 26th April and the 20th April nightlies from EmacsForOSX.

In the case of the Nightlies, Emacs doesn't open itself. In the case of 24.5.1, Emacs opens, but when I try to do C-x C-f, it hangs and hogs the CPU at 99-100%. :-(

@x-ji
Copy link
Contributor Author

x-ji commented Apr 27, 2015

Yeah, Emacs for OSX has the same problem too... And sometimes just as described in #1300, it not only hogs CPU, but seems to increasingly require more and more memory until it has eaten up all disk space(presumably making virtual memory?) as well. In my case it has requested nearly 30GB of memory accordingly to Activity Monitor. That's quite monstrous.

@tuhdo
Copy link
Contributor

tuhdo commented Apr 27, 2015

Since you are using old OSX 10.9.5, consider upgrading to latest OS X Yosemite or downgrade Emacs to emacs-mac-port 24.4 or even 24.3. I don't think it has any problem with latest OS X since many people are using Emacs 24.5 on it.

@x-ji
Copy link
Contributor Author

x-ji commented Apr 27, 2015

Unfortunately for me I'm using the newest version of Yosemite... :(

@tuhdo
Copy link
Contributor

tuhdo commented Apr 27, 2015

So, try reproducing it with just stock Emacs: emacs -q and run something if something strange happens. If so, probably it's an Emacs bug. However, I think many OS X users have their Emacs working fine so I'm not sure it's an Emacs problem. Not sure if you install some external apps that conflict with Emacs?

@x-ji
Copy link
Contributor Author

x-ji commented Apr 28, 2015

Now I'm trying to build emacs directly from homebrew instead of emacs-mac-port or Emacs for OS X, and so far so good, though needs more testing for sure. @balajisivaraman probably you can also try to build Emacs direclty on your machine?

Installation command: brew install emacs --use-git-head --with-cocoa --srgb

Edit: sorry, no --HEAD option which would install Emacs 25 which seems to break mode-line. Emacs 24.5 suffices.

@x-ji
Copy link
Contributor Author

x-ji commented Apr 28, 2015

Ah no. The problem resurfaced. But it's actually killable via C-g, so I suppose it's an infinite loop issue. The homebrew build of emacs seems to be less laggy in general so I'm going to stick with it.

@x-ji
Copy link
Contributor Author

x-ji commented May 3, 2015

I got stuck again today on Emacs startup process as it started to infinitely hog CPU and memory again. I inspected my .emacs.d folder and found savehist file is 1.16 GB under .cache folder. Is that normal? After removing that file Emacs could be started normally.

@tuhdo
Copy link
Contributor

tuhdo commented May 3, 2015

That's not normal at all. Probably you should temporary disable savehist-mode for now. If you disable it, Emacs won't be able to jump to previous location in a visited file.

@x-ji
Copy link
Contributor Author

x-ji commented May 4, 2015

Running grep -E -b -o '^\(setq [^ ]+' ~/.emacs.d/.cache/savehist following the advice from http://emacs.stackexchange.com/questions/12086/abnormally-large-savehist-file/12116 reveals the following:

116:(setq savehist-minibuffer-history-variables
350:(setq regexp-search-ring
566:(setq magit-read-rev-history
637:(setq read-expression-history
694:(setq command-history
19045:(setq helm-grep-history
20687:(setq minibuffer-history
75425:(setq file-name-history
83278:(setq ido-file-history
83377:(setq evil-ex-history
111288:(setq kill-ring
1162765006:(setq mark-ring
1162765028:(setq search-ring
1162765052:(setq regexp-search-ring
1162765268:(setq extended-command-history

Could it be anything to do with evil? I guess I'll exclude those problematic variables from savehist for now.

@tuhdo
Copy link
Contributor

tuhdo commented May 4, 2015

You kill-ring is really large. Probably you copy/paste very large amount of text? We should limit the kill-ring content stored in the file though.

@mattly
Copy link
Contributor

mattly commented May 16, 2015

I ran into a similar problem last night, which persisted across resetting my .spacemacs file to default and nuking my elpa directory. It only went away after clearing my ~/.emacs.d/.cache directory.

@x-ji
Copy link
Contributor Author

x-ji commented May 16, 2015

In my case I can currently confirm that an abnormally large savehist file caused the issue each time and disabling savehist-mode solved it. Though I currently have no idea as to why this happened...

@syl20bnr
Copy link
Owner

The savehist configuration added by spacemacs is here:
https://github.com/syl20bnr/spacemacs/blob/develop/spacemacs/config.el#L236-L244

We can see that the problematic variables @x-ji encountered are added explicitly by spacemacs.
I'm OK to remove them from spacemacs default.

@tuhdo
Copy link
Contributor

tuhdo commented May 21, 2015

We should only disable saving those variables (or just kill-ring) for OS X, not other OSes.

@syl20bnr
Copy link
Owner

The issue with these variables are only on OS X ? emacs-mac formulae only ?

@tuhdo
Copy link
Contributor

tuhdo commented May 21, 2015

I have no such abnormal large savehist in both my Linux and Windows machine. Not sure about which version of Emacs in OS X.

@x-ji
Copy link
Contributor Author

x-ji commented May 21, 2015

Well for me it happened in all kinds of emacs builds, including emacs-mac,
emacs, and the binary file from emacsformacosx.com . In this case version
doesn't seem to be related.

Not sure I'm copying anything abnormal, especially considering it happens
every time I clear the file, not just once or twice. Even if there's a
large amount of content accumulated we should be able to limit the size in
some way? Or probably just exclude kill-ring.

On Thu, May 21, 2015, 10:45 Tu Do notifications@github.com wrote:

I have no such abnormal large savehist in both my Linux and Windows
machine. Not sure about which version of Emacs in OS X.


Reply to this email directly or view it on GitHub
#1369 (comment)
.

@sbenhaim
Copy link

sbenhaim commented Jun 4, 2015

My guess is images/documents in clipboard interacting with save-interprogram-paste-before-kill means large bits of binary data in the kill-ring.

@syl20bnr
Copy link
Owner

syl20bnr commented Jun 5, 2015

@tuhdo removed the kill-ring from savehist which should fix the issue.

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

7 participants