Skip to content

EXC_BAD_ACCESS encountered in StorageMultipartUpload.transition during an abort event #3991

@ttrebbien

Description

@ttrebbien

Describe the bug

Through a third party monitoring tool we've observed multiple occurrences of crashes all originating from the same line in StorageMultipartUpload.swift:262 over the last couple of weeks. While the user base isn't big this has affected around 5-10% of unique users so far.

Steps To Reproduce

We have not yet been able to reproduce this bug ourselves and all information gathered here has been obtained through [Sentry](https://sentry.io/).

While we cannot be sure, we assume that cancellation of a multipart upload task via `StorageUploadFileTask.cancel()` has taken place leading up to the crashes, as this is the only potential operation we perform on an upload task after it has started. The files attempted uploaded are usually several GBs in size.

Expected behavior

It was expected that the code in question would throw and its error be handled.

Amplify Framework Version

2.46.2

Amplify Categories

Storage

Dependency manager

Swift PM

Swift version

5 (Swift Language Mode)

CLI version

N/A

Xcode version

16.3

Relevant log output

Though not all collected stack traces are identical, they all reach the aforementioned code as the last point. A sample stack trace is given here:


Thread 16 Crashed:
0   libobjc.A.dylib                 0x309b11b50         objc_release
1   libswiftCore.dylib              0x30c0f91f8         swift_dynamicCast
2   libswiftCore.dylib              0x30be4bdd8         _print_unlocked<T>
3   <REDACTED>                      0x200ad53f4         [inlined] DefaultStringInterpolation.appendInterpolation<T>
4   <REDACTED>                      0x200ad53f4         StorageMultipartUpload.transition (StorageMultipartUpload.swift:262)
5   <REDACTED>                      0x200adb8d8         closure in StorageMultipartUploadSession.handle (StorageMultipartUploadSession.swift:229)
6   <REDACTED>                      0x200adef70         closure in StorageMultipartUploadSession.handle
7   libswiftDispatch.dylib          0x321cec178         thunk for closure
8   libswiftDispatch.dylib          0x321cec154         thunk for closure
9   libswiftDispatch.dylib          0x321cec0bc         closure in OS_dispatch_queue._syncHelper<T>
10  libswiftDispatch.dylib          0x321cebff0         thunk for closure
11  libswiftDispatch.dylib          0x321cebfc8         thunk for closure
12  libdispatch.dylib               0x31ef4b580         _dispatch_client_callout
13  libdispatch.dylib               0x31ef41b48         _dispatch_sync_invoke_and_complete_recurse
14  libdispatch.dylib               0x31ef415d8         _dispatch_sync_f_slow
15  libswiftDispatch.dylib          0x321cebf54         closure in OS_dispatch_queue.asyncAndWait<T>
16  libswiftDispatch.dylib          0x321cebe8c         closure in OS_dispatch_queue.sync<T>
17  libswiftDispatch.dylib          0x321cebd0c         OS_dispatch_queue._syncHelper<T>
18  libswiftDispatch.dylib          0x321cebb48         OS_dispatch_queue.asyncAndWait<T>
19  libswiftDispatch.dylib          0x321cebab4         OS_dispatch_queue.sync<T>
20  <REDACTED>                      0x200adb13c         StorageMultipartUploadSession.handle (StorageMultipartUploadSession.swift:228)
21  <REDACTED>                      0x200ad83f4         closure in DefaultStorageMultipartUploadClient.abortMultipartUpload (StorageMultipartUploadClient.swift:203)
22  <REDACTED>                      0x200aabb74         closure in AWSS3Adapter.abortMultipartUpload (AWSS3Adapter.swift:160)
23  libswift_Concurrency.dylib      0x326736130         swift::runJobInEstablishedExecutorContext

Is this a regression?

No

Regression additional context

No response

Platforms

iOS

OS Version

iOS 17.6.1 through 18.4.1

Device

iPhone 11 through 16 Pro

Specific to simulators

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstorageIssues related to the Storage category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions