-
-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash TaskFetchOriginalImageData on data.append #738
Comments
Hey, are you still able to reproduce this issue with the latest version? |
I have similar crash, 5 crash events affecting 4 users last 30 days. iOS: 15, 16 (not iOS 17)
|
Related: #572. Hey, @larryonoff, do you happen to have any additional information around this crash? The size of the data? The crash message? Due to how rare these crashes seem to be, I suspect it's a memory issue – hitting a hard memory limit? If it is a memory issue, I wonder if I could add some defensive code to limit the size of expected data. |
@kean I have only crash from Crashlytics. See it below.
I would like to add that we had another similar issue (not with Nuke), when downloading video files incrementally. Our fix was checking the length of Data to get it contents. See the sample below. func x() {
let lowerBound = dataRequest.requestedOffset
let upperBound = lowerBound + Int64(dataRequest.requestedLength)
dataRequest.respond(with: data[safe: lowerBound..<upperBound])
}
private extension Data {
subscript(
safe range: Range<Int64>
) -> Data {
guard !isEmpty else {
return Data()
}
let safeRange = range.clamped(to: 0..<Int64(count))
guard !safeRange.isEmpty else {
return Data()
}
return self[safeRange]
}
} |
Not sure this has any bearing on this bug, but our crashes for this specific problem are 100% on iOS 18+, which is the minority of our users (iOS 18 = 23% of our users, vs 77% for iOS 17 and older) Something must've changed in iOS 18 that exacerbate the problem |
I am getting this crash on app start then I register a custom ImageDecoding App init:
|
Hi!
I just noticed that there is a crash on TaskFetchOriginalImageData.
this is the stack trace
Signal: SIGTRAP
EXC_BREAKPOINT (SIGTRAP): EXC_BREAKPOINT (SIGTRAP)
libswiftCore.dylib
assertionFailure(::file:line🎏) + 248
libswiftCore.dylib
assertionFailure(::file:line🎏) + 248
Foundation
__DataStorage.replaceBytes(in:with:length:) + 2232
Foundation
Data.InlineSlice.append(contentsOf:) + 100
Foundation
Data.Representation.append(contentsOf:) + 356
Foundation
0x1a35d2000 + 3496304
Foundation
Data.append(:) + 148
Circle
TaskFetchOriginalImageData.dataTask(didReceiveData:response:) (TaskFetchOriginalImageData.swift:115)
Circle
partial apply for closure #1 in closure #1 in TaskFetchOriginalImageData.loadData(urlRequest:finish:) (TaskFetchOriginalImageData.swift:77)
Circle
thunk for @escaping @callee_guaranteed @sendable () -> () (:0)
libdispatch.dylib
0x1aff91000 + 407464
libdispatch.dylib
0x1aff91000 + 411520
libdispatch.dylib
0x1aff91000 + 259836
libdispatch.dylib
0x1aff91000 + 262576
libdispatch.dylib
0x1aff91000 + 302868
libsystem_pthread.dylib
_pthread_wqthread + 284
On iOS 16
Nuke version 12.1.6
Seems that the affected line is inside this func
private func dataTask(didReceiveData chunk: Data, response: URLResponse)
of TaskFetchOriginalImageData, while appending data!
Unfortunately I am not able to replicate the crash, It happens in production few few times!
Thanks,
Luca
The text was updated successfully, but these errors were encountered: