iOS 14.0b3, b4, b5, b6 Crash In Background

Created on 23 Jul 2020  路  19Comments  路  Source: home-assistant/iOS

Temporary workaround: For TestFlight users annoyed by the dialog, install the App Store version on top. You'll still be notified of future betas, and the did-crash alert won't happen. It seems that location and sensor updates still work despite the crashing.

This is a known issue and believed to be in iOS 14.0b3. Safari and other Apple apps are crashing in the same way they just are doing it silently.

If you see this, please chime in here

iOS device model, version and app version

Model Name: Any iOS 14 compatible
Software Version: iOS 14 beta 3 (dev)
App version: 2020.4(8)

Home Assistant Core Version

N/A

Describe the bug

  • A few seconds after closing the app to the background a pop-up appears stating "Home Assistant" Crashed and asking if you would like to inform the developer.
  • This also happens when you haven't had the app open but it has been woken from background to do something (i.e. sensor/location update)

Screenshots

IMG_1205

crash iOS 14 realm

Most helpful comment

We are indeed seeing the crash reason as 0xdead10cc which makes it suspicious that it may be a file lock, so thanks for commenting; it's good to see others are experiencing it as well. However, there's a few indicators that this is an iOS 14.0 b3 issue and not an app issue:

  • The crash doesn't occur when built in Xcode 12. Even unattached to the debugger, the same scenario doesn't crash. This makes me think it may be a badly-written linked-on-or-after check in the system.
  • Other apps on the system are crashing with 0xdead10cc as well. For example, on my device I see SafariView and Spotlight both experiencing it. I'm guessing there's more since only checked & upgraded last night.

Moving the database out of the app group won't work for HA, since our extensions need access to the database. We can look into some more aggressive background task wrapping for all Realm writes - most are already covered by the existing flow, and certainly the ones that occur when backgrounding are (we do not write to Realm super often).

At this point, I think waiting out the developer betas to see if it's resolved in b4 (or if they ship a new public beta with this issue) is the easiest/best course of action. It's unfortunate that end-users run them when the public betas are available, but that's hopefully a known risk. Similar thing happens most years, e.g. last year iOS 13 had some dangerous data-loss issues that never appeared in the public betas.

Update: This does occur in Public Beta 3. We'll be keeping an eye on this issue. Should only be really annoying for those of you in the TestFlight beta. Sorry about that!

All 19 comments

Yes, same for me.

I should say, the app seems to be working fine. Background sensor and location updates seem to be running well

Yeah. I also get the notifications.

Same issue here and same behavior. Crashes about 3 seconds after being backgrounded and also with location update. When I got back from a drive yesterday there were like 10 crash notifications I had to dismiss after waking my phone.

Found something else maybe interesting just now. On my iPad which I haven't used much lately, that device is still on the "2020.3.1 (1)" app and I'm not getting these crashes on iOS 14 Dev B3. So it seems specific to 2020.4 versions maybe.

When I got back from a drive yesterday there were like 10 crash notifications I had to dismiss after waking my phone.

Yep same here. I wonder if this is a good prompt to put out a TestFlight version built with XCode 12 to see what other problems might be hiding down the road.

2020.3.1 (1) crashes for me as well, I don't think 2020.4 is itself the culprit.

Hi! I don't use this app but I had the same problem with my app, which is already solved. By coincidence, my app also uses Realm as the persistent store, so it was easy to spot the same issue here.

https://github.com/home-assistant/iOS/blob/b8e7240258b59204f92f3ac7c6017868ae7f73ad/Shared/Common/Extensions/Realm%2BInitialization.swift#L27

The Realm file is being saved inside the app group folder and as the Realm files are locked, iOS is killing every app that was suspended with locked files.

It happens even before iOS 14 beta 3, but not so often, and I don't know the reason, but seems that now the system will really kill all the apps with locked files in the app group folder.

Solution: move the Realm file to the Documents folder.

More information here:

We are indeed seeing the crash reason as 0xdead10cc which makes it suspicious that it may be a file lock, so thanks for commenting; it's good to see others are experiencing it as well. However, there's a few indicators that this is an iOS 14.0 b3 issue and not an app issue:

  • The crash doesn't occur when built in Xcode 12. Even unattached to the debugger, the same scenario doesn't crash. This makes me think it may be a badly-written linked-on-or-after check in the system.
  • Other apps on the system are crashing with 0xdead10cc as well. For example, on my device I see SafariView and Spotlight both experiencing it. I'm guessing there's more since only checked & upgraded last night.

Moving the database out of the app group won't work for HA, since our extensions need access to the database. We can look into some more aggressive background task wrapping for all Realm writes - most are already covered by the existing flow, and certainly the ones that occur when backgrounding are (we do not write to Realm super often).

At this point, I think waiting out the developer betas to see if it's resolved in b4 (or if they ship a new public beta with this issue) is the easiest/best course of action. It's unfortunate that end-users run them when the public betas are available, but that's hopefully a known risk. Similar thing happens most years, e.g. last year iOS 13 had some dangerous data-loss issues that never appeared in the public betas.

Update: This does occur in Public Beta 3. We'll be keeping an eye on this issue. Should only be really annoying for those of you in the TestFlight beta. Sorry about that!

It's a little bit annoying to click the crashmessage seven times away when you driven somewhere, but that's things to be accepted when running beta. Thanks for investigating!

There is bug report for this: https://developer.apple.com/forums/thread/655225

Hmm title changed, so you already noticed that it happens still...

With the new option in 2020.5(2+) I don't see these after closing the app but still see multiple after a jouney when the app has been doing significant location updates etc. in background

A fix has been merged into Realm realm/realm-core#3862

and released as https://github.com/realm/realm-cocoa/releases/tag/v5.3.5~~ Zac tells me this is not the release. We need a Cocoa release containing core version 6.0.21 or later.

If you'd like to give this a try, sign up for TestFlight!

FYI: On iOS 14 b7 seems to solve this issue.

FYI: On iOS 14 b7 seems to solve this issue.

Are you still running app version 2020.6(<=10)

Oh Apple. I can confirm a build before the Realm update no longer crashes. Hoped it would end up being walked back, funny it's the day after Realm works around it.

Was this page helpful?
0 / 5 - 0 ratings