Start a new topic

K1.23.0 Offline hangs after queueing

I'm testing the new offline update of KinveyKit 1.23.0: saving, going offline, saving again. As soon as the first offline save is queued (didEnqueueObject is called), my app hangs in semaphore_wait_trap on the main thread.



Any idea what's causing this?



--------------------------------------- Thread 1 ---------------------------------------

#0 0x033b680a in semaphore_wait_trap ()

#1 0x02edbf08 in _dispatch_thread_semaphore_wait ()

#2 0x02ed9b3a in _dispatch_barrier_sync_f_slow ()

#3 0x02ed9a5c in dispatch_barrier_sync_f ()

#4 0x02ed9e5e in dispatch_sync ()

#5 0x00220761 in -[KCSObjectCache updateObject:entity:route:collection:collectionCache:] at /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSObjectCache.m:280

#6 0x00221551 in __80-[KCSObjectCache addUnsavedObject:entity:route:collection:method:headers:error:]_block_invoke at /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSObjectCache.m:345

#7 0x02eea014 in _dispatch_client_callout ()

#8 0x02ed9d5f in _dispatch_barrier_sync_f_invoke ()

#9 0x02ed9aa3 in dispatch_barrier_sync_f ()

#10 0x02ed9e5e in dispatch_sync ()

#11 0x002210bf in -[KCSObjectCache addUnsavedObject:entity:route:collection:method:headers:error:] at /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSObjectCache.m:328

#12 0x001e6fcd in __81-[KCSAppdataStore saveMainEntity:progress:withCompletionBlock:withProgressBlock:]_block_invoke473 at /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSAppdataStore.m:762

#13 0x001a6e94 in __50-[KCSAsyncConnection connection:didFailWithError:]_block_invoke at /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSAsyncConnection.m:308

#14 0x001a6af1 in -[KCSAsyncConnection runBlockInForeground:] at /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSAsyncConnection.m:281

#15 0x001a6b9b in -[KCSAsyncConnection connection:didFailWithError:] at /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSAsyncConnection.m:300

#16 0x02869a01 in __51-[NSURLConnectionInternal _withErrorForConnection:]_block_invoke_0 ()

#17 0x02869652 in __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0 ()

#18 0x0286a89a in -[NSURLConnectionInternalConnection invokeForDelegate:] ()

#19 0x0286960d in -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] ()

#20 0x02869978 in -[NSURLConnectionInternal _withErrorForConnection:] ()

#21 0x0286a298 in _NSURLConnectionDidFail ()

#22 0x00ebba5c in ___delegate_didFail_block_invoke_0 ()

#23 0x00ebabb3 in ___withDelegateAsync_block_invoke_0 ()

#24 0x00ef8cda in ___performAsync_block_invoke_068 ()

#25 0x034d58fd in CFArrayApplyFunction ()

#26 0x00ef935c in RunloopBlockContext::perform() ()

#27 0x00ef92d5 in non-virtual thunk to RunloopBlockContext::multiplexerClientPerform() ()

#28 0x00de3250 in MultiplexerSource::perform() ()

#29 0x034b6f3f in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()

#30 0x034b696f in __CFRunLoopDoSources0 ()

#31 0x034d9734 in __CFRunLoopRun ()

#32 0x034d8f44 in CFRunLoopRunSpecific ()

#33 0x034d8e1b in CFRunLoopRunInMode ()

#34 0x045da7e3 in GSEventRunModal ()

#35 0x045da668 in GSEventRun ()

#36 0x01ca9ffc in UIApplicationMain ()

#37 0x0000245d in main at /Users/igor/Documents/Application/Application/main.m:16

#38 0x0322a725 in start ()

--------------------------------------- Console ---------------------------------------

(-[SPAppDelegate application:didFinishLaunchingWithOptions:]) (SPAppDelegate.m:82) KCS_CONNECTION_TIMEOUT=10.000000

2013-12-04 15:50:50:351 /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSClient2+KCSInternal.m:29 [DEBUG (NETWORK)] Using app key/app secret for auth: (kid_TVuOAg5xrf, ) => XXXXXXXXX=

2013-12-04 15:50:50:356 /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSRequest2.m:200 [INFO (NETWORK)] GET https://baas.kinvey.com/appdata/kid_TVuOAg5xrf [KinveyKit id: '(null)']=

2013-12-04 15:50:50.379 Application[22499:c07] KinveyUser.m:1162 [DEBUG] Current user found (1@2, XXXXXXXXX) => XXXXXXXXX

2013-12-04 15:50:50:523 /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSNSURLRequestOperation.m:98 [INFO (NETWORK)] received response: 200 {

Connection = "keep-alive";

"Content-Length" = 58;

"Content-Type" = "application/json; charset=utf-8";

Date = "Wed, 04 Dec 2013 20:50:50 GMT";

Server = nginx;

"X-Kinvey-API-Version" = 3;

"X-Kinvey-Request-Id" = 22762447eae447dc951337834db86cb8;

"X-Powered-By" = Express;

}=

2013-12-04 15:50:50:679 /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSEntityPersistence.m:105 [ERROR (FILESYSTEM)] Err 0: not an error=

2013-12-04 15:50:50:705 /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSRequest2.m:308 [INFO (NETWORK)] Kinvey Success (200) [KinveyKit id: '(null)']=

2013-12-04 15:50:54.254 Application[22499:c07] KinveyUser.m:1159 [DEBUG] Current user found, using sessionauth (1@2) => XXXXXXXXX

2013-12-04 15:50:54:256 /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSRequest2.m:200 [INFO (NETWORK)] POST https://baas.kinvey.com/rpc/kid_TVuOAg5xrf/custom/cpModuleTemplate [KinveyKit id: '(null)']=

2013-12-04 15:50:54:800 /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSNSURLRequestOperation.m:98 [INFO (NETWORK)] received response: 200 {

Connection = "keep-alive";

"Content-Length" = 174;

"Content-Type" = "application/json; charset=utf-8";

Date = "Wed, 04 Dec 2013 20:50:54 GMT";

Server = nginx;

"x-kinvey-api-version" = 3;

"x-kinvey-request-id" = 194c458293c649f38f556e23d344713e;

"x-powered-by" = Express;

}=

2013-12-04 15:50:54:803 /Users/mike/work/ios-library/tags/1.23.0/KinveyKit/KinveyKit/Source/KCSRequest2.m:308 [INFO (NETWORK)] Kinvey Success (200) [KinveyKit id: '(null)']=

2013-12-04 15:50:54.805 Application[22499:c07] KCSQuery.m:793 [DEBUG] query: ?query=%7B%22module%22%3A%7B%22%24in%22%3A%5B%22FFFF%22%5D%7D%7D

2013-12-04 15:50:54.806 Application[22499:c07] KinveyUser.m:1159 [DEBUG] Current user found, using sessionauth (1@2) => XXXXXXXXX

2013-12-04 15:51:13.745 Application[22499:c07] KinveyUser.m:1159 [DEBUG] Current user found, using sessionauth (1@2) => XXXXXXXXX

2013-12-04 15:51:31.963 Application[22499:c07] KinveyUser.m:1159 [DEBUG] Current user found, using sessionauth (1@2) => XXXXXXXXX

2013-12-04 15:51:41.540 Application[22499:c07] KinveyUser.m:1159 [DEBUG] Current user found, using sessionauth (1@2) => XXXXXXXXX

2013-12-04 15:51:42.025 Application[22499:c07] KCSAsyncConnection.m:303 [ERROR] Connection failed! Error - The request timed out. https://baas.kinvey.com/appdata/APP_KEY/COLLECTION/529f95ae3bd733ff1900000b

(lldb)

--------------------------------------- Variables ---------------------------------------

self KCSObjectCache * 0xc244e30 0x0c244e30

NSObject NSObject

_preCalculatesResults BOOL YES '\x01'

_updatesLocalWithUnconfirmedSaves BOOL YES '\x01'

_offlineUpdateEnabled BOOL YES '\x01'

_dataModel KCSDataModel * 0xc248450 0x0c248450

_persistenceLayer KCSEntityPersistence * 0xc245150 0x0c245150

_offline KCSOfflineUpdate * 0xc2480b0 0x0c2480b0

NSObject NSObject

_useMock BOOL NO '\0'

_drainInProgress BOOL NO '\0'

_delegate SPObjectManager * 0xc244a50 0x0c244a50

_persitence KCSEntityPersistence * 0xc245150 0x0c245150

NSObject NSObject

_saveContext NSDictionary * nil 0x00000000

_persistenceId __NSCFConstantString * @"offline" 0x0095f97c

_db KCS_FMDatabase * 0xc245570 0x0c245570

NSObject NSObject

_db sqlite3 * 0xc245c10 0x0c245c10

_databasePath NSPathStore2 * 0xc2459e0 0x0c2459e0

_logsErrors BOOL '\0' '\0'

_crashOnErrors BOOL '\0' '\0'

_traceExecution BOOL '\0' '\0'

_checkedOut BOOL '\0' '\0'

_shouldCacheStatements BOOL '\0' '\0'

_isExecutingStatement BOOL '\0' '\0'

_inTransaction BOOL '\0' '\0'

_busyRetryTimeout int 0 0

_cachedStatements NSMutableDictionary * nil 0x00000000

_openResultSets __NSSetM * 0xc245ba0 0x0c245ba0

_openFunctions NSMutableSet * nil 0x00000000

_dateFormat NSDateFormatter * nil 0x00000000

_jsonWriter KCS_SBJsonWriter * 0xc245190 0x0c245190

_jsonParser KCS_SBJsonParser * 0xc2451c0 0x0c2451c0

_cache KCSObjectCache * 0xc244e30 0x0c244e30

_caches __NSDictionaryM * 0xc2482f0 0x0c2482f0

_queryCache NSCache * 0xc2485a0 0x0c2485a0

_cacheQueue dispatch_queue_t 0xc244e80 0x0c244e80


Thanks, I was able to get your email. Anyway this is a bug in 1.23.0 and I will work on a fix.
Michael,



My mail to support@kinvey.com bounced back, but here is my test situation: I've updated the gitHub master to KinveyKit 1.23.0, set up an offline delegate on KCSClient and the store to use KCSStoreKeyOfflineUpdateEnable:@YES. Saving while offline seems to hang as soon as the object in queue is modified.



Am I doing something wrong with this delegate in ViewController.m?



[[KCSClient sharedClient] setOfflineDelegate: (id) self];

HI Igor,



Not sure what is going on here. Can you create a simple app that reproduces this? If so can you send the code and full logs to support@kinvey.com?
Login or Signup to post a comment