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

[Bug Report] macOS constant CPU use #2427

Closed
MC1R-13 opened this issue Mar 25, 2022 · 13 comments · Fixed by #2475
Closed

[Bug Report] macOS constant CPU use #2427

MC1R-13 opened this issue Mar 25, 2022 · 13 comments · Fixed by #2475
Labels
help wanted Extra attention is needed

Comments

@MC1R-13
Copy link

MC1R-13 commented Mar 25, 2022

macOS constant CPU use

Sometime after v0.13.0-5-g9e3d56b2 from March 16, stash constantly uses a lot more resources than usual.
There was nothing in the log, but when I opened the console, it generated close 500,000 of these in just over a minute:

34074	error		00:37:02.936631-0500	stash-macos-intel	nextEventMatchingMask should only be called from the Main Thread!

34074	error		00:37:02.936919-0500	stash-macos-intel	(
	0   CoreFoundation                   	0x00007fff2074b29b __exceptionPreprocess + 242
	1   libobjc.A.dylib                 	0x00007fff20484d92 objc_exception_throw + 48
	2   AppKit                        	0x00007fff22ed7116 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4389
	3   AppKit                         	0x00007fff22ec8869 -[NSApplication run] + 586
	4   stash-macos-intel                	0x0000000004de4af5 nativeLoop + 53
	5   stash-macos-intel                	0x0000000004de3e3a _cgo_638c47e0eddf_Cfunc_nativeLoop + 26
	6   stash-macos-intel                	0x0000000004069d10 runtime.asmcgocall.abi0 + 112
)

I'm hoping someone knows what this means because I do not.

Stash Version: (from Settings -> About):
Anything after: v0.13.0-5-g9e3d56b2

Desktop (please complete the following information):

  • OS: Mac OS Big Sur 11.6.5 (Intel)
  • Browser: Safari
  • Version: 15.4
@MC1R-13 MC1R-13 added the help wanted Extra attention is needed label Mar 25, 2022
@WithoutPants
Copy link
Collaborator

@bnkai
Copy link
Collaborator

bnkai commented Mar 25, 2022

Nativeloop seems to be used from the systray code getlantern/systray#34 , not sure what can be done though.

@WithoutPants
Copy link
Collaborator

We have a forked version of systray maintained by @kermieisinthehouse. Calling LockOSThread might help perhaps?

@bnkai
Copy link
Collaborator

bnkai commented Mar 25, 2022

From a quick look it seems that the run function from systray is using a nativeloop. Maybe add an init with the lock to the package and then check if the run function stays on the main thread as suggested from https://zchee.github.io/golang-wiki/LockOSThread/

@bnkai
Copy link
Collaborator

bnkai commented Mar 25, 2022

Scratch that. The library already does the init with lockosthread

@kermieisinthehouse
Copy link
Collaborator

The project refactor might've pushed the systray off the main thread. I'll investigate if that's the cause

@newadventure079
Copy link

FWIW, I'm on Monterey with an m1 chip and I dont see these issues

@MC1R-13
Copy link
Author

MC1R-13 commented Mar 25, 2022

That's not surprising, since you're using version 12, and this didn't start until after 13.

@newadventure079
Copy link

I tested it on version .13 also

@WithoutPants
Copy link
Collaborator

@MC1R-13 can you please test PR #2475 to see if it addresses the issue for you?

@MC1R-13
Copy link
Author

MC1R-13 commented Apr 5, 2022

All right, and as soon as I figure out how to build it, I will.

@WithoutPants
Copy link
Collaborator

@MC1R-13
Copy link
Author

MC1R-13 commented Apr 5, 2022

Oh, nice!
Yes, it's back to using 0.0% cpu.
Thank you.

@MC1R-13 MC1R-13 closed this as completed Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants