Sublime Forum

How to find the source of plugin_host maxing out CPU?


Running Sublime Text 3114 on Mac.

After upgrading I see Sublime and another process called “plugin_host” both maxing out my CPU. Is there a way to find out which plugin is causing this without individually enabling / disabling them?


Sublime hangs on linux 3126

You can try the Plugin Development: Profile Events command palette command, although that only measures time spent in event handlers.

Otherwise, you can use a binary search to more quickly detect the package causing the issue. In short, disable half of the packages and see if that half makes a difference. Repeat disabling half of the previous half that fixed the problem, until you are disabling a single package.

1 Like


Tried that and still got 100% CPU on both the “Sublime Text” and “plugin_host” tasks no matter what I did.

Just tried installing a new fresh copy by removing my Sublime Text 3 folder in Application Support and I’m still getting the 100% CPU usage. Any idea what could be going on? Could there be plugins somewhere else I’m unaware of?



Do you have a really large project? When first opening a new folder, ST3 will index all of the source code files to build a list of all classes, methods, functions, types, etc. However, the indexer processes are separate from the main GUI process and will go away once indexing is complete. By default it will create one indexer per CPU core, but you can reduce this via the index_workers setting.



wbond - thanks for taking the time to answer my questions.

But unfortunately, I’m talking about a brand-new, completely untouched copy of Sublime. Default settings. I haven’t even opened a file. The main window is sitting there, empty. No settings have been touched. Sublime Text is at 99.6% and plugin_host 99.7%.



I have no idea how that could be happening, sorry!



Sublime Text and the plugin_host use shared memory to communicate, and part of that is using semaphores to gracefully wait for new events without sitting in a busy loop. If the semaphore creation fails (i.e., sem_open returning SEM_FAILED), then 100% CPU usage by both processes would be a symptom.

There is a system limit to the number of semaphores in OSX, and they’re not cleaned up automatically when a process exits. Perhaps you have a program that has leaked semaphores and consumed all available ones on the system, in which case rebooting may fix the issue for you.


ST3 plugin_host 100% CPU Usage
plugin_host taking 100% CPU on OSX 10.11.1
macOS Sierra 3216 100% CPU
Stable 3126 insane CPU usage

@jps - Thanks for the explanation! A reboot did indeed fix it. I feel silly for not trying that earlier.

Is there a way to see how many semaphores are currently being consumed on OS X?



There are, and you should also be able to list them along with their names, which may give a clue as to who created them. I don’t know the commands off the top of my head though.



FYI, I’m having this issue too.

You can use the command “ipcs -s” to display a list of semaphores. Also, “lsof | grep PSXSEM” can be used to determine semaphores per process.

If i figure out what is leaking semaphores i will let you know.



Has anyone tried to address the Elephant in the room? I.e. Microsoft Office 365 leaking semaphores like a spaghetti strainer? I know Microsoft loves making people reboot their computers but this is ridiculous.



I have noticed that when this happens both DropBox and SublimeText 3 use a ton of CPU, and the issue doesn’t seem to go away until after a reboot.



So, I’m having this problem now, and even rebooting hasn’t helped at all. It’s also not an indexer issue, as it happens even if I open Sublime Text pointing just to a single file in an otherwise empty directory. Any idea how to track things down? I suspect one of the packages I have installed via PackageControl got a bad update but I have no idea how to even see which plugins I have installed or disable them.



Go to Preferences > Package Settings > Package Control > Settings – User to see the list of installed packages. Copy 1/2 at a time to the user side of Preferences > Settings in the ignored_packages setting and restart Sublime Text. If the problem has gone away, try removing 1/2 of the packages from ignored_packages at a time. Through this iterative process, it shouldn’t be too hard to identify the package, unless you have a very large number installed.

1 Like

Dev Build 3179 on MacOS Mojave

If you’re still there, the problem could be a program that’s loading on each reboot mass creating semaphores (see above comments). You can use Waldo1979’s suggestion to see active OS semaphoes:

You can use the command “ipcs -s” to display a list of semaphores. Also, “lsof | grep PSXSEM” can be used to determine semaphores per process.



The issue cleared up about three and a half years ago, but thanks :slight_smile: