Jump to content
mrchow19910319

Why is Alfred 3 using so much CPU? [Alfred 3.4.1 b848 pre-release prevents affected Python workflow from running]

Recommended Posts

I was watching some stream and just doing some web browsing. 

Then all of a sudden my macbook pro's fan started kicking up. 

Here is a screenshot. Why is alfred using up so much resources? 

My alfred version is v3.3.1 [806]. OS X version the latest.

 alfred.png.b8602f383e0d1247ffe2faf5cff429d1.png

Share this post


Link to post
Share on other sites

@mrchow19910319 It's hard to say what could be causing this as Alfred is essentially idle when you aren't using him.

 

One explanation could be a workflow, or perhaps macOS reindexing. Could you open Activity Monitor and see if you get anything more granular in the CPU tab.

 

Also, in Activity Monitor, select the Alfred process and sample the process (from the cog in the toolbar). This will tell me where this is likely happening :)

 

Cheers,

Andrew

Share this post


Link to post
Share on other sites
12 minutes ago, Andrew said:

snip

 

This all happened a few minutes ago. Now alfred is fine. And I opened activity monitor it says it has a 0,1% CPU usage. 

Do you still need a sample process file? 

 

Also just to put in more context just now I downloaded a tool called: streamlink. https://github.com/streamlink/streamlink People use it for watching stream on their own media player (VLC and such) and when compares to using browser (watching twitch.tv for example) a lot of people said it uses a lot less cpu power. And I installed this tool. Before that even installed python on my mac. Then when using it watching stream, python is running in the background and at this point of time , alfred's cpu usage started rocket jumping. 

 

I hope I clearly explained everything. Just to tell you the whole story. Does this have anything to do with the python script that was running at the background??

Share this post


Link to post
Share on other sites
Posted (edited)
On 29/03/2017 at 6:29 PM, mrchow19910319 said:

I hope I clearly explained everything.

 

TBH, that's probably not relevant. It most likely isn't Alfred. It's a workflow that Alfred is running. (iStat Menus (and Activity Monitor) include subprocesses in CPU load etc.)

 

If you open Activity Monitor and from the View menu choose All Processes, Hierarchically, you'll be able to see whether it's actually Alfred or a workflow subprocess:

 

1IwbtpY.png

 

FWIW, I've seen quite a few issues with workflows that use Alfred-Workflow's background process API (i.e. Python workflows) causing hanging processes with 100% CPU load. It's likely one of those.

 

I've no idea what the solution is, however. It appears to be a Sierra issue, and my Mac doesn't support Sierra.

Edited by deanishe
Imgur > IPB

Share this post


Link to post
Share on other sites
Posted (edited)

Change line 722 of search.py and remove the update_settings=UPDATE_SETTINGS parameter. That will disable the update checks.

 

It's not an issue with Searchio!, however, it's a problem with Alfred-Workflow's background processes and Sierra. So it affects probably dozens of workflows.

 

I have no idea what's causing it, as my Mac doesn't support Sierra.

Edited by deanishe

Share this post


Link to post
Share on other sites
3 hours ago, deanishe said:

I have no idea what's causing it, as my Mac doesn't support Sierra.

 

So right now what we need is another competent Python developer that can install Sierra to take a look at Alfred-Workflow and submit a PR?

Share this post


Link to post
Share on other sites

… and replicate the issue. It appears to be fairly common (I've had it reported on several workflows), but not ubiquitous…

 

Right now, my only idea is adding an exec to the double fork when starting background processes.

 

Share this post


Link to post
Share on other sites

I have noticed a similar behavior since upgrading to 10.12.4.  I have noticed that the Alfred process is showing High CPU regularly now with 10.12.4.  When I look further I notice there is an issue where I constantly have to force quit the Python process on my Mac since the CPU is at 98% on the Python process.  When I inspect the process it is always related to a simple Alfred Workflow that has called the Python process.  I will continue to monitor it but it has happened 4 times in the last couple days and always the same situation.  

 

Share this post


Link to post
Share on other sites

This is starting to be a real problem and making Alfred almost unusable.  It just happened again and all I did was run a workflow that runs and amazon search.  

Screen Shot 2017-04-02 at 10.18.44 PM.png

Share this post


Link to post
Share on other sites

Here is a inspect of the Python process.

 

cwd
/Users/mdivince/Dropbox/Sync/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.7BC80B5F-83F8-4CB2-9672-B27FB49564E5
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/Python
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_locale.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/time.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/select.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/fcntl.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_struct.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/binascii.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/cStringIO.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/strop.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/datetime.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/unicodedata.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_collections.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/operator.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/itertools.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_heapq.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/grp.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_json.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/cPickle.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_socket.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_functools.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ssl.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_elementtree.so
txt
/usr/lib/libexpat.1.dylib
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/pyexpat.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/math.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_hashlib.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_random.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_scproxy.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/array.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_bisect.so
txt
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/zlib.so
txt
/usr/lib/dyld
txt
/private/var/db/dyld/dyld_shared_cache_x86_64h
0
/dev/null
1
/dev/null
2
/dev/null
3
/Users/mdivince/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-searchio/net.deanishe.alfred-searchio.log
4
/Users/mdivince/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-searchio/net.deanishe.alfred-searchio.log
7
/dev/urandom

 

 

Share this post


Link to post
Share on other sites
Posted (edited)

I ran the following fix but still experiencing the same issue:

 

#!/bin/bash
cd "/Users/xxxx/Dropbox/Sync/Alfred 3/Alfred.alfredpreferences/workflows"

IFS=$'\n'

for d in *; do
  workflow_name="$(/usr/libexec/PlistBuddy -c 'print name' "${d}/info.plist")"
  mv "${d}" "${workflow_name}.$RANDOM"
done

Edited by mikedvzo

Share this post


Link to post
Share on other sites

Here's a thread for the issue and fixer-upper workflow. Please continue the discussion in there. (It doesn't really belong in the Alfred Bugs forum, as it's not an issue with Alfred).

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×