dueapp / Due-macOS

Public issue tracker for Due for macOS. Submit bug reports and feature requests related to Due for macOS.
24 stars 0 forks source link

Sync fails when a new version of the app is pending #218

Closed russelldavis closed 1 year ago

russelldavis commented 1 year ago

Whenever a new version of the app has been installed (via auto update from the app store), but is not yet running (because the old version is still running and hasn't yet been restarted), syncing stops working. It's like clockwork -- I always know when a new version is out because my phone is suddenly out of sync with the app :)

Quitting the app and then restarting it (which starts up the new version) gets sync working again. And note then when I do quit the old version, it pops up the dialog saying that changes haven't yet successfully synced to the cloud, and I have to click the "quit anyway" button.

junjie commented 1 year ago

Thanks for reporting this @russelldavis

I'm not sure what mechanism would trigger such a behaviour. It sounded like Due failed to upload changes on your Mac. When this happen next time, can you choose to email us from within Due > Help > Email support.

This would give us some diagnostic logs to work with especially if sync has failed before this.

Then proceed to perform another sync. You can do so in Due > Preferences > Sync. See if you get an error or does the sync complete. If you get another error, drop us another email through Due > Help > Email support.

Thanks!

junjie commented 1 year ago

Hi @russelldavis are you using Dropbox sync?

russelldavis commented 1 year ago

I used Dropbox sync a long time ago, but I've been using iCloud sync for a while now.

russelldavis commented 1 year ago

I didn't notice the issue with the latest update to the app (22.7). Usually I have to restart the app manually before I see the new version. This time I'm pretty sure the app restarted on its own.

russelldavis commented 1 year ago

This issue is happening again due to today's release. I sent some emails to support as instructed.

russelldavis commented 1 year ago

It happened again today with the new 22.9 release

junjie commented 1 year ago

@russelldavis you've restarted i assumed? if not can you try something for me? cmd-click on Due on the dock and find the path of the executable?

russelldavis commented 1 year ago

Yeah, I already restarted.

russelldavis commented 1 year ago

This happened again with yesterday's update. It prevented my macbook from automatically restarting while trying to install the latest macOS 12.6.2 update:

Screen Shot 2023-01-04

I checked on the path of the executable. The dock said it was in /Applications, but I'm not sure that can be trusted. I should have inspected the file there to see what the version was (I'll do that next time). I'm assuming it was the new one, and the dock was just reporting on the original location from when it was launched.

Running ps -ef also showed the location as being in /Applications, but I think that also just uses the location from when it was launched. To dig a bit deeper, I inspected the process in Activity Monitor, and looked at the "Open Files and Ports" tab. That showed what I had suspected -- a copy of Due.app in a temporary directory, specifically /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/PKInstallSandboxTrash/4582F7B1-A235-42D8-BE93-9A59A11FC583.sandboxTrash/Due.app/Contents/MacOS/Due.

A bunch of other files from the Due.app folder in that temp directory were also open. You can see the full report here. Interestingly, there's one (and only one) file open inside /Applications/Due.app: /Applications/Due.app/Contents/Resources/Base.lproj/Main.storyboardc/UploadingPanel.nib/keyedobjects-110000.nib. Maybe that's the problem -- is Due opening that file in a special way that causes it to load from /Applications rather than the temporary directory the app was moved to?

One other weird thing to note. I tried listing the contents of that temporary directory (while the old Due.app was still running), and ls said it didn't exist. It reported that the parent folder was empty:

MacBook-Pro-2 /$ sudo ls -la /private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/PKInstallSandboxTrash/
total 0
drwxr-xr-x  2 root wheel   64 2023-01-03 17:26 .
drwx------ 45 root wheel 1440 2023-01-03 20:29 ..

Not totally sure what to make of that, but maybe macOS is doing the trick where you can delete (unlink) a file while it is still in use, and the OS keeps the inode around until the last handle to the file is closed.

junjie commented 1 year ago

Thanks for the investigation @russelldavis! We'll look at some of the possibilities that you've suggested

junjie commented 1 year ago

@russelldavis Heads up, I just released 23.1, but this time not as a phased update. So that means it should roll out to everyone shortly. Let me know if you encounter any issue.

russelldavis commented 1 year ago

Oh good, I think that may have fixed it. This time it's not automatically installing the new version while the old version is still running (at least so far). The app store shows the update is available, but it hasn't installed it yet. If I click on the update button, it asks me if I will allow it to restart the app for the update to occur. I clicked cancel, so I'm still on the old version.

I'm going to give it a few days to make sure it doesn't force install it at some point while Due is still running. As long as it doesn't do that, I think it's fixed. Thank you!

junjie commented 1 year ago

Hi @russelldavis Due 23.2 was also released a few days ago, again not as a phased release. Did you encounter any problem in the last 2 updates?

russelldavis commented 1 year ago

I actually still had the old version (22.1) running up until now. No problems with it automatically being updated while still running. I finally clicked to upgrade in the app store and let it restart the app. Everything worked great. Thank you!

junjie commented 1 year ago

Thanks @russelldavis. Then it sounds like this could very well be a problem with Mac App Store phase release mechanism. The last two updates were released to everyone at once and nobody seemed to have encountered the problem. Unfortunately this also sounds like the worst kind of bug to report to Apple because of how difficult it is to reproduce. There may be bigger updates for Due Mac in future requiring phase release. So if this is indeed a problem with the phase release mechanism, then this may very well happen again when we do a phase release. For now I'll just close this until we have information indicating otherwise. Thank you for your assistance so far.