aws-amplify / amplify-swift

A declarative library for application development using cloud services.
Apache License 2.0
447 stars 193 forks source link

Crash in SyncMutationToCloudOperation.finish #3468

Open fzy-github opened 8 months ago

fzy-github commented 8 months ago

Describe the bug

DataStore crashes when sending mutation to cloud:

OS Version: iOS 16.7.2 (20H115)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: SEGV_ACCERR at 0x4165473042423472
Crashed Thread: 16

Application Specific Information:
Signal 11, Code 2 >
Attempted to dereference garbage pointer at 0x4165473042423472.

Thread 16 Crashed:
0   Foundation                      0x3161f5604         <redacted>
1   Foundation                      0x316182d88         <redacted>
2   Foundation                      0x316182010         <redacted>
3   Foundation                      0x3161985d8         <redacted>
4   Foundation                      0x3161854d8         <redacted>
5   Foundation                      0x316185208         <redacted>
6   Foundation                      0x3161841b8         <redacted>
7   SampleApp                       0x20343d9c8         SyncMutationToCloudOperation.finish (SyncMutationToCloudOperation.swift:350)
8   SampleApp                       0x20343c688         SyncMutationToCloudOperation.validate (SyncMutationToCloudOperation.swift:259)
9   SampleApp                       0x20343c490         SyncMutationToCloudOperation.respond (SyncMutationToCloudOperation.swift:230)
10  SampleApp                       0x20343e784         SyncMutationToCloudOperation.respond
11  SampleApp                       0x203387c1c         [inlined] thunk for closure
12  SampleApp                       0x203387c1c         [inlined] thunk for closure
13  SampleApp                       0x203387c1c         [inlined] NSLocking.execute<T> (NSLocking+Execute.swift:47)
14  SampleApp                       0x203387c1c         NSLocking.execute (NSLocking+Execute.swift:24)
15  SampleApp                       0x20343c368         [inlined] SyncMutationToCloudOperation.respond (SyncMutationToCloudOperation.swift:223)
16  SampleApp                       0x20343c368         SyncMutationToCloudOperation.sendMutation (SyncMutationToCloudOperation.swift:213)
17  SampleApp                       0x2033787bc         AmplifyOperation.subscribe (AmplifyOperation.swift:130)
18  SampleApp                       0x203379068         AmplifyOperation.subscribe
19  SampleApp                       0x20338ef6c         SerialDispatcher.dispatch (SerialDispatcher.swift:45)
20  SampleApp                       0x20338ced8         thunk for closure
21  libdispatch.dylib               0x330586320         <redacted>
22  libdispatch.dylib               0x330587eac         <redacted>
23  libdispatch.dylib               0x33058af8c         <redacted>
24  libdispatch.dylib               0x330599944         <redacted>
25  libdispatch.dylib               0x33059a158         <redacted>
26  libsystem_pthread.dylib         0x3e18a6da0         _pthread_wqthread

Steps To Reproduce

N/A - app crashed when sending mutation to cloud after user added data

Expected behavior

no crash

Amplify Framework Version

2.25.2

Amplify Categories

DataStore

Dependency manager

Swift PM

Swift version

5.7

CLI version

12.8.2

Xcode version

15.1

Relevant log output

N/a

Is this a regression?

No

Regression additional context

Looking at logs it seems that during sending mutation to cloud crash happened.

last logged mutation was for following model:

struct TimedData: Model {
  let user_id: String
  let time_stamp: Temporal.DateTime
  var data_timezone: String
  var value1: Int?
  var value2: Int?
  var value3: Double?
  var value4: Double?
  var value5: Int?
  var value6: Int?
  var value7: String?
  var owner: String?
  var createdAt: Temporal.DateTime?
  var updatedAt: Temporal.DateTime?

Looking at logs here's the last json representation of model coming from outboxMutationEnqueued event before the crash:

"json": {
        "data_timezone": "America\/New_York",
        "value1": 86,
        "value8": "XYZ,
        "value4": 28.309999999999988,
        "value2": 265,
        "time_stamp": "2024-01-10T23:10:33.000Z",
        "user_id": "123456-abcde"
    },

Platforms

iOS

OS Version

16.7.2

Device

various, iPhone 14 Pro Max

Specific to simulators

No response

Additional context

full crash log: 1a3f079074bd46c48b6d605736b7abc6-symbolicated.txt

harsh62 commented 8 months ago

@fzy-spyro Thanks for opening the issue. Our team is looking into it and will provide an update.

madej10 commented 8 months ago

@harsh62 @lawmicha Could you please leave us an update. We're closing in on the public release, and the app keeps crashing regularly.

5d commented 8 months ago

Hello @madej10 @fzy-spyro,

Apologies, we were unable to replicate the crash. To address this issue:

  1. Sending a diagnose report by running amplify diagnose --send-report
  2. To gather more details about the crash, run Instruments.App and provide Leak and Zombie reports for the crashing app
  3. Additionally, could you share a sample app that reproduce this issue?

Thank you.