Squirrel.Mac icon indicating copy to clipboard operation
Squirrel.Mac copied to clipboard

App fails to launch after quit for install

Open aoshuang17 opened this issue 1 year ago • 1 comments

A couple of our users have recently encountered the issues during upgrade. After an updated version is downloaded and ready for installation, they click restart to update, the app quits but never relaunch with the upgraded version. Users had to try the following to mitigate

  • kill the ShipIt process and manually relaunch OR
  • reboot their laptop and manually relaunch

Here's the ShipIt_stderr.log from a user who tried to upgrade but the app did not launch

2023-02-20 08:20:48.445 ShipIt[2623:35352] Detected this as an install request
2023-02-20 08:20:51.795 ShipIt[2623:35371] Beginning installation
2023-02-20 08:20:55.762 ShipIt[2623:35369] Moved bundle from file:///Applications/My%20Product.app/ to file:///var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/com.amazon.My-Product.ShipIt.7rEtwD6b/My%20Product.app
2023-02-20 08:20:55.763 ShipIt[2623:35369] Moved bundle from file:///var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/com.amazon.My-Product.ShipIt.F5baD9pU/My%20Product.app to file:///Applications/My%20Product.app/
2023-02-20 08:20:55.839 ShipIt[2623:35369] Couldn't remove owned bundle at location file:///var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/com.amazon.My-Product.ShipIt.F5baD9pU/My%20Product.app, error NSError { domain: NSCocoaErrorDomain, code: 4, description: "“My Product.app” couldn’t be removed.", failureReason: "The file doesn’t exist.", underlying error: NSError { domain: NSPOSIXErrorDomain, code: 2, description: "The operation couldn’t be completed. No such file or directory" }, userInfo: {
    NSFilePath = "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/com.amazon.My-Product.ShipIt.F5baD9pU/My Product.app";
    NSUserStringVariant =     (
        Remove
    );
} }
2023-02-20 08:20:55.912 ShipIt[2623:35518] On main thread and launching: file:///Applications/My%20Product.app/
2023-02-20 08:20:55.912 ShipIt[2623:35518] Bundle URL is valid
2023-02-20 08:20:55.912 ShipIt[2623:35518] Attempting to launch app on 11.0 or higher
2023-02-20 08:20:55.912 ShipIt[2623:35518] Launching new ShipIt at /Applications/My Product.app/Contents/Frameworks/Squirrel.framework/Resources/ShipIt with instructions to launch file:///Applications/My%20Product.app/
2023-02-20 08:20:55.913 ShipIt[2623:35369] Installation completed successfully
2023-02-20 08:20:55.920 ShipIt[2623:35518] Attempting to add source to main runloop, but the main thread has exited. This message will only log once. Break on _CFRunLoopError_MainThreadHasExited to debug.
2023-02-20 08:20:59.178 ShipIt[2634:35606] Detected this as a launch request
2023-02-20 08:20:59.214 ShipIt[2634:35606] Successfully launched application at file:///Applications/My%20Product.app/
2023-02-20 08:20:59.214 ShipIt[2634:35606] ShipIt quitting

The NSError seems to be not the cause as I saw it in a good upgrade log too. The problems maybe: Attempting to add source to main runloop, but the main thread has exited. This message will only log once. Break on _CFRunLoopError_MainThreadHasExited to debug.

I did not see this error in a good upgraded, and instead it printed

2023-02-21 14:13:13.995 ShipIt[13378:3734895] On main thread and launching: file:///Applications/My%20Product.app/
2023-02-21 14:13:13.995 ShipIt[13378:3734895] Bundle URL is valid
2023-02-21 14:13:13.995 ShipIt[13378:3734895] Attempting to launch app on 11.0 or higher
2023-02-21 14:13:13.995 ShipIt[13378:3734895] Launching new ShipIt at /Applications/My Product.app/Contents/Frameworks/Squirrel.framework/Resources/ShipIt with instructions to launch file:///Applications/My%20Product.app/
2023-02-21 14:13:13.998 ShipIt[13378:3734809] Installation completed successfully
2023-02-21 14:13:18.891 ShipIt[13413:3735087] Detected this as a launch request
2023-02-21 14:13:18.992 ShipIt[13413:3735087] Successfully launched application at file:///Applications/My%20Product.app/
2023-02-21 14:13:18.992 ShipIt[13413:3735087] ShipIt quitting
2023-02-21 14:13:18.994 ShipIt[13378:3734895] New ShipIt exited
2023-02-21 14:13:18.994 ShipIt[13378:3734895] ShipIt quitting

Looks like at the end of a good upgrade, ShipIt will first quit for the launch request, then the previous install request will quit as well to complete. However in a failure case, the install request did not quit normally.

Any ideas on how should we mitigate the issue? Thanks!

aoshuang17 avatar Feb 22 '23 00:02 aoshuang17