omorandi / tiws

a very simple Titanium module (iOS / Android) for creating native websockets
131 stars 63 forks source link

Crash on app resume #3

Closed allenhartwig closed 11 years ago

allenhartwig commented 11 years ago

I'm getting an app crash when the app is resumed. Wasn't getting this before I added the module. I'm using the socket.io implementation of the module (v0.9.10). The error on SRWebSocket.m:591 makes me believe that its this module causing the issue. I have no resume/resumed event utilizing the socket. I'm running the .3 version from the Appc Market.

Any ideas?

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x40000010
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x3b450536 objc_retain + 6
1   Here On Biz                     0x00266d5a __block_global_1 (SRWebSocket.m:591)
2   libdispatch.dylib               0x3b86d790 _dispatch_call_block_and_release + 8
3   libdispatch.dylib               0x3b86d5d8 _dispatch_client_callout + 20
4   libdispatch.dylib               0x3b870e40 _dispatch_main_queue_callback_4CF + 224
5   CoreFoundation                  0x337361ac __CFRunLoopRun + 1284
6   CoreFoundation                  0x336a9238 CFRunLoopRunSpecific + 352
7   CoreFoundation                  0x336a90c4 CFRunLoopRunInMode + 100
8   GraphicsServices                0x37287336 GSEventRunModal + 70
9   UIKit                           0x355c52b4 UIApplicationMain + 1116
10  Here On Biz                     0x000b2ea2 main (main.m:36)
11  Here On Biz                     0x000b249c start + 36
allenhartwig commented 11 years ago

I should add that this doesn't happen every time the app is resumed, nor have I been able to setup a reliable/consistent recreation of the crash, however, I have noticed it a handful of times on the resume event.

allenhartwig commented 11 years ago

Could potentially be related to this issue: https://github.com/square/SocketRocket/issues/62

iamyellow commented 11 years ago

Are you correctly closing the socket / opening it when pause / resume? I'm very sorry, but recently I've decided to not develop my apps w/ Titanium and probably I won't update none of my modules...

allenhartwig commented 11 years ago

I think I fixed it. I had a setInterval running that was checking if the socket was connected, and if not, reconnecting it. However, I was referring to socket.socket.connected and I think the socket object was sometimes garbage collected in the background and had to be completely recreated.

Out of curiosity, what did you switch to for your app dev environment?

iamyellow commented 11 years ago

glad to read it's solved somehow. after years with titanium, I don't like where AppC is focusing... plus the lack of important core updates, parity android <> ios, serious bugs, etc. honestly, i'm devolping faster in objc+java then titanium... since I got absolute control, performance and not those things I mentioned.

cendrizzi commented 11 years ago

This is disappointing to hear, but whatever works best I guess. I was a big fan of this particular module. Hope someone else can pick it up.