iPhone client: data handling bug.

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

iPhone client: data handling bug.

Postby mmilen » 17 Feb 2011, 11:51

Hi,

As usual running the very latest server RC1b2 and the latest iPhone client.
I have received this bug crash report a bunch of times from clients:




Incident Identifier: F7E6B7CD-2251-4E37-8E9E-CCB2ACC5D359
Hardware Model: iPhone2,1
Process: iBridgeBaron [1403]
Path: /var/mobile/Applications/7D67096D-F07B-41E3-B367-6304086B04D1/iBridgeBaron.app/iBridgeBaron
Identifier: iBridgeBaron
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]

Date/Time: 2011-02-03 21:30:09.951 +0800
OS Version: iPhone OS 4.2.1 (8C148a)
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0

Thread 0 Crashed:
0 libSystem.B.dylib 0x311de2d4 __kill + 8
1 libSystem.B.dylib 0x311de2c4 *_kill
2 libSystem.B.dylib 0x311de2b6 raise
3 libSystem.B.dylib 0x311f2d72 abort
4 libstdc++.6.dylib 0x301dea20 __gnu_cxx::__verbose_terminate_handler() + 376
5 libobjc.A.dylib 0x319a2594 _objc_terminate
6 libstdc++.6.dylib 0x301dcdf2 __cxxabiv1::__terminate(void (*)()) + 46
7 libstdc++.6.dylib 0x301dce46 std::terminate() + 10
8 libstdc++.6.dylib 0x301dcf16 __cxa_throw + 78
9 libobjc.A.dylib 0x319a14c4 objc_exception_throw
10 CoreFoundation 0x314d07c2 +[NSException raise:format:arguments:]
11 CoreFoundation 0x314d07fc +[NSException raise:format:]
12 Foundation 0x31cc8a4a -[NSConcreteData initWithBytes:length:copy:freeWhenDone:bytesAreVM:]
13 Foundation 0x31cd583e -[NSData(NSData) initWithBytes:length:]
14 Foundation 0x31ce8248 +[NSData(NSData) dataWithBytes:length:]
15 iBridgeBaron 0x0045ccd4 -[BitSwarmClient stream:handleEvent:] + 1632
16 CoreFoundation 0x314b240e _inputStreamCallbackFunc
17 CoreFoundation 0x31490f6a _signalEventSync
18 CoreFoundation 0x31491842 _cfstream_solo_signalEventSync
19 CoreFoundation 0x3148e7ee _CFStreamSignalEvent
20 CoreFoundation 0x3148e6a0 CFReadStreamSignalEvent
21 CFNetwork 0x346c5cb0 SocketStream::dispatchSignalFromSocketCallbackUnlocked(SocketStreamSignalHolder*)
22 CFNetwork 0x3465341c SocketStream::socketCallback(__CFSocket*, unsigned long, __CFData const*, void const*)
23 CFNetwork 0x3465339e SocketStream::_SocketCallBack_stream(__CFSocket*, unsigned long, __CFData const*, void const*, void*)
24 CoreFoundation 0x31490c96 __CFSocketDoCallback
25 CoreFoundation 0x314909aa __CFSocketPerformV0
26 CoreFoundation 0x314867d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
27 CoreFoundation 0x314584f4 __CFRunLoopDoSources0
28 CoreFoundation 0x31457e54 __CFRunLoopRun
29 CoreFoundation 0x31457c80 CFRunLoopRunSpecific
30 CoreFoundation 0x31457b88 CFRunLoopRunInMode
31 GraphicsServices 0x35d664a4 GSEventRunModal
32 GraphicsServices 0x35d66550 GSEventRun
33 UIKit 0x338d5322 -[UIApplication _run]
34 UIKit 0x338d2e8c UIApplicationMain
35 iBridgeBaron 0x00024380 main + 64
36 iBridgeBaron 0x00024334 start + 32

Thread 1:
0 libSystem.B.dylib 0x31192974 kevent + 24
1 libSystem.B.dylib 0x3123c704 _dispatch_mgr_invoke
2 libSystem.B.dylib 0x3123c174 _dispatch_queue_invoke
3 libSystem.B.dylib 0x3123bb98 _dispatch_worker_thread2
4 libSystem.B.dylib 0x311e024a _pthread_wqthread
5 libSystem.B.dylib 0x311d8970 start_wqthread + 0

Thread 2:
0 libSystem.B.dylib 0x311662c4 semaphore_wait_signal_trap + 8
1 libSystem.B.dylib 0x31193b3a semaphore_wait_signal
2 libSystem.B.dylib 0x311680d0 pthread_mutex_lock
3 WebCore 0x33ced79c _WebTryThreadLock(bool) + 24
4 WebCore 0x33cedc46 WebRunLoopLock
5 CoreFoundation 0x31460c52 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
6 CoreFoundation 0x31460ac6 __CFRunLoopDoObservers
7 CoreFoundation 0x314580d0 __CFRunLoopRun
8 CoreFoundation 0x31457c80 CFRunLoopRunSpecific
9 CoreFoundation 0x31457b88 CFRunLoopRunInMode
10 WebCore 0x33d9f124 RunWebThread
11 libSystem.B.dylib 0x311df886 _pthread_start
12 libSystem.B.dylib 0x311d4a88 thread_start + 0

Thread 3:
0 libSystem.B.dylib 0x3118a68c select$DARWIN_EXTSN + 20
1 CoreFoundation 0x3148f662 __CFSocketManager
2 libSystem.B.dylib 0x311df886 _pthread_start
3 libSystem.B.dylib 0x311d4a88 thread_start + 0

Thread 4:
0 libSystem.B.dylib 0x311e09e0 __workq_kernreturn + 8
1 libSystem.B.dylib 0x311e0364 _pthread_wqthread
2 libSystem.B.dylib 0x311d8970 start_wqthread + 0

Thread 5:
0 libSystem.B.dylib 0x311e09e0 __workq_kernreturn + 8
1 libSystem.B.dylib 0x311e0364 _pthread_wqthread
2 libSystem.B.dylib 0x311d8970 start_wqthread + 0

Thread 0 crashed with ARM Thread State:
r0: 0x00000000 r1: 0x00000000 r2: 0x00000001 r3: 0x3e1a82e8
r4: 0x00000006 r5: 0x301dc989 r6: 0x019eb34c r7: 0x2fdfe490
r8: 0x00000001 r9: 0x00000065 r10: 0x2fdfe764 r11: 0x3e20e438
ip: 0x00000025 sp: 0x2fdfe490 lr: 0x311de2cb pc: 0x311de2d4
cpsr: 0x000f0010

Binary Images:
0x1000 - 0x50cfff +iBridgeBaron armv7 <11f8ecb8396e5ce525bfeafac2269ef3> /var/mobile/Applications/7D67096D-F07B-41E3-B367-6304086B04D1/iBridgeBaron.app/iBridgeBaron
0xd55000 - 0xd56fff dns.so armv7 <fcefecb2d5e095ba88127eec3af57ec0> /usr/lib/info/dns.so
0x2fe00000 - 0x2fe27fff dyld armv7 <06e6959cebb4a72e66c833e26ae64d26> /usr/lib/dyld
0x30122000 - 0x30177fff libvDSP.dylib armv7 <9365fc6cae1bff737257e74faf3b1f26> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib
0x3019a000 - 0x301e4fff libstdc++.6.dylib armv7 <53a6e7239c3908fa8c2915b65ff3b056> /usr/lib/libstdc++.6.dylib
0x3024e000 - 0x302fdfff WebKit armv7 <644a1c6120578f896bed7121307aa2af> /System/Library/PrivateFrameworks/WebKit.framework/WebKit
0x30319000 - 0x30320fff libbz2.1.0.dylib armv7 <2989ea7a5cad2cfe91bd632b041d0ff4> /usr/lib/libbz2.1.0.dylib
0x30321000 - 0x30338fff TextInput_zh armv7 <5cd0e7696983d3d4dde8161de410b4d4> /System/Library/TextInput/TextInput_zh.bundle/TextInput_zh
0x3033c000 - 0x30429fff libiconv.2.dylib armv7 <c72b45f471df092dbd849081f7a3ef53> /usr/lib/libiconv.2.dylib
0x30569000 - 0x3056afff CoreSurface armv7 <f7caaf43609cfe0e475dfe83790edb4d> /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface
0x30746000 - 0x3074ffff CoreVideo armv7 <2092d5deb6b234e04678b7c1878ccd81> /System/Library/Frameworks/CoreVideo.framework/CoreVideo
0x30750000 - 0x3075bfff libz.1.dylib armv7 <fabaddbcbc8c02bab0261df9d78e0e25> /usr/lib/libz.1.dylib
0x3075f000 - 0x30761fff MobileInstallation armv7 <8e6b0d9f642be06729ffdaaee97053b0> /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation
0x30792000 - 0x3079cfff AccountSettings armv7 <19c79f81d5d55fe2e6b618fcdc28258e> /System/Library/PrivateFrameworks/AccountSettings.framework/AccountSettings
0x3079d000 - 0x307a3fff liblockdown.dylib armv7 <5bbd9b3f5cfece328f80c403a8805ce9> /usr/lib/liblockdown.dylib
0x30853000 - 0x30854fff DataMigration armv7 <babbc72d4d48325de147d5103d7bc00d> /System/Library/PrivateFrameworks/DataMigration.framework/DataMigration
0x309e4000 - 0x30a16fff AppSupport armv7 <47c8055ac99f187174ca373b702ffa68> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x30a1d000 - 0x30a54fff Security armv7 <cd28e102950634ae7167ddee9c686d36> /System/Library/Frameworks/Security.framework/Security
0x30a5d000 - 0x30b0bfff QuartzCore armv7 <83a8e5f0033369e437069c1e758fed83> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x30b1c000 - 0x30c3cfff libmecabra.dylib armv7 <b2293b8acb00a14bace7520a63f39439> /usr/lib/libmecabra.dylib
0x30d46000 - 0x30d53fff DataDetectorsUI armv7 <a7e33ab2817110626fa1c5c731419101> /System/Library/PrivateFrameworks/DataDetectorsUI.framework/DataDetectorsUI
0x30d54000 - 0x30d61fff libbsm.0.dylib armv7 <0f4e595e6eb2170aceb729f32b5de8c2> /usr/lib/libbsm.0.dylib
0x30faf000 - 0x30feefff libGLImage.dylib armv7 <a7c117c92607a512823d307b8fdd0151> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
0x31020000 - 0x3102cfff SpringBoardServices armv7 <137b75e19b2450c234dec88d538798ff> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
0x31077000 - 0x3115ffff libGLProgrammability.dylib armv7 <1f478a71783cd7eb4ae9ef6f2dcea803> /System/Library/Frameworks/OpenGLES.framework/libGLProgrammability.dylib
0x31160000 - 0x31163fff IOSurface armv7 <deff02882166bf16d0765d68f0542cc8> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface
0x31165000 - 0x31276fff libSystem.B.dylib armv7 <138a43ab528bb428651e6aa7a2a7293c> /usr/lib/libSystem.B.dylib
0x31324000 - 0x31336fff PersistentConnection armv7 <cd2a699aa5036bdad0517603ba4db839> /System/Library/PrivateFrameworks/PersistentConnection.framework/PersistentConnection
0x31337000 - 0x31371fff IOKit armv7 <eb932cc42d60e55d9a4d0691bcc3d9ad> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x313a4000 - 0x313aafff StoreKit armv7 <f44ec361fe53962128632c6f3afd869b> /System/Library/Frameworks/StoreKit.framework/StoreKit
0x313fa000 - 0x3140dfff libmis.dylib armv7 <855aefc263c6c20e6cf8723ea36125a2> /usr/lib/libmis.dylib
0x31425000 - 0x31429fff AssetsLibraryServices armv7 <e861a330d14702f148ca5133dcbe954c> /System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices
0x31430000 - 0x31516fff CoreFoundation armv7 <01441e01f5141a50ee723362e59ca400> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x31517000 - 0x31519fff IOMobileFramebuffer armv7 <1040629f37795146c9dcac8ab1a868fc> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer
0x3151b000 - 0x3151efff CertUI armv7 <5f37446c6b65a8c38ab6233c2e33da66> /System/Library/PrivateFrameworks/CertUI.framework/CertUI
0x31549000 - 0x3154cfff CaptiveNetwork armv7 <a2af7147f5538d7669b14fa7b19b5a7c> /System/Library/PrivateFrameworks/CaptiveNetwork.framework/CaptiveNetwork
0x3155c000 - 0x3167cfff CoreGraphics armv7 <2d7b40a7baca915ce78b1dd9a0d6433b> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x31703000 - 0x31705fff libgcc_s.1.dylib armv7 <e66758bcda6da5d7f9b54fa5c4de6da2> /usr/lib/libgcc_s.1.dylib
0x317f9000 - 0x3183cfff ManagedConfiguration armv7 <27ac7f05482a8aa9977150f34f9be6eb> /System/Library/PrivateFrameworks/ManagedConfiguration.framework/ManagedConfiguration
0x3187b000 - 0x31991fff libicucore.A.dylib armv7 <e7fbb2ac586567e574dc33d7bb5c4dc9> /usr/lib/libicucore.A.dylib
0x3199c000 - 0x31a5dfff libobjc.A.dylib armv7 <aaf5671a35f9ac20d5846703dafaf4c6> /usr/lib/libobjc.A.dylib
0x31a7d000 - 0x31a8afff OpenGLES armv7 <a12565ffb5bb42e3019f1957cd4951d0> /System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x31ad8000 - 0x31adffff WebUI armv7 <e9fc60d6b8e995168dc82e16b0f226f4> /System/Library/PrivateFrameworks/WebUI.framework/WebUI
0x31ae0000 - 0x31ae3fff libGFXShared.dylib armv7 <3a385ed495379116abbe50bc8cd5a612> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
0x31b29000 - 0x31b52fff MobileCoreServices armv7 <54484a513761868149405df7fc29b5c0> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
0x31b58000 - 0x31b5ffff AggregateDictionary armv7 <71372c95d4af7af787d0682a939e40ac> /System/Library/PrivateFrameworks/AggregateDictionary.framework/AggregateDictionary
0x31bcc000 - 0x31be1fff libresolv.9.dylib armv7 <ea156820997ae9a2baf664d0f79f18d7> /usr/lib/libresolv.9.dylib
0x31cc4000 - 0x31de3fff Foundation armv7 <81d36041f04318cb51db5aafed9ce504> /System/Library/Frameworks/Foundation.framework/Foundation
0x31de4000 - 0x31e17fff QuickLook armv7 <8c54395accc7ffc84766ff3e9b24beb1> /System/Library/Frameworks/QuickLook.framework/QuickLook
0x31e18000 - 0x31e63fff libBLAS.dylib armv7 <251c5ac7380802a16e30d827c027c637> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib
0x31e64000 - 0x337ddfff TextInput armv7 <557601a7d93124fd5860606f294e900a> /System/Library/PrivateFrameworks/TextInput.framework/TextInput
0x33886000 - 0x3389cfff EAP8021X armv7 <36659ec2b9def7b5798a05327e369247> /System/Library/PrivateFrameworks/EAP8021X.framework/EAP8021X
0x3389e000 - 0x33c1ffff UIKit armv7 <de1cbd3219a74e4d41b30428f428e223> /System/Library/Frameworks/UIKit.framework/UIKit
0x33ce8000 - 0x342d0fff WebCore armv7 <d6bd9cf88ee82ab6b0e33e0ae1190772> /System/Library/PrivateFrameworks/WebCore.framework/WebCore
0x343e6000 - 0x34405fff Bom armv7 <0f5fd6057bad5e1677869500d636821f> /System/Library/PrivateFrameworks/Bom.framework/Bom
0x344ea000 - 0x34623fff AudioToolbox armv7 <657b327f2ceee9f22f9474f2f9bddbe6> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
0x34628000 - 0x34628fff Accelerate armv7 <29dd5f17440bbb6e8e42e11b6fceda9a> /System/Library/Frameworks/Accelerate.framework/Accelerate
0x34641000 - 0x34700fff CFNetwork armv7 <02fe0e30e54fffdcbbbd02e8cb812c3a> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x34941000 - 0x34944fff ApplePushService armv7 <9d1eb7b11f0f146c941efbab2c055606> /System/Library/PrivateFrameworks/ApplePushService.framework/ApplePushService
0x34952000 - 0x3495afff MobileWiFi armv7 <b29d4c5e300ef81060e38f72bb583c02> /System/Library/PrivateFrameworks/MobileWiFi.framework/MobileWiFi
0x3495b000 - 0x34bf5fff libLAPACK.dylib armv7 <2e77d87e96af938aacf0a6008e6fb89d> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib
0x34bf6000 - 0x34c36fff CoreAudio armv7 <f32e03ee4c68f0db23f05afc9a3cc94c> /System/Library/Frameworks/CoreAudio.framework/CoreAudio
0x34c4e000 - 0x34c86fff libCGFreetype.A.dylib armv7 <374bd566263e8929c10d50d6a6a48a46> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib
0x35336000 - 0x353dffff libxml2.2.dylib armv7 <b3d82f80a777cb1434052ea2d232e3df> /usr/lib/libxml2.2.dylib
0x353e1000 - 0x3548efff JavaScriptCore armv7 <3f2df600942dc72aad312b3cc98ec479> /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore
0x3549e000 - 0x354acfff DataDetectorsCore armv7 <31929ee8505b90fb51d269cd4763f2e8> /System/Library/PrivateFrameworks/DataDetectorsCore.framework/DataDetectorsCore
0x354b4000 - 0x354bcfff libkxld.dylib armv7 <854e82fe66feef01e54c7c8a209851ac> /usr/lib/system/libkxld.dylib
0x354d9000 - 0x354f9fff PrintKit armv7 <02a9c6f4173a0673c4637a3b570345cd> /System/Library/PrivateFrameworks/PrintKit.framework/PrintKit
0x354fa000 - 0x3553cfff CoreTelephony armv7 <96d3af505b9f2887e62c7e99c157733e> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
0x3553d000 - 0x3558afff libsqlite3.dylib armv7 <55038e5c1d4d0dbdd94295e8cad7a9a4> /usr/lib/libsqlite3.dylib
0x355b1000 - 0x35672fff RawCamera armv7 <b7f53a8a4a1188746c9c3d818f28795b> /System/Library/CoreServices/RawCamera.bundle/RawCamera
0x35a37000 - 0x35a3cfff MobileKeyBag armv7 <cec3f3271fc267c32c169ed03e312d63> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag
0x35a95000 - 0x35a95fff vecLib armv7 <e53d234e808c77d286161095f92c58cf> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib
0x35bac000 - 0x35bcbfff CoreHandwriting armv7 <c0000c776a7f7150118254109b40390e> /System/Library/PrivateFrameworks/CoreHandwriting.framework/CoreHandwriting
0x35bcc000 - 0x35bfbfff SystemConfiguration armv7 <3f982c11b5526fc39a92d585c60d8a90> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x35ca1000 - 0x35d10fff ProofReader armv7 <d2e62a8ab7e1460c7f6de8913c703e6d> /System/Library/PrivateFrameworks/ProofReader.framework/ProofReader
0x35d62000 - 0x35d6efff GraphicsServices armv7 <0099670dccd99466653956bf918d667a> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x35db1000 - 0x35e44fff ImageIO armv7 <5b5a294d4250eff866fdbf891b1e8b34> /System/Library/Frameworks/ImageIO.framework/ImageIO
0x35e52000 - 0x35e85fff AddressBook armv7 <7c87e0175c8649d6832419da8a1cfac1> /System/Library/Frameworks/AddressBook.framework/AddressBook
0x35f4a000 - 0x35f4ffff libMobileGestalt.dylib armv7 <5f73c7138ee1cb7103a98aec99f9ed88> /usr/lib/libMobileGestalt.dylib
0x35f86000 - 0x35fbcfff CoreText armv7 <b9b5c21b2d2a28abc47842c78c026ddf> /System/Library/Frameworks/CoreText.framework/CoreText
0x35fbd000 - 0x35fbffff libAccessibility.dylib armv7 <3f0b58ea13d30f0cdb73f6ffe6d4e75c> /usr/lib/libAccessibility.dylib
0x35ffc000 - 0x36015fff libRIP.A.dylib armv7 <ee16b5cee12a8947c8e511ed51ae7fef> /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 20 Feb 2011, 16:28

moved to proper section, my colleague will answer asap
Lapo
--
gotoAndPlay()
...addicted to flash games
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 20 Feb 2011, 16:48

I was thinking posting in in the iPhone section, but it looks here is the place to get things done.
User avatar
cemuzunlar
Posts: 47
Joined: 26 Dec 2008, 00:45
Contact:

Postby cemuzunlar » 20 Feb 2011, 20:31

13 Foundation 0x31cd583e -[NSData(NSData) initWithBytes:length:]
14 Foundation 0x31ce8248 +[NSData(NSData) dataWithBytes:length:]
15 iBridgeBaron 0x0045ccd4 -[BitSwarmClient stream:handleEvent:] + 1632

It seems that your client gets some data from the server.
BitSwarmClient's stream's handleEvent function is called(15).
Then it tries to initialize an NSData object from the received bytes with dataWithBytes:length: (14)
but it crashes in the iOS foundation library.

Most probably, you are leaking memory and your app crashes when it leakes above a certain amount.
Cem Uzunlar
Infosfer Game and Visualization Technologies
http://www.infosfer.com
contact@infosfer.com
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 23 Feb 2011, 12:07

Upon further investigation I was able to consistently replicate the bug. It is related to coming off of background mode.
Here is how you can try it. I start my App and connect it to the server, it is all good. Now send the app to background (single click of the HOME button) and also press iPhone 4 power button one to go in safe mode. Now turn the screen back on and try to pull the application out of background mode. CRASH on line 409 in the BitSwarmClient.m . The length of the bites read is =-1.

2011-02-23 08:33:32.209 iBridgeBaron[3190:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSConcreteData initWithBytes:length:copy:freeWhenDone:bytesAreVM:]: absurd length: 4294967295, maximum size: 2147483648 bytes'
*** Call stack at first throw:
(
0 CoreFoundation 0x33ac0987 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3347b49d objc_exception_throw + 24
2 CoreFoundation 0x33ac07c9 +[NSException raise:format:arguments:] + 68
3 CoreFoundation 0x33ac0803 +[NSException raise:format:] + 34
4 Foundation 0x3361da51 -[NSConcreteData initWithBytes:length:copy:freeWhenDone:bytesAreVM:] + 108
5 Foundation 0x3362a845 -[NSData(NSData) initWithBytes:length:] + 36
6 Foundation 0x3363d24f +[NSData(NSData) dataWithBytes:length:] + 34
7 iBridgeBaron 0x0041a3f1 -[BitSwarmClient stream:handleEvent:] + 1496
8 CoreFoundation 0x33aa2415 _inputStreamCallbackFunc + 52
9 CoreFoundation 0x33a80f71 _signalEventSync + 76
10 CoreFoundation 0x33a81849 _cfstream_solo_signalEventSync + 64
11 CoreFoundation 0x33a7e7f5 _CFStreamSignalEvent + 332
12 CoreFoundation 0x33a7e6a7 CFReadStreamSignalEvent + 10
13 CFNetwork 0x30d1ccb7 _ZN12SocketStream40dispatchSignalFromSocketCallbackUnlockedEP24SocketStreamSignalHolder + 26
14 CFNetwork 0x30caa423 _ZN12SocketStream14socketCallbackEP10__CFSocketmPK8__CFDataPKv + 110
15 CFNetwork 0x30caa3a5 _ZN12SocketStream22_SocketCallBack_streamEP10__CFSocketmPK8__CFDataPKvPv + 48
16 CoreFoundation 0x33a80c9d __CFSocketDoCallback + 340
17 CoreFoundation 0x33a809b1 __CFSocketPerformV0 + 84
18 CoreFoundation 0x33a767dd __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
19 CoreFoundation 0x33a484fb __CFRunLoopDoSources0 + 194
20 CoreFoundation 0x33a47e5b __CFRunLoopRun + 230
21 CoreFoundation 0x33a47c87 CFRunLoopRunSpecific + 230
22 CoreFoundation 0x33a47b8f CFRunLoopRunInMode + 58
23 GraphicsServices 0x33b0e4ab GSEventRunModal + 114
24 GraphicsServices 0x33b0e557 GSEventRun + 62
25 UIKit 0x32099329 -[UIApplication _run] + 412
26 UIKit 0x32096e93 UIApplicationMain + 670
27 iBridgeBaron 0x00021e09 main + 64
28 iBridgeBaron 0x00021dc4 start + 40
)
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 23 Feb 2011, 12:20

Adding len check to be >-1 before we fire onDataRead in BitSwarnClient.m line 409 solves it.

while ([(NSInputStream *)stream hasBytesAvailable] == YES) {
len = [(NSInputStream *)stream read:buf maxLength:1024];
@try {
if (len>-1) [_ioHandler onDataRead:[NSData dataWithBytes:buf length:len]];
}
@catch (SFSException * e) {
[_log warn:@"Excepion onDataRead!!!"];
}
}


I general have you tested client reconnections when going in and out of background state, as well as when the device screen gets locked un locked. There seems to be some un handled situations.
User avatar
cemuzunlar
Posts: 47
Joined: 26 Dec 2008, 00:45
Contact:

Postby cemuzunlar » 23 Feb 2011, 12:21

You need to handle your application's 'waking up' events, and then destory, recreate the SFS object, connect to server etc.
Last edited by cemuzunlar on 23 Feb 2011, 12:33, edited 1 time in total.
Cem Uzunlar

Infosfer Game and Visualization Technologies

http://www.infosfer.com

contact@infosfer.com
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 23 Feb 2011, 12:21

The explanation that you gave me about the memory leak is quite lame.
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 23 Feb 2011, 12:31

Further more, that might be a separate issue.

In SmartFoxiPhoneClient.m line 201 you have a method isConnected. In the describe on/off sequence returns value TRUE , when at the same time property _isConnected is false.
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 23 Feb 2011, 12:33

By correct value for isConnected in this situation should be FALSE.
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 23 Feb 2011, 12:35

That find explains some other peculiar behaviors of my Application that relied on isConnected and of course was getting the wrong state.
As a temp hack for my self I have added isMyConnected method to get access to the property _isConnected of the SmartFoxiPhoneClient
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 23 Feb 2011, 12:47

Man, sure I do miss talking to Lapo. Please read more of my comments to see that it is hard to manage the SFSClient when the isConnected state/property is messed up.


cemuzunlar wrote:You need to handle your application's 'waking up' events, and then destory, recreate the SFS object, connect to server etc.
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 23 Feb 2011, 12:52

cemuzunlar wrote:You need to handle your application's 'waking up' events, and then destory, recreate the SFS object, connect to server etc.


The proper answer is we will look into the issue and improve the client. For the money we payed for the server I do expect at least that.
User avatar
cemuzunlar
Posts: 47
Joined: 26 Dec 2008, 00:45
Contact:

Postby cemuzunlar » 26 Feb 2011, 14:22

The sleep and wake-up events can only be handled in your app delegate. There is no way for us to handle that event.

So, it is your responsibility to watch for that events and take appropriate action, in that case destroy/recreate the SFS object.

Please check this:
"One of the main jobs of the application delegate is to track the state transitions the application goes through while it is running. Prior to iOS 4.0, applications were either active, inactive, or not running. In iOS 4.0 and later, applications can also be running in the background or suspended. All of these transitions require a response from your application to ensure that it is doing the right thing. For example, a background application would need to stop updating its user interface. You provide the response to these transitions using the methods of the application delegate."
[url=http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIApplicationDelegate]UIApplicationDelegate Protocol Reference[/url]

We'll test the system again anyway to see if there is anything we can do.
Cem Uzunlar

Infosfer Game and Visualization Technologies

http://www.infosfer.com

contact@infosfer.com
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 01 Aug 2011, 02:18

It is the responsibility of the SFS Client to keep proper state. how come the low level BitSwarm protocol indicates it is connected when the SFS Client says it is not. This had nothing to do with handling states of the application. There is messed up code in setting uo properties for the SFS Client.

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 12 guests