{"action":"created","issue":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/853","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/853/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/853/comments","events_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/853/events","html_url":"https://github.com/couchbase/couchbase-lite-ios/issues/853","id":100056280,"number":853,"title":"ForestDB: Crash after inserting large number of documents","user":{"login":"pahmed","id":5355138,"avatar_url":"https://avatars.githubusercontent.com/u/5355138?v=3","gravatar_id":"","url":"https://api.github.com/users/pahmed","html_url":"https://github.com/pahmed","followers_url":"https://api.github.com/users/pahmed/followers","following_url":"https://api.github.com/users/pahmed/following{/other_user}","gists_url":"https://api.github.com/users/pahmed/gists{/gist_id}","starred_url":"https://api.github.com/users/pahmed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pahmed/subscriptions","organizations_url":"https://api.github.com/users/pahmed/orgs","repos_url":"https://api.github.com/users/pahmed/repos","events_url":"https://api.github.com/users/pahmed/events{/privacy}","received_events_url":"https://api.github.com/users/pahmed/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/crash!","name":"crash!","color":"e11d21"},{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/forestdb","name":"forestdb","color":"009800"},{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/needsmoreinfo","name":"needsmoreinfo","color":"0052cc"},{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/ready","name":"ready","color":"ededed"},{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/size-large","name":"size-large","color":"f7c6c7"},{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/testneeded","name":"testneeded","color":"006b75"}],"state":"open","locked":false,"assignee":{"login":"pasin","id":801454,"avatar_url":"https://avatars.githubusercontent.com/u/801454?v=3","gravatar_id":"","url":"https://api.github.com/users/pasin","html_url":"https://github.com/pasin","followers_url":"https://api.github.com/users/pasin/followers","following_url":"https://api.github.com/users/pasin/following{/other_user}","gists_url":"https://api.github.com/users/pasin/gists{/gist_id}","starred_url":"https://api.github.com/users/pasin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pasin/subscriptions","organizations_url":"https://api.github.com/users/pasin/orgs","repos_url":"https://api.github.com/users/pasin/repos","events_url":"https://api.github.com/users/pasin/events{/privacy}","received_events_url":"https://api.github.com/users/pasin/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/milestones/13","html_url":"https://github.com/couchbase/couchbase-lite-ios/milestones/1.2","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/milestones/13/labels","id":873603,"number":13,"title":"1.2","description":"Feature release, incorporating ForestDB storage engine","creator":{"login":"snej","id":43241,"avatar_url":"https://avatars.githubusercontent.com/u/43241?v=3","gravatar_id":"","url":"https://api.github.com/users/snej","html_url":"https://github.com/snej","followers_url":"https://api.github.com/users/snej/followers","following_url":"https://api.github.com/users/snej/following{/other_user}","gists_url":"https://api.github.com/users/snej/gists{/gist_id}","starred_url":"https://api.github.com/users/snej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snej/subscriptions","organizations_url":"https://api.github.com/users/snej/orgs","repos_url":"https://api.github.com/users/snej/repos","events_url":"https://api.github.com/users/snej/events{/privacy}","received_events_url":"https://api.github.com/users/snej/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":45,"state":"open","created_at":"2014-11-20T01:04:30Z","updated_at":"2015-08-17T20:38:19Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-08-10T12:54:04Z","updated_at":"2015-08-18T18:41:25Z","closed_at":null,"body":"I've found an issue where the app consistently crashes after inserting large number of documents (around 1700), i also noticed that right before the crash i receive one memory warning message.\r\nI'm using CBL 1.1.0 with ForestDB\r\n\r\nThis is the backtrace.\r\n```\r\n* thread #17: tid = 0xc2c80, 0x0096df3c *****`fdb_get(handle=0x217c6f78, doc=0x047fd31c) + 136 at forestdb.cc:2026, name = 'CouchbaseLite', stop reason = EXC_BAD_ACCESS (code=1, address=0x217c6f7c)\r\n  * frame #0: 0x0096df3c *****`fdb_get(handle=0x217c6f78, doc=0x047fd31c) + 136 at forestdb.cc:2026\r\n    frame #1: 0x0094cf28 *****`forestdb::KeyStore::read(this=<unavailable>, doc=<unavailable>, options=<unavailable>) const + 52 at KeyStore.cc:71\r\n    frame #2: 0x0094ceac *****`forestdb::KeyStore::get(this=<unavailable>, options=<unavailable>, key=<unavailable>) const + 100 at KeyStore.cc:52\r\n    frame #3: 0x00959e92 *****`forestdb::IndexWriter::getKeysForDoc(this=<unavailable>, keys=0x047fd4e4, hash=<unavailable>, docID=<unavailable>) + 46 at Index.cc:48\r\n    frame #4: 0x0095a18a *****`forestdb::IndexWriter::update(this=0x047fd644, keys=vector<forestdb::Collatable, std::__1::allocator<forestdb::Collatable> > at 0x047fd638, values=vector<forestdb::Collatable, std::__1::allocator<forestdb::Collatable> > at 0x047fd62c, rowCount=0x104bcf00, docID=<unavailable>, docSequence=<unavailable>) + 162 at Index.cc:82\r\n    frame #5: 0x00951404 *****`forestdb::MapReduceIndex::updateDocInIndex(this=<unavailable>, t=<unavailable>, mappable=<unavailable>) + 308 at MapReduceIndex.cc:227\r\n    frame #6: 0x009519ea *****`forestdb::MapReduceIndexer::addMappable(forestdb::Mappable const&) [inlined] forestdb::MapReduceIndexer::updateDocInIndex(this=<unavailable>, i=<unavailable>) + 94 at MapReduceIndex.hh:136\r\n    frame #7: 0x009519ac *****`forestdb::MapReduceIndexer::addMappable(this=0x047fda30, mappable=0x047fd744) + 32 at MapReduceIndex.cc:299\r\n    frame #8: 0x00949052 *****`CocoaIndexer::addDocument(this=<unavailable>, cppDoc=<unavailable>) + 498 at CBL_ForestDBViewStorage.mm:97\r\n    frame #9: 0x0095172a *****`forestdb::MapReduceIndexer::run(this=<unavailable>) + 414 at MapReduceIndex.cc:274\r\n    frame #10: 0x009447ae *****`__41-[CBL_ForestDBViewStorage updateIndexes:]_block_invoke(.block_descriptor=0x047fdc98) + 794 at CBL_ForestDBViewStorage.mm:445\r\n    frame #11: 0x0093aca4 *****`-[CBL_ForestDBStorage _try:](block=<unavailable>, self=<unavailable>, _cmd=<unavailable>) + 92 at CBL_ForestDBStorage.mm:193\r\n    frame #12: 0x009442aa *****`-[CBL_ForestDBViewStorage updateIndexes:](self=<unavailable>, views=<unavailable>, _cmd=<unavailable>) + 202 at CBL_ForestDBViewStorage.mm:419\r\n    frame #13: 0x007d7924 *****`-[CBLView updateIndexes:](self=<unavailable>, _cmd=<unavailable>, views=<unavailable>) + 76 at CBLView.m:304\r\n    frame #14: 0x007d7888 *****`-[CBLView updateIndex](self=<unavailable>, _cmd=<unavailable>) + 52 at CBLView.m:293\r\n    frame #15: 0x007f020c *****`-[CBLDatabase(self=<unavailable>, _cmd=<unavailable>, viewName=<unavailable>, options=<unavailable>, ifChangedSince=1967, outLastSequence=<unavailable>, outStatus=<unavailable>) queryViewNamed:options:ifChangedSince:lastSequence:status:] + 392 at CBLQuery.m:491\r\n    frame #16: 0x007eedd0 *****`__46-[CBLQuery runAsyncIfChangedSince:onComplete:]_block_invoke(.block_descriptor=0x1ea72f70, bgdb=<unavailable>) + 72 at CBLQuery.m:246\r\n    frame #17: 0x007c6326 *****`__35-[CBL_Server tellDatabaseNamed:to:]_block_invoke(.block_descriptor=<unavailable>) + 58 at CBL_Server.m:132\r\n    frame #18: 0x2894f5ce Foundation`__NSThreadPerformPerform + 386\r\n    frame #19: 0x27bd5fae CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14\r\n    frame #20: 0x27bd53be CoreFoundation`__CFRunLoopDoSources0 + 218\r\n    frame #21: 0x27bd3a24 CoreFoundation`__CFRunLoopRun + 772\r\n    frame #22: 0x27b20200 CoreFoundation`CFRunLoopRunSpecific + 476\r\n    frame #23: 0x27b20012 CoreFoundation`CFRunLoopRunInMode + 106\r\n    frame #24: 0x2888a13c Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 264\r\n    frame #25: 0x007c6130 *****`-[CBL_Server runServerThread](self=<unavailable>, _cmd=<unavailable>) + 312 at CBL_Server.m:113\r\n    frame #26: 0x2894f3ba Foundation`__NSThread__main__ + 1118\r\n    frame #27: 0x369ade22 libsystem_pthread.dylib`_pthread_body + 138\r\n    frame #28: 0x369add96 libsystem_pthread.dylib`_pthread_start + 118\r\n    frame #29: 0x369abb20 libsystem_pthread.dylib`thread_start + 8\r\n```"},"comment":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/comments/132313551","html_url":"https://github.com/couchbase/couchbase-lite-ios/issues/853#issuecomment-132313551","issue_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/853","id":132313551,"user":{"login":"pasin","id":801454,"avatar_url":"https://avatars.githubusercontent.com/u/801454?v=3","gravatar_id":"","url":"https://api.github.com/users/pasin","html_url":"https://github.com/pasin","followers_url":"https://api.github.com/users/pasin/followers","following_url":"https://api.github.com/users/pasin/following{/other_user}","gists_url":"https://api.github.com/users/pasin/gists{/gist_id}","starred_url":"https://api.github.com/users/pasin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pasin/subscriptions","organizations_url":"https://api.github.com/users/pasin/orgs","repos_url":"https://api.github.com/users/pasin/repos","events_url":"https://api.github.com/users/pasin/events{/privacy}","received_events_url":"https://api.github.com/users/pasin/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T18:41:25Z","updated_at":"2015-08-18T18:41:25Z","body":"@pahmed could you provide more info about the document such as document size and document shape? Does each document inserted have attachments (if YES, what is the size of the attachment)? Thanks for reporting the issue anyway."}}