Closed ehiosunbishop closed 4 months ago
Downgrading the plugin version to 5.6.13 worked for me..
which was kinda strange
I've been experiencing the same issue since yesterday. I updated from ^5.3.48 to ^5.7.17. I'll try downgrading.
Downgrading the plugin version to 5.6.13 worked for me..
which was kinda strange
Using 5.6.13 but having same issue. Issue is on iOS, working in Android.
✨ Capacitor-updater: Stats sent for download_60, version 24.3.2 ✨ Capacitor-updater: Cannot found privateKey or sessionKey Simultaneous accesses to 0x600002c44a90, but modification requires exclusive access. Previous access (a modification) started at ⚡️ TO JS
I'm using auto update from my server.
Below is full log that may be helpful in debugging:
✨ Capacitor-updater: Check for pending update ✨ Capacitor-updater: Stats sent for app_moved_to_background, version builtin ⚡️ [log] - Application pause ⚡️ TO JS undefined ✨ Capacitor-updater: Wait for 10000 ms, then check for notifyAppReady ✨ Capacitor-updater: Check for update via https://ws1.wealthspectrum.com/wealthspectrum/app/mobile/checkForUpdate ✨ Capacitor-updater: Auto-update parameters: InfoObject(platform: Optional("ios"), device_id: Optional("92FDB34A-3D6B-4695-8F06-926F5B4E2BED"), app_id: Optional("com.wealthspectrum.wealth.portal"), custom_id: Optional(""), version_build: Optional("24.3"), version_code: Optional("9"), version_os: Optional("17.0.1"), version_name: Optional("builtin"), plugin_version: Optional("5.7.14"), is_emulator: Optional(true), is_prod: Optional(false), action: nil, channel: nil, defaultChannel: Optional("")) ⚡️ [log] - Application resumed : 1711634133899 ⚡️ [log] - vault kept unlocked ✨ Capacitor-updater: Stats sent for app_moved_to_foreground, version builtin ✨ Capacitor-updater: New bundle: 24.3.2 found. Current is: builtin. Update will occur next time app moves to background. ✨ Capacitor-updater: list File : /Users/appliedm1/Library/Developer/CoreSimulator/Devices/2FC07F16-5D1D-4461-B417-9E742CFF46E5/data/Containers/Data/Application/75163DDB-5940-4142-BA31-410B92BA2A8D/Documents/versions ✨ Capacitor-updater: Storing info for bundle [0Ur9YqzhTw] { "id": "0Ur9YqzhTw", "version": "24.3.2", "downloaded": "2024-03-28T13:55:42.480Z", "checksum": "", "status": "downloading"} ✨ Capacitor-updater: Stats sent for download_0, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_10, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_10, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_20, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_20, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_30, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_40, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_40, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_50, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_50, version 24.3.2 ✨ Capacitor-updater: Cannot found privateKey or sessionKey ✨ Capacitor-updater: Stats sent for download_60, version 24.3.2 Simultaneous accesses to 0x600000bd55d0, but modification requires exclusive access. Previous access (a modification) started at CapgoCapacitorUpdater`CapacitorUpdater.saveDownloaded(sourceZip:id:base:) + 1544 (0x1064255e4). Current access (a modification) started at: 0 libswiftCore.dylib 0x0000000107b8117c swift::runtime::AccessSet::insert(swift::runtime::Access, void, void*, swift::ExclusivityFlags) + 428 1 libswiftCore.dylib 0x0000000107b81390 swift_beginAccess + 72 2 CapgoCapacitorUpdater 0x0000000106425c6c closure #1 in CapacitorUpdater.saveDownloaded(sourceZip:id:base:) + 284 3 CapgoCapacitorUpdater 0x000000010643df30 partial apply for closure #1 in CapacitorUpdater.saveDownloaded(sourceZip:id:base:) + 156 4 CapgoCapacitorUpdater 0x0000000106425ddc thunk for @escaping @callee_guaranteed (@guaranteed String, @unowned unz_file_info_s, @unowned Int, @unowned Int) -> () + 224 5 SSZipArchive 0x0000000105f4aebc +[SSZipArchive unzipFileAtPath:toDestination:preserveAttributes:overwrite:nestedZipLevel:password:error:delegate:progressHandler:completionHandler:] + 7020 6 CapgoCapacitorUpdater 0x0000000106424fdc CapacitorUpdater.saveDownloaded(sourceZip:id:base:) + 1660 7 CapgoCapacitorUpdater 0x0000000106429d34 closure #3 in CapacitorUpdater.download(url:version:sessionKey:) + 1596 8 CapgoCapacitorUpdater 0x000000010642aea4 partial apply for closure #3 in CapacitorUpdater.download(url:version:sessionKey:) + 72 9 Alamofire 0x00000001060194e0 closure #1 in closure #1 in closure #3 in closure #1 in DownloadRequest._response(queue:responseSerializer:completionHandler:) + 124 10 Alamofire 0x0000000105fb0228 thunk for @escaping @callee_guaranteed @Sendable () -> () + 48 11 libdispatch.dylib 0x00000001081fc0d8 _dispatch_call_block_and_release + 24 12 libdispatch.dylib 0x00000001081fd92c _dispatch_client_callout + 16 13 libdispatch.dylib 0x0000000108211348 _dispatch_root_queue_drain + 940 14 libdispatch.dylib 0x0000000108211f68 _dispatch_worker_thread2 + 256 15 libsystem_pthread.dylib 0x0000000108d2b808 _pthread_wqthread + 224 16 libsystem_pthread.dylib 0x0000000108d2a6dc start_wqthread + 8
Below is full log that may be helpful in debugging:
✨ Capacitor-updater: Check for pending update ✨ Capacitor-updater: Stats sent for app_moved_to_background, version builtin ⚡️ [log] - Application pause ⚡️ TO JS undefined ✨ Capacitor-updater: Wait for 10000 ms, then check for notifyAppReady ✨ Capacitor-updater: Check for update via https://ws1.wealthspectrum.com/wealthspectrum/app/mobile/checkForUpdate ✨ Capacitor-updater: Auto-update parameters: InfoObject(platform: Optional("ios"), device_id: Optional("92FDB34A-3D6B-4695-8F06-926F5B4E2BED"), app_id: Optional("com.wealthspectrum.wealth.portal"), custom_id: Optional(""), version_build: Optional("24.3"), version_code: Optional("9"), version_os: Optional("17.0.1"), version_name: Optional("builtin"), plugin_version: Optional("5.7.14"), is_emulator: Optional(true), is_prod: Optional(false), action: nil, channel: nil, defaultChannel: Optional("")) ⚡️ [log] - Application resumed : 1711634133899 ⚡️ [log] - vault kept unlocked ✨ Capacitor-updater: Stats sent for app_moved_to_foreground, version builtin ✨ Capacitor-updater: New bundle: 24.3.2 found. Current is: builtin. Update will occur next time app moves to background. ✨ Capacitor-updater: list File : /Users/appliedm1/Library/Developer/CoreSimulator/Devices/2FC07F16-5D1D-4461-B417-9E742CFF46E5/data/Containers/Data/Application/75163DDB-5940-4142-BA31-410B92BA2A8D/Documents/versions ✨ Capacitor-updater: Storing info for bundle [0Ur9YqzhTw] { "id": "0Ur9YqzhTw", "version": "24.3.2", "downloaded": "2024-03-28T13:55:42.480Z", "checksum": "", "status": "downloading"} ✨ Capacitor-updater: Stats sent for download_0, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_10, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_10, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_20, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_20, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_30, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_40, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_40, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_50, version 24.3.2 ✨ Capacitor-updater: Stats sent for download_50, version 24.3.2 ✨ Capacitor-updater: Cannot found privateKey or sessionKey ✨ Capacitor-updater: Stats sent for download_60, version 24.3.2 Simultaneous accesses to 0x600000bd55d0, but modification requires exclusive access. Previous access (a modification) started at CapgoCapacitorUpdater`CapacitorUpdater.saveDownloaded(sourceZip:id:base:) + 1544 (0x1064255e4). Current access (a modification) started at: 0 libswiftCore.dylib 0x0000000107b8117c swift::runtime::AccessSet::insert(swift::runtime::Access, void, void*, swift::ExclusivityFlags) + 428 1 libswiftCore.dylib 0x0000000107b81390 swift_beginAccess + 72 2 CapgoCapacitorUpdater 0x0000000106425c6c closure #1 in CapacitorUpdater.saveDownloaded(sourceZip:id:base:) + 284 3 CapgoCapacitorUpdater 0x000000010643df30 partial apply for closure #1 in CapacitorUpdater.saveDownloaded(sourceZip:id:base:) + 156 4 CapgoCapacitorUpdater 0x0000000106425ddc thunk for @escaping @callee_guaranteed (@guaranteed String, @unowned unz_file_info_s, @unowned Int, @unowned Int) -> () + 224 5 SSZipArchive 0x0000000105f4aebc +[SSZipArchive unzipFileAtPath:toDestination:preserveAttributes:overwrite:nestedZipLevel:password:error:delegate:progressHandler:completionHandler:] + 7020 6 CapgoCapacitorUpdater 0x0000000106424fdc CapacitorUpdater.saveDownloaded(sourceZip:id:base:) + 1660 7 CapgoCapacitorUpdater 0x0000000106429d34 closure #3 in CapacitorUpdater.download(url:version:sessionKey:) + 1596 8 CapgoCapacitorUpdater 0x000000010642aea4 partial apply for closure #3 in CapacitorUpdater.download(url:version:sessionKey:) + 72 9 Alamofire 0x00000001060194e0 closure #1 in closure #1 in closure #3 in closure #1 in DownloadRequest._response(queue:responseSerializer:completionHandler:) + 124 10 Alamofire 0x0000000105fb0228 thunk for @escaping @callee_guaranteed @sendable () -> () + 48 11 libdispatch.dylib 0x00000001081fc0d8 _dispatch_call_block_and_release + 24 12 libdispatch.dylib 0x00000001081fd92c _dispatch_client_callout + 16 13 libdispatch.dylib 0x0000000108211348 _dispatch_root_queue_drain + 940 14 libdispatch.dylib 0x0000000108211f68 _dispatch_worker_thread2 + 256 15 libsystem_pthread.dylib 0x0000000108d2b808 _pthread_wqthread + 224 16 libsystem_pthread.dylib 0x0000000108d2a6dc start_wqthread + 8
Found this is working fine on latest version.
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/memorysafety/
Example to avoid call twins It works for me but i don't know any side-effect to change like this.
private func saveDownloaded(sourceZip: URL, id: String, base: URL) throws { ..... DispatchQueue.main.async { var unzipError1 = unzipError self.unzipProgressHandler(entry: entry, zipInfo: zipInfo, entryNumber: entryNumber, total: total, destUnZip: destUnZip, id: id, newUnzipError: &unzipError1) } ...... }
private func unzipProgressHandler(entry: String, zipInfo: unz_file_info, entryNumber: Int, total: Int, destUnZip: URL, id: String, newUnzipError: inout NSError?) {
and change unzipError to newUnzipError
Find SSZipArchive
...... if (progressHandler1) { progressHandler1(strPath, fileInfo, currentFileNumber, globalInfo.number_entry); } } } while (ret == UNZ_OK && success);
// Close
unzClose(zip);
........
The code throwing the issue has been changed in the latest version and at least for us the version ^5.9.2
seems to work on iOS
Bug Report
Capacitor Version
Plugin Version
context(s)
Platform(s)
iOS - iphone and simulators
Current Behavior
While downloading the app crashes at 75% of download and xcode pause at the this code block `private func saveDownloaded(sourceZip: URL, id: String, base: URL) throws { try prepareFolder(source: base) let destHot: URL = base.appendingPathComponent(id) let destUnZip: URL = documentsDir.appendingPathComponent(randomString(length: 10))
`![image](https://github.com/Cap-go/capacitor-updater/assets/47338132/6233d13a-09de-4184-9e52-55a3ec77ba7c)
Expected Behavior
Download zip file without crashing
Code Reproduction
`
const appUpdate = await CapacitorUpdater.download({ url: 'https://github.com/ehiosunbishop/live-update-testerx/raw/main/www.zip', version });
`![image](https://github.com/Cap-go/capacitor-updater/assets/47338132/34d0f0dc-37e3-4a6d-a1a5-d9b56b5ee74a)