couchbase / couchbase-lite-ios

Lightweight, embedded, syncable NoSQL database engine for iOS and MacOS apps.
Apache License 2.0
1.63k stars 297 forks source link

Couchbase Lite 1.0.3 [CBLBatcher flushAll] crash #508

Closed sellingsolutions closed 10 years ago

sellingsolutions commented 10 years ago

This is a pretty common crash for us, I know you don't have much to go on but hopefully somebody else can chime in on what's actually going on.

http://pastebin.com/K0DZecjD screen shot 2014-10-29 at 14 55 19

snej commented 10 years ago
* thread #7: tid = 0xeca647, 0x046900b0 libobjc.A.dylib`objc_msgSend + 12, name = 'CouchbaseLite', stop reason = EXC_BAD_ACCESS (code=1, address=0x3)
    frame #0: 0x046900b0 libobjc.A.dylib`objc_msgSend + 12
    frame #1: 0x0056ce9b iSpect`-[CBLBatcher flushAll] + 163
    frame #2: 0x0055e0d0 iSpect`-[CBL_Puller stop] + 334

Looks like CBLBatcher messaging a freed object. I'm guessing the batcher's processor block (in the puller) released the batcher and caused it to be dealloced, so the next call to [self unschedule] crashed. The fix is probably to add a retain-myself hack at the start of the method.

snej commented 10 years ago

The fix is pretty simple and harmless, so I checked it in even without confirming it fixes the bug. If you don't want to update to master, you can just cherry-pick 18fa9e2 onto 1.0.3.1.