open-trackers / Gym-Routine-Tracker-Watch-App

Minimalist gym workout tracker, as independent watchOS app
https://open-trackers.github.io/grt
Mozilla Public License 2.0
36 stars 8 forks source link

Crash on watchOS 10.0.1 #24

Open reedes opened 1 year ago

reedes commented 1 year ago

I used app for first time after three weeks, as rec center was closed for renovations.

Started workout. After a few minutes in exercise looked at watch to see it back on watch face. Clicked app where it appeared to be starting from scratch main (showing routine list screen), suggesting app had crashed and wasn't able to restore session.

Haven't seen again, nor had I collected any crash data.

If happens again I'll dig in further.

UPDATE: See suggested workaround below!

reedes commented 1 year ago

I can get it to happen repeatedly. Will investigate.

reedes commented 1 year ago

Testing with Xcode 15.0, app crashed with "Thread 1: signal SIGTERM" crash. Will try to reproduce and determine cause.

reedes commented 1 year ago

So far not crashing when running on new build in Xcode 15.0 on latest watchOS on my Ultra.

I'll work on fixing some of the cosmetic changes and test some more before posting a new release.

reedes commented 1 year ago

Cosmetic changes completed. Will test for a day before pushing new 1.11.0 release.

reedes commented 1 year ago

Additional changes necessary.

Seems likely it was a "scene-create" watchdog error, where during transition to .active it hung on the core data operation.

Tests okay since change, where I ran routine and then disrupted wi-fi connection to cause the error to occur.

Will leave open for a week or two to see if others experience crashes with the new release.

reedes commented 1 year ago

Apps submitted for review.

reedes commented 1 year ago

It's still an issue.

In some cases the app unloads from memory, returning to watch face, where the session is preserved.

In other cases the app appears to crash, where the session is lost.

Doesn't seem to matter whether wi-fi is enabled or not.

reedes commented 1 year ago

Appears to be motion related. Compare app stability when sitting versus walking or working out.

reedes commented 1 year ago

Examining system_logs.logarchive in sysdiagnose, it looks like a background task is running in excess of 30 seconds and is at risk of termination.

This could be the blocking of a network operation to sync the iCloud data. Will investigate further.

reedes commented 1 year ago

Ruled out the two callers of performBackgroundTask, namely storeRemoteChange in TrackerLib and handleTaskAction in GroutUI. (By commenting both out and reproducing problem.)

So it appears that there's something amiss with CloudKit syncing.

reedes commented 1 year ago

The cause of the watchdog terminations appears to be the CloudKit syncing background process, as described here: https://stackoverflow.com/questions/73401639/very-slow-sync-of-coredata-cloudkit-on-watchos

reedes commented 11 months ago

I'll suggest a workaround of modifying your wi-fi configuration on your watch to deter its attempts to sync its iCloud store.

Specifically, in Settings/Wi-Fi on the watch:

  1. In "Auto Hotspot Settings" configure as "Ask to Join"

  2. Select your network (eg, "My Fitness Club") and 'Forget this Network'

This isn't ideal, but should provide some stability until a longer-term solution is found and implemented.

Note that this isn't necessary if you're not seeing the crashes. (Your wi-fi is better than mine!)

Note that temporarily disabling wi-fi (on the watch) did not avoid the crashes for me, but you could try it!