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

Python taking 100% of my processor #23

Closed
arturbenchimol opened this issue Apr 11, 2017 · 14 comments
Closed

Python taking 100% of my processor #23

arturbenchimol opened this issue Apr 11, 2017 · 14 comments

Comments

@arturbenchimol
Copy link

Hi there, I've been using this workflow and I absolutely love it. I realized it was taking almost 100% of my processor capacity and I had to turn it off to bring it back to normal. The process that was taking all the CPU power was Python.

It also elevated Alfred's energy impact to 151.95

I am not really a programer so I wouldn't be able to point out exactly what was happening. Is there any fix I should do?

thanks!

@justinjm
Copy link

Hi,

First and foremost, I am huge fan of this workflow and use it daily! However, I am experiencing the same issue as @arturbenchimol and I've turned it off also :-(

I'm also not an expert programmer but there is a process called "Python" that is consuming ~98% of my CPU. Here are the "Open files and ports" (found via Activity Monitor -> Inspect):

cwd
/Users/justin/Library/Mobile Documents/com~apple~CloudDocs/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.D41D8E7C-29C4-4B87-A53B-11A0C028D529
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
/usr/lib/dyld
txt
/private/var/db/dyld/dyld_shared_cache_x86_64h
0
/dev/null
1
/dev/null
2
/dev/null
3
/Users/justin/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.drive.azai91/com.drive.azai91.log
4
/Users/justin/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.drive.azai91/com.drive.azai91.log

Finally, my system specs are below:

  • Alfred-Drive-Workflow 1.2
  • Alfred 3.3.2 [818]
  • macOS Sierra 10.12.4

Please let me know what else I can do to help debug from here.

Justin

@justinjm
Copy link

@arturbenchimol FYI - give this a try:

https://www.alfredforum.com/topic/10193-python-fix-how-to-fix-python-workflows-hanging-alfred-on-sierra/

https://github.com/deanishe/alfred-fixum

@arturbenchimol
Copy link
Author

thanks, @justinjm I'll give it a try and report back here. Thanks!

@ymar
Copy link

ymar commented Jun 22, 2017

I have the same issue. Alfred Fixum didn't solve the issue unfortunately. Only resolution would be if the workflow get's updated. @azai91 any plans for solving this bug?

@cyaconi
Copy link

cyaconi commented Jun 22, 2017

I'm facing the same problem. Hope this could be fixed soon.
Thanks!

@arturbenchimol
Copy link
Author

arturbenchimol commented Jun 22, 2017 via email

@jgarber
Copy link

jgarber commented Jun 24, 2017

Fixed in #22. Download the latest workflow to solve the problem. You'll have to manually install it from source since @azai91 hasn't released lately.

@LewisLebentz
Copy link

@jgarber is just swapping the file for the new version enough?

@cobbman
Copy link

cobbman commented Jul 12, 2017

Sorry I have to ask, but do I run "make" after cloning this to get the workflow updated? I tried it but getting some errors. I just want to get this updated because I'm having the same issue as mentioned above. Thanks!

edit: screenshot http://d3fy.xyz/GCS9r5

@cobbman
Copy link

cobbman commented Jul 19, 2017

Sorry for the noob question here, but I can't find anything online to help me with this...

How do I get this repo "packaged" into an alfred workflow so I can install it? I'm trying to get the latest version. Thanks

@cobbman
Copy link

cobbman commented Aug 3, 2017

@azai91 - please create a release with the most recent version. Thank you.

@sorbits
Copy link
Collaborator

sorbits commented Aug 10, 2017

It is the src directory which is the actual workflow, so if you clone this repository, remove the old workflow (from Alfred’s workflows folder) and create a symbolic link to this repository’s src folder.

Though currently it is still using a version of the alfred-workflow module which is incompatible with Alfred 3.4 but I have submitted a PR for updating it.

I added the new version as a git submodule so use git clone --recursive «repository» when you clone it.

@cobbman
Copy link

cobbman commented Aug 10, 2017

Thank you @sorbits - I appreciate it!

sorbits added a commit to sorbits/alfred-drive-workflow that referenced this issue Aug 24, 2017
I realize that it is not popular to change the implementation to another language, but I felt a major refactoring was called for to continue adding desired features, and as I work a lot faster in ruby, I decided to do it in ruby.

Some of the improvements that this rewrite brings:

- When we have cached data, we immediately return a response to Alfred based on the cache. If the cace is older than 10 minutes, we refresh the cache _in a background process_ and instruct Alfred to reload the list again after 0.8 seconds.
- Removed `d > Clear Cache` and `d > Set Cache [seconds]` because of the improved caching behavior.
- The create actions accept an optional document name and are no longer under `d >`, for example `d ns Budget` should now create a spreadsheet named “Budget”. Closes azai91#11.
- Removed `d > Login` as we automatically open the Google Sign In page when refresh token is missing/invalid.
- Changed `d > Logout` to `d Sign out of Google Drive` and made it perform an account sign out (instead of just deleting the access tokens).
- Refresh access token when expiration time is less than 10 seconds into the future. This avoids an extra (failing) server request/response, which is mainly for the document creation actions, as Google’s servers are on the slow side.
- The OAuth2 HTTP callback server is running in our main process, this means that we can perform actions that require authentication _after_ we receive the callback from Google, for example `d new document` without a valid token will now first ask the user to sign in and _then_ create the new document. It also improves robustness slightly because error handling is in the same process.
- Cache is refreshed (in the background) after creating a new document.
- Add verbose (timestamped) logging which should make troubleshooting easier.
- The OAuth2 HTTP callback server will run until we see the expected `GET /` request (so not fooled by a `favicon.ico` request or similar) and it uses a URL parser to obtain the `code` query parameter from the callback URL.

The above should fix azai91#5, azai91#16, azai91#23, and azai91#25.

You can also close azai91#28 (but I already did that in 6006836).
@sorbits sorbits mentioned this issue Aug 24, 2017
sorbits added a commit that referenced this issue Aug 28, 2017
I realize that it is not popular to change the implementation to another language, but I felt a major refactoring was called for to continue adding desired features, and as I work a lot faster in ruby, I decided to do it in ruby.

Some of the improvements that this rewrite brings:

- When we have cached data, we immediately return a response to Alfred based on the cache. If the cace is older than 10 minutes, we refresh the cache _in a background process_ and instruct Alfred to reload the list again after 0.8 seconds.
- Removed `d > Clear Cache` and `d > Set Cache [seconds]` because of the improved caching behavior.
- The create actions accept an optional document name and are no longer under `d >`, for example `d ns Budget` should now create a spreadsheet named “Budget”. Closes #11.
- Removed `d > Login` as we automatically open the Google Sign In page when refresh token is missing/invalid.
- Changed `d > Logout` to `d Sign out of Google Drive` and made it perform an account sign out (instead of just deleting the access tokens).
- Refresh access token when expiration time is less than 10 seconds into the future. This avoids an extra (failing) server request/response, which is mainly for the document creation actions, as Google’s servers are on the slow side.
- The OAuth2 HTTP callback server is running in our main process, this means that we can perform actions that require authentication _after_ we receive the callback from Google, for example `d new document` without a valid token will now first ask the user to sign in and _then_ create the new document. It also improves robustness slightly because error handling is in the same process.
- Cache is refreshed (in the background) after creating a new document.
- Add verbose (timestamped) logging which should make troubleshooting easier.
- The OAuth2 HTTP callback server will run until we see the expected `GET /` request (so not fooled by a `favicon.ico` request or similar) and it uses a URL parser to obtain the `code` query parameter from the callback URL.

The above should fix #5, #16, #23, and #25.

You can also close #28 (but I already did that in 6006836).
@sorbits
Copy link
Collaborator

sorbits commented Aug 28, 2017

There is now a version 2.0 which is a complete rewrite and no longer relies on the python library that caused this issue.

@sorbits sorbits closed this as completed Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants