Closed iTKerry closed 4 years ago
I got crash when was trying to get data from cache. ERROR: EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x000000016b7dffc0 Here is the log:
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x000000016b7dffc0
Crashed: Cache.SyncStorage.SerialQueue 0 CoreFoundation 0x1ecac2cfc CFBasicHashFindBucket + 4 1 CoreFoundation 0x1eca655bc __CFGetConverter + 232 2 CoreFoundation 0x1eca65b38 CFStringEncodingIsValidEncoding + 12 3 CoreFoundation 0x1eca67fc0 __CFStringEncodeByteStream + 1268 4 Foundation 0x1ed3f880c -[NSString(NSStringOtherEncodings) lengthOfBytesUsingEncoding:] + 164 5 Foundation 0x1ed44afa0 -[NSPlaceholderString initWithString:] + 252 6 Cache 0x1049ba3d4 @nonobjc NSString.init(string:) (<compiler-generated>) 7 Cache 0x1049b8388 NSString.__allocating_init(string:) (<compiler-generated>) 8 Cache 0x1049b851c MemoryStorage.entry(forKey:) (MemoryStorage.swift:48) 9 Cache 0x10499ce8c HybridStorage.entry(forKey:) (HybridStorage.swift:31) 10 Cache 0x1049c08f8 closure #1 in SyncStorage.entry(forKey:) (SyncStorage.swift:20) 11 Cache 0x1049c0a14 partial apply for closure #1 in SyncStorage.entry(forKey:) (<compiler-generated>) 12 Cache 0x1049c0a44 thunk for @callee_guaranteed () -> (@error @owned Error) (<compiler-generated>) 13 Cache 0x1049c0b00 partial apply for thunk for @callee_guaranteed () -> (@error @owned Error) (<compiler-generated>) 14 libswiftDispatch.dylib 0x21a0d5450 partial apply for thunk for @callee_guaranteed () -> (@out A, @error @owned Error) + 20 15 libswiftDispatch.dylib 0x21a0ce7ac closure #1 in closure #1 in OS_dispatch_queue._syncHelper<A>(fn:execute:rescue:) + 104 16 libswiftDispatch.dylib 0x21a0d5234 partial apply for thunk for @callee_guaranteed () -> () + 20 17 libswiftDispatch.dylib 0x21a0c8930 thunk for @escaping @callee_guaranteed () -> () + 20 18 libdispatch.dylib 0x1ec4dd7d4 _dispatch_client_callout + 16 19 libdispatch.dylib 0x1ec48bc18 _dispatch_lane_barrier_sync_invoke_and_complete + 56 20 libswiftDispatch.dylib 0x21a0ced94 @nonobjc OS_dispatch_queue.sync(execute:) + 156 21 libswiftDispatch.dylib 0x21a0d2da0 partial apply for @nonobjc + 20 22 libswiftDispatch.dylib 0x21a0ce638 OS_dispatch_queue._syncHelper<A>(fn:execute:rescue:) + 264 23 libswiftDispatch.dylib 0x21a0cecc8 OS_dispatch_queue.sync<A>(execute:) + 164 24 Cache 0x1049bfe54 SyncStorage.entry(forKey:) (SyncStorage.swift:19) 25 Cache 0x1049bc1a8 Storage.entry(forKey:) (Storage.swift:47) 26 Cache 0x1049bc454 protocol witness for StorageAware.entry(forKey:) in conformance Storage<A> (<compiler-generated>) 27 Cache 0x1049bd9dc StorageAware.object(forKey:) (StorageAware.swift:59) 28 ProjectName 0x1045884c4 specialized CacheRepository.get(forKey:) + 4302210244
Code with GET request:
func get(forKey: String) -> [T]? { do { let data = try self.storage.object(forKey: forKey) print("Storage -> GET -> Key: '\(forKey)' -> Result: \(String(describing: data))") return data } catch { print("Error on get storage data: " + error.localizedDescription) return nil } }
I got crash when was trying to get data from cache. ERROR:
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x000000016b7dffc0
Here is the log:Code with GET request: