Getting EXC_BAD_ACCESS from WebThread

2,577 views
Skip to first unread message

aquadoll

unread,
Dec 8, 2012, 3:01:55 AM12/8/12
to phon...@googlegroups.com
I am working on a Phonegap plugin which accesses a sqlite database (it is similar to phonegap-sqlite plugin, but not same). While porting the plugin to iOS and trying to run on iPhone simulator, I am getting a crash. Here are some more information:

- iPhone 6.0 simulator, Xcode 4.5
- The first page of the app shows up fine - this page has some file handling using phonegap File object. The second page opens a database and reads a few information. I have debugged and the select statements seem to work fine, in fact, my page shows up fine on the simulator as it should be, but then I get this crash in the debugger.
- Here is the output from lldb bt:
<<

(lldb) bt

* thread #5: tid = 0x2703, 0x0267209f libobjc.A.dylib`objc_msgSend + 19, stop reason = EXC_BAD_ACCESS (code=2, address=0x0)

    frame #0: 0x0267209f libobjc.A.dylib`objc_msgSend + 19

    frame #1: 0x011f6cf3 Foundation`-[__NSOperationInternal dealloc] + 142

    frame #2: 0x011f6c21 Foundation`-[__NSOperationInternal release] + 90

    frame #3: 0x011f6bab Foundation`-[NSOperation dealloc] + 144

    frame #4: 0x08f25efb DataDetectorsUI`-[DDOperation dealloc] + 387

    frame #5: 0x0127ee9a Foundation`-[NSOperation release] + 164

    frame #6: 0x026730c3 libobjc.A.dylib`objc_release + 51

    frame #7: 0x08f21eac DataDetectorsUI`__destroy_helper_block_59 + 28

    frame #8: 0x02bd6808 libsystem_sim_blocks.dylib`_Block_release + 198

    frame #9: 0x047ebcca WebCore`HandleRunSource + 586

    frame #10: 0x000d8f3f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15

    frame #11: 0x000d896f CoreFoundation`__CFRunLoopDoSources0 + 239

    frame #12: 0x000fb734 CoreFoundation`__CFRunLoopRun + 964

    frame #13: 0x000faf44 CoreFoundation`CFRunLoopRunSpecific + 276

    frame #14: 0x000fae1b CoreFoundation`CFRunLoopRunInMode + 123

    frame #15: 0x047eb310 WebCore`RunWebThread(void*) + 608

    frame #16: 0x9ceb3ed9 libsystem_c.dylib`_pthread_start + 335

>>

- Here is the output from the log file:
<<
Crashed Thread:  2  WebThread

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000008

VM Regions Near 0x8:
--> __PAGEZERO             0000000000000000-0000000000001000 [    4K] ---/--- SM=NUL  /Users/USER/Library/Application Support/iPhone Simulator/*/<AppName>.app/<AppName>
    __TEXT                 0000000000001000-000000000008a000 [  548K] r-x/rwx SM=COW  /Users/USER/Library/Application Support/iPhone Simulator/*/<AppName>.app/<AppName>

Application Specific Information:
objc_msgSend() selector name: countByEnumeratingWithState:objects:count:
iPhone Simulator 358.4, iPhone OS 6.0 (iPhone/10A403)

Thread 2 Crashed:: WebThread
0   libobjc.A.dylib               0x0267209b objc_msgSend + 15
1   Foundation                     0x011f6cf3 -[__NSOperationInternal dealloc] + 142
2   Foundation                     0x011f6c21 -[__NSOperationInternal release] + 90
3   Foundation                     0x011f6bab -[NSOperation dealloc] + 144
4   DataDetectorsUI               0x08f25efb -[DDOperation dealloc] + 387
5   Foundation                     0x0127ee9a -[NSOperation release] + 164
6   libobjc.A.dylib               0x026730c3 objc_release + 51
7   DataDetectorsUI               0x08f21eac __destroy_helper_block_59 + 28
8   libsystem_sim_blocks.dylib     0x02bd6808 _Block_release + 198
9   WebCore                       0x047ebcca HandleRunSource + 586
10  CoreFoundation                 0x000d8f3f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
11  CoreFoundation                 0x000d896f __CFRunLoopDoSources0 + 239
12  CoreFoundation                 0x000fb734 __CFRunLoopRun + 964
13  CoreFoundation                 0x000faf44 CFRunLoopRunSpecific + 276
14  CoreFoundation                 0x000fae1b CFRunLoopRunInMode + 123
15  WebCore                       0x047eb310 _ZL12RunWebThreadPv + 608
16  libsystem_c.dylib             0x9ceb3ed9 _pthread_start + 335
17  libsystem_c.dylib             0x9ceb76de thread_start + 34

>>

Any clue about where to look for issues? Seems like the WebThread is trying to release and deallocate something which is nonexistent.

Thanks for any pointers.
Regards.

aquadoll

unread,
Dec 9, 2012, 12:13:30 AM12/9/12
to phon...@googlegroups.com
Wanted to add: using phonegap 2.2.

aquadoll

unread,
Dec 9, 2012, 1:16:15 AM12/9/12
to phon...@googlegroups.com
Ok - resolved this.
- Following Shazron's advice on another similar thread, turned on zombies.
  See: http://stackoverflow.com/questions/2190227/how-do-i-set-up-nszombieenabled-in-xcode-4
- zombies gave the following message:
  [__NSArrayM release]: message sent to deallocated instance 0x72ab440 and the offending line is in <App> > Other Sources > main.m, where this is getting released from autoreleasepool.
- In my code, I had exactly one instance of me executing an array release statement (I thought it was smart !!). Took it off.
- Problem solved.
Reply all
Reply to author
Forward
0 new messages