Did you guys noticed some crashes in your app in the libcurl thread because of shitty internet connections ?
Please tell us how to reproduce it? How do you define “shitty” internet connections?
I’ve seen it when there is some on and off G3 connection; and also at home in the iphone simulator when my internet was bugging.
Maybe we can reproduce it in the simulator by breaking a working tcp configuration: I’ll get back to you with more details.
I just reproduced it, with the httpClientTest.cpp Test, from the cocos2d-x TestCpp project with the iphone simulator:
First, I changed the URL in test 2 because it was not working anymore:
// test 2
{
CCHttpRequest* request = new CCHttpRequest();
// required fields
request~~>setUrl;
then I runned the test, it was working OK.
then I unplugged the ethernet cable from my computer, clicked, to start the test again and I got a coredump:
0x922a35f0: movl eax, ecx
0x922a35f2: testb bl, bl
0x922a35f4: movl~~952(ebp), eax
0x922a35fa: js 0x922a360e ; *svfscanf_l + 4601
0x922a35fc: movl eax, -952(ebp)
0x922a3602: movl 257058, eax
Thread 1: EXC_BAD_ACCESS (code 1 adress 0x226e652)
0x922a3608: leal 52(eax,ebx,4), eax
0x922a360c: jmp 0x922a363d ;*svfscanf_l + 4648
0x922a360e: cmpl $-1, edi
0x922a3611: je 0x922a3627 ; __svfscanf_l + 4626
0x922a3613: movl eax, –952(ebp)
0x922a3619: testl edi, %edi
the stack is on Thread 1 with:
svfscanf_l
Curl_do_perform
cocos2d-extension:: processGetTask(…
cocos2d-networkThread(void *)
PS: I’ve seen the same bug on my real iphone.
If the network thread is blocked for too long, could that create some kind of synchronisation issue ?
Because it’s possible that some timeouts block it for a little while there.
I tried to reproduce this bug as you said. First I get google.fr correctly, then turn off my wifi, click and run, the console dumped:
Cocos2d: GET test1 completed
Cocos2d: response code: -1
Cocos2d: response failed
Cocos2d: error buffer: Couldn't resolve host 'just-make-this-request-failed.com'
Cocos2d: GET test2 completed
Cocos2d: response code: -1
Cocos2d: response failed
Cocos2d: error buffer: Couldn't resolve host 'www.google.fr'
Cocos2d: GET test3 completed
Cocos2d: response code: -1
Cocos2d: response failed
Cocos2d: error buffer: Couldn't resolve host 'httpbin.org'
That’s the result as I excepted, but no crashes here.
Any ideas?
I just tried with wifi: by doing the exact same test you did, I couldn’t get it a crash.
BUT when I use the wifi, and unplug the cable behind my router. I can reproduce the crash.
IMO It’s a different network state to turn off the wifi in you mac, and to be connected to a wifi network, that has no internet behind.
PS:You sometime have to click 5 times on “get”, without waiting for the result to get it crash.
Zhe: could you reproduce it ?
I have not personally tried to reproduce, but from a crash report:
Thread 4 Crashed:
0 libsystem_kernel.dylib 0x3b411350 __pthread_kill + 8
1 libsystem_c.dylib 0x3b387fb2 pthread_kill + 54
2 libsystem_c.dylib 0x3b3c4366 abort + 90
3 libsystem_info.dylib 0x3b3f1c02 _mdns_query_is_complete + 26
4 libsystem_info.dylib 0x3b3f1602 _mdns_search + 998
5 libsystem_info.dylib 0x3b3f0ee8 mdns_addrinfo + 368
6 libsystem_info.dylib 0x3b3f2a16 search_addrinfo + 90
7 libsystem_info.dylib 0x3b3e9b62 si_addrinfo + 1242
8 libsystem_info.dylib 0x3b3e9616 getaddrinfo + 98
9 Friends 0x00141772 Curl_getaddrinfo_ex + 18
10 Friends 0x0014a2e2 Curl_ipv4_resolve_r + 130
11 Friends 0x0014a240 Curl_getaddrinfo + 16
12 Friends 0x00149e32 Curl_resolv + 242
13 Friends 0x00149f7a Curl_resolv_timeout + 234
14 Friends 0x0016238e Curl_connect + 6034
15 Friends 0x0015e5ac Curl_do_perform + 168
16 Friends 0x0015e4d2 Curl_perform + 58
17 Friends 0x0014383a curl_easy_perform + 118
18 Friends 0x000f0576 cocos2d::extension::CURLRaii::perform(int*) (HttpClient.cpp:320)
19 Friends 0x000eff3c cocos2d::extension::networkThread(void*) (HttpClient.cpp:338)
20 libsystem_c.dylib 0x3b36a0de _pthread_start + 306
21 libsystem_c.dylib 0x3b369fa4 thread_start + 4
I believe this is on Cocos2d-x v 2.1.4
any update on this one ?
I’m also had crashes like @Justin until i used a static library (i had attempts to update curl library, recompile it by myself). At one moment i start using curl by including it sources to project directly (yes, it a very slow at project recompile time) and never seen crashes again.
How to including it sources to project directly in iOS?
Alexander Perepelitsyn wrote:
I’m also had crashes like @Justin until i used a static library (i had attempts to update curl library, recompile it by myself). At one moment i start using curl by including it sources to project directly (yes, it a very slow at project recompile time) and never seen crashes again.
Check this manual: http://www.creativealgorithms.com/blog/content/building-libcurl-ios-42
stand wally wrote:
How to including it sources to project directly in iOS?
Btw, to reproduce this issue open developer tools on iphone and set 100% packet loss because just turn off WiFi will not help to reproduce.
A few months later, but I believe that I was also able to fix this by just updating the curl library and headers to version 7.33.0 (the version is C2Dx is 7.26.0) You can download the pre-built iOS version at [[http://seiryu.home.comcast.net/~seiryu/libcurl-ios.html]] scroll to the bottom of the page.
I also had this bug.
It can be fixed with solution from here: