Crash on iOS7 using sockets

39 views
Skip to first unread message

Dario Ogniben

unread,
Aug 7, 2014, 3:37:04 AM8/7/14
to codenameone...@googlegroups.com
Hi, i have an issue with CN1 using sockets on iOS.
Everything works fine on the simulator, but when i build and deploy on an iPhone5 with iOS7 the app crashes on Socket.connect(...)
On the app side i have a button that once pressed triggers this action:

    protected void onGUI1_ConnectButtonAction(Component c, ActionEvent event) {       
                    Socket.connect("192.168.11.106", 3333, new SocketConnection() {
                        @Override
                        public void connectionError(int errorCode, String message) {
                            System.out.println("Error");
                        }

                        @Override
                        public void connectionEstablished(InputStream is, OutputStream os) {
                            System.out.println("Connected!");
                        }
                    });
    }

The action makes the app crash with the following report:

ReportCrash[4147] <Notice>: ReportCrash acting against PID 4146
ReportCrash[4147] <Notice>: Formulating crash report for process HS3Application[4146]
com.apple.launchd[1] (UIKitApplication:hs3[0x58cf][4146]) <Warning>: (UIKitApplication:hs3[0x58cf]) Job appears to have crashed: Bus error: 10
backboardd[28] <Warning>: Application 'UIKitApplication:hs3[0x58cf]' exited abnormally with signal 10: Bus error: 10

Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Hardware Model:      iPhone5,2
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Process:             HS3Application [4146]
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Path:                /var/mobile/Applications/38B4F6E7-0EAC-43CF-93AB-B4A75DF2DD99/HS3Application.app/HS3Application
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Identifier:          HS3Application
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Version:             ???
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Code Type:           ARM (Native)
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Parent Process:      launchd [1]
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Date/Time:           2014-08-07 09:13:09.159 +0200
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: OS Version:          iOS 7.0 (11A465)
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Report Version:      104
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Exception Subtype: KERN_PROTECTION_FAILURE at 0x05237ffc
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Triggered by Thread:  9
....
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Thread 9 Crashed:
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 0   CoreFoundation                    0x304f4dd8 0x304f0000 + 19928
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 1   CoreFoundation                    0x3056db86 0x304f0000 + 514950
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 2   CoreFoundation                    0x304f5816 0x304f0000 + 22550
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 3   CFNetwork                         0x301b7198 0x30186000 + 201112
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 4   CFNetwork                         0x301b7b3c 0x30186000 + 203580
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 5   CFNetwork                         0x30214acc 0x30186000 + 584396
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 6   CFNetwork                         0x301b7a22 0x30186000 + 203298
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 7   CFNetwork                         0x3025e462 0x30186000 + 885858
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 8   CFNetwork                         0x301b94d6 0x30186000 + 210134
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 9   CFNetwork                         0x3025e238 0x30186000 + 885304
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 10  CoreFoundation                    0x3050bebe 0x304f0000 + 114366
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 11  CoreFoundation                    0x3054d79e 0x304f0000 + 382878
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 12  CoreFoundation                    0x3058ab90 0x304f0000 + 633744
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 13  HS3Application                    0x005a67a0 0xfb000 + 4896672
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 14  HS3Application                    0x005a54ba 0xfb000 + 4891834
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 15  HS3Application                    0x002c5e1e 0xfb000 + 1879582
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 16  HS3Application                    0x0037769c 0xfb000 + 2606748
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: 17  HS3Application                    0x003776c8 0xfb000 + 2606792

The last line appears identical on the next 500 linese, then:

Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>: Thread 9 crashed with ARM Thread State (32-bit):
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>:     r0: 0xffffffff    r1: 0x00000028      r2: 0x3b075f68      r3: 0x00000002
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>:     r4: 0x02002880    r5: 0x3b060000      r6: 0x16d875d0      r7: 0x05238028
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>:     r8: 0x16d875d4    r9: 0x00000086     r10: 0x16d875d4     r11: 0x00000001
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>:     ip: 0x3aff2838    sp: 0x05237fe8      lr: 0x3056db89      pc: 0x304f4dd8
Aug  7 09:13:09 iPhoneDO ReportCrash[4147] <Error>:   cpsr: 0x60000030

That's all. For my app is fundamental the socket communication, so i started from that but i'm quite blocked.
Thanks for any help or advice you can give.

Dario

dario....@archeometra.it

unread,
Aug 7, 2014, 10:50:13 AM8/7/14
to codenameone...@googlegroups.com, dario....@archeometra.it
I also tried Steve Hannah CN1Sockets implementation, but my test app crashes with the following error:

HS3Application[4851] <Error>: -[ca_weblite_codename1_net_impl_NativeSocketImpl isInputStreamShutdown]: unrecognized selector sent to instance 0x15d7ad80
HS3Application[4851] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ca_weblite_codename1_net_impl_NativeSocketImpl isInputStreamShutdown]: unrecognized selector sent to instance 0x15d7ad80'

Anyone has more luck with CN1 sockets and iOS 7 ?
I forgot to mention (if may be important) that my builds are sent by IntelliJ 13.0

Dario

Steve Hannah

unread,
Aug 7, 2014, 10:58:18 AM8/7/14
to codenameone...@googlegroups.com, dario....@archeometra.it
I haven't had any problems with the CN1Sockets on iOS 7.   Can you post a simple test case that is failing for you and I'll take a look?  Are you on the newVM or the old one?

Steve




Dario

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/304d1bda-c52a-465e-825f-d08373b5aa41%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Web Lite Solutions Corp.

dario....@archeometra.it

unread,
Aug 7, 2014, 11:49:45 AM8/7/14
to codenameone...@googlegroups.com, dario....@archeometra.it
Hi Steve, thank you for your interest!

I solved the previous problem by slightly changing a line on ca_weblite_codename1_net_impl_NativeSocketImpl.m, from:

-(BOOL)isSocketConnected{
    return ![self isInputStreamShutdown] && ![self isOutputStreamShutdown];
}

to:

-(BOOL)isSocketConnected{
    return ![self isInputShutdown] && ![self isOutputShutdown];
}

Now the isSocketConnected method seems to work fine. I have another problem that i'm investigating, but it could be due to a firewall policy.
I'm using the old VM and a simple test case, a button that when pressed tries to establish a socket connection.

Thanks
Dario
Reply all
Reply to author
Forward
0 new messages