lottie-ios icon indicating copy to clipboard operation
lottie-ios copied to clipboard

App crashes in Foundation.JSONDecoder.decode inside Lottie.Animation

Open awBSH opened this issue 2 years ago • 2 comments

Hello,

since October 24th (the release day of iOS16.1), we suddenly started observing an increase in crash-reports for our App.

It crashes in various places of our App but we could identify certain patterns:

  • it started on October 24th
  • it crashes only in iOS16.1 and later
  • it crashes in all our versions of the App (seems to not tie to a recent change of us)
  • second biggest group of crashes seems to come from JSONDecoder (but also NSJSONReader) (which we use in our code and is used by 3rd-party libraries like Lottie, App-Auth...)

So far, we could not reproduce the crash but we only receive the information from the crash-reporting.

With the given information, we assume something changed in iOS16.1 with the JSONDecoder.

Has anyone made similar observations with such crashes from iOS16.1?

Which Version of Lottie are you using?

Lottie 3.3.0

Crash Detail

Thread 0 Crashed:
0   libswiftCore.dylib                   0x00000001cf8b3844 swift_unknownObjectRetain + 8
1   Foundation                           0x00000001cfd7704c generic specialization <Swift.String, Any> of static (extension in Foundation):Swift.Dictionary._conditionallyBridgeFromObjectiveC(_: __C.NSDictionary, result: inout [A : B]?) -> Swift.Bool + 260
2   libswiftCore.dylib                   0x00000001cf869244 _tryCastFromClassToObjCBridgeable(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, void*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool, _ObjectiveCBridgeableWitnessTable const*, swift::TargetMetadata<swift::InProcess> const*) + 352
3   libswiftCore.dylib                   0x00000001cf8671c8 tryCast(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 3012
4   libswiftCore.dylib                   0x00000001cf866cfc tryCast(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 1784
5   libswiftCore.dylib                   0x00000001cf866cfc tryCast(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 1784
6   libswiftCore.dylib                   0x00000001cf86648c swift_dynamicCast + 204
7   Foundation                           0x00000001cfee4770 Foundation.(_JSONUnkeyedDecodingContainer in _12768CA107A31EF2DCE034FD75B541C9).nestedContainer<A where A: Swift.CodingKey>(keyedBy: A.Type) throws -> Swift.KeyedDecodingContainer<A> + 1244
8   Foundation                           0x00000001cfee5dd0 protocol witness for Swift.UnkeyedDecodingContainer.nestedContainer<A where A1: Swift.CodingKey>(keyedBy: A1.Type) throws -> Swift.KeyedDecodingContainer<A1> in conformance Foundation.(_JSONUnkeyedDecodingContainer in _12768CA107A31EF2DCE034FD75B541C9) : Swift.UnkeyedDecodingContainer in Foundation + 12
9   libswiftCore.dylib                   0x00000001cf8314f0 dispatch thunk of Swift.UnkeyedDecodingContainer.nestedContainer<A where A1: Swift.CodingKey>(keyedBy: A1.Type) throws -> Swift.KeyedDecodingContainer<A1> + 28
10  OUR_APP                              0x00000001030c45ec function signature specialization <Arg[0] = Dead> of generic specialization <Lottie.Animation.CodingKeys, Lottie.LayerModel, Lottie.LayerType> of (extension in Lottie):Swift.KeyedDecodingContainer.decode<A, B where A1: Swift.Decodable, B1: Lottie.ClassFamily>(_: [A1].Type, ofFamily: B1.Type, forKey: A) throws -> [A1] (KeyedDecodingContainerExtensions.swift:36)
11  OUR_APP                              0x00000001030bf3d8 Lottie.Animation.init(from: Swift.Decoder) throws -> Lottie.Animation (<compiler-generated>:0)
12  OUR_APP                              0x00000001030c06f8 protocol witness for Swift.Decodable.init(from: Swift.Decoder) throws -> A in conformance Lottie.Animation : Swift.Decodable in Lottie (<compiler-generated>:0)
13  libswiftCore.dylib                   0x00000001cf82fb10 dispatch thunk of Swift.Decodable.init(from: Swift.Decoder) throws -> A + 28
14  Foundation                           0x00000001cfee8f14 Foundation.(__JSONDecoder in _12768CA107A31EF2DCE034FD75B541C9).unbox_(_: Any, as: Swift.Decodable.Type) throws -> Any? + 952
15  Foundation                           0x00000001cfedaf88 Foundation.JSONDecoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Foundation.Data) throws -> A + 1280
16  Foundation                           0x00000001cfeec084 dispatch thunk of Foundation.JSONDecoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Foundation.Data) throws -> A + 52
17  OUR_APP                              0x0000000103106224 function signature specialization <Arg[4] = Dead> of static Lottie.Animation.named(_: Swift.String, bundle: __C.NSBundle, subdirectory: Swift.String?, animationCache: Lottie.AnimationCacheProvider?) -> Lottie.Animation? (AnimationPublic.swift:67)
18  OUR_APP                              0x0000000102cc17e8 function signature specialization <Arg[0] = Dead> of OUR_APP.LoadingVM.animationObservable.getter : RxSwift.Observable<Lottie.Animation?> (LoadingVM.swift:61)

Crash Report

report-2517335046280009999-cd3e73e4-f618-42e0-a456-95bb052476f9.txt

Apple Forum

We have posted this also to https://developer.apple.com/forums/thread/720837

awBSH avatar Dec 02 '22 09:12 awBSH

If you find repro steps, could you share them on this ticket? Thanks!

I also see that you're using Lottie 3.3.0. Does the issue go away if you adopt Lottie 3.5.0? You may want to test the new dictionary-based decoding option as a workaround, since like looks like this crash is happening somewhere in the Decodable implementation (which isn't used with the dictionary-based decoding implementation)

calda avatar Dec 02 '22 16:12 calda

Hi @calda,

unfortunately we couldn't reproduce this issue ... yet.

As a next step we want to upgrade to Lottie 3.5.0 and eventually also try the dictionary-based decoding option - thanks for the hint.

Our main intention of this GH-issue is, to find out if anyone else is seeing such crashes too 🙏

awBSH avatar Dec 02 '22 22:12 awBSH

This issue is stale because it is marked "can't reproduce" and has had no activity in the past week. Please comment with additional information, or this issue will be closed due to inactivity in one week.

github-actions[bot] avatar Dec 10 '22 02:12 github-actions[bot]