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

Squirrel-based Install Dialogue Burns CPU/Fans on Mac #247

Closed
ambroselittle opened this issue Apr 27, 2020 · 6 comments · Fixed by #259
Closed

Squirrel-based Install Dialogue Burns CPU/Fans on Mac #247

ambroselittle opened this issue Apr 27, 2020 · 6 comments · Fixed by #259

Comments

@ambroselittle
Copy link

Please see this bug filed with VS Code for context/details. They suggested I file this with you since they are using this framework.

Let me know if you have any questions!

@ambroselittle
Copy link
Author

Please note we found a workaround on the linked issue. Not sure if that's something that can be fixed here or not.

@stk-ableton
Copy link

This is a very annoying and long-standing problem, and it would be great to get it fixed. The workaround that @ambroselittle refers to in the comment above is not a real solution, because it involves chown-ing the application to the current user, which is not something that you want to do from a security point of view.

The problem occurs whenever the dialog "An update is ready to install." is on the screen, asking for an admin password; as long as this dialog is open, there's a very high CPU usage. I've seen this happen consistently in all apps that use Squirrel, e.g. WhatsApp, Signal, VS Code, and others. It is a problem because many times these apps start the update process in the night, so when I come to the machine in the morning, it's been running with fans on full speed for hours already.

And it's particularly problematic when you use the VS Code Insiders version, because then there's an update every day (or night).

So I tried to investigate a little where this comes from. Running Instruments seems to indicate that it comes from https://github.com/Squirrel/Squirrel.Mac/blob/master/Squirrel/SQRLZipArchiver.m#L70, which seems to be called repeatedly while the dialog is open.

I don't understand enough about Cocoa and ReactiveCocoa to say what's the best fix for this; one wild guess is that you should set standardErrorPipe.fileHandleForReading.readabilityHandler back to nil when the ditto task completes. Another wild guess is that there's something wrong with the lifetime of the SQRLZipArchiver object; it seems to be still around after unarchiveAndPrepareData returns, but maybe shouldn't, and it looks like that would also fix the issue.

@stk-ableton
Copy link

Just a friendly ping. Anybody?

Cc:ing @jspahrsummers who touched this code last.

@jspahrsummers
Copy link
Member

Very sorry, but I haven't worked on this codebase in ~6 years. I'm not knowledgeable about it anymore.

@tmoschou
Copy link

tmoschou commented May 13, 2021

Since all Electron applications that make use of Electron's Auto Updater API (e.g. (Visual Studio Code, Atom, Slack, to name a few) are affected by this transitive dependency on Squirrel.Mac, and given #247 (comment) and #256, I've raised the issue with Electron electron/electron#29119.

Electron is already carrying patches for Squirrel.Mac https://github.com/electron/electron/tree/master/patches/squirrel.mac
so its probably best to handle from their end.

@codesimplicity
Copy link

After I finally invested the time to investigate why that is still occurring regularly even on newer Macs, I stumbled upon this issue. I'm a bit confused that it does not have more attention as it at least annoys me regularly and must be burning a lot of energy for nothing.

MarshallOfSound added a commit that referenced this issue Jun 18, 2021
For some reason even though the `NSTask` is terminated the file handle is still being read.  Fixes #247

Verified locally using the electron test suite and `chown nobody:nogroup Electron.app` during the test suite
MarshallOfSound added a commit that referenced this issue Jun 18, 2021
For some reason even though the `NSTask` is terminated the file handle is still being read.  Fixes #247

Verified locally using the electron test suite and `chown nobody:nogroup Electron.app` during the test suite
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

Successfully merging a pull request may close this issue.

5 participants