Crash when making several http request calls in Android

Hey there,

Well, I’ve had this error for a while that, when making too many HTTP calls in Android, the app crashes.

At first, I thought it was because they were sequential, so I added timeouts to delay them a bit, and it worked for a while. But now, it seems I am making too many requests in general throughout the app and it eventually simply crashes.

The error the logcat gives didn’t give me enough info to know what was going on. It seems the app is having some kind of memory error. The backtrace shows:

#00 pc [some hex number, e.g. 009ef0e0] /data/app-lib/com.game.package-1/libcocos2djs.so
#01 pc [another hex number, e.g. 009ef0d4] /data/app-lib/com.game.package-1/libcocos2djs.so

Then it gives me a stack that shows, among other memory locations, /system/lib/libc.so (dlmalloc) and /system/lib/libc.so (malloc+12)

That is all I know. This happens no matter the android device (or version) and the memory size is irrelevant.

I’d really love some help or guide here. Thanks.

Has nobody else encountered this error? Does nobody know anything about it?

Could this link be related?

Or this other link?

Although I should clarify that the crash happens after an http request is completed.

Help, please!

#EDIT:

I got these two crash backtraces. They may help.

##1

The first backtrace comes after a Facebook API call.

F/libc    ( 1076): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x30 in tid 1076 (x.fluffyMadness)
I/DEBUG   (  282): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  282): Build fingerprint: 'motorola/falcon_tefco/falcon_umts:5.0.2/LXB22.46-32/31:user/release-keys'
I/DEBUG   (  282): Revision: 'p3c0'
I/DEBUG   (  282): ABI: 'arm'
I/DEBUG   (  282): pid: 1076, tid: 1076, name: x.fluffyMadness  >>> co.euphoricvortex.fluffyMadness <<<
I/DEBUG   (  282): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x30D/hardware_info(  285): hw_info_append_hw_type : device_name = speaker
I/DEBUG   (  282):     r0 becb5a5c  r1 b6f3c10c  r2 00000000  r3 00000000
I/DEBUG   (  282):     r4 becb5a5c  r5 00000003  r6 00000001  r7 00000000
I/DEBUG   (  282):     r8 ffffff88  r9 00000000  sl b778b978  fp becb6bc0
I/DEBUG   (  282):     ip a6d20a40  sp becb59f8  lr a5482798  pc a54827a0  cpsr800f0010
I/DEBUG   (  282):
I/DEBUG   (  282): backtrace:
I/DEBUG   (  282):     #00 pc 009f17a0  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so
I/SBar.MotoNetworkCtrlr( 1305): onReceive: WifiManager.RSSI_CHANGED_ACTION Received
I/SBar.MotoNetworkCtrlr( 1305): updateTelephonySignalStrength[0]:  No service
I/DEBUG   (  282):
I/DEBUG   (  282): Tombstone written to: /data/tombstones/tombstone_08
I/BootReceiver(  871): Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
W/ActivityManager(  871):   Force finishing activity co.euphoricvortex.fluffyMadness/org.cocos2dx.javascript.AppActivity
W/ContextImpl( 1495): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1455 android.content.ContextWrapper.sendBroadcast:376 com.motorola.motocare.util.TriggerHelper$TriggerBuilder.send:76 com.motorola.motocare.internal.frameworkevents.PauseResumeTrigger.handleFrameworkEvent:53 com.motorola.motocare.internal.frameworkevents.FwEventMonitor$FrameworkListener.processFrameworkEvent:114
I/WindowState(  871): WIN DEATH: Window{6ec7d57 u0 co.euphoricvortex.fluffyMadness/org.cocos2dx.javascript.AppActivity}
I/WindowState(  871): WIN DEATH: Window{e9a4082 u0 SurfaceView}
I/SFPerfTracer(  256):      triggers: (rate: 784:52372) (compose: 0:28) (post: 0:14) (render: 88:4668) (156:1482181 frames) (157:1507095)
D/SFPerfTracer(  256):        layers: (2:15) (FocusedStackFrame (0xb8154e78): 0:1861)* (DimLayer (0xb8156888): 0:25)* (DimLayer (0xb810c780): 0:29)* (DimLayer (0xb8110598): 0:1490)* (DimLayer (0xb81124f0): 0:320)* (StatusBar (0xb80a7af0): 2:26287)* (com.android.systemui.ImageWallpaper (0xb80e99e8): 1:6626)* (NavigationBar (0xb8131b78): 1:286) (ScreenshotSurface (0xb8148b40): 0:26)- (SurfaceView (0xb80ac128): 157:197) (co.euphoricvortex.fluffyMadness/org.cocos2dx.javascript.AppActivity (0xb8130808): 1:29)* (BlackSurface(0xb80a9ca8): 0:25)- (BlackSurface(0xb814ba80): 0:25)- (BlackSurface (0xb814cd10): 0:25)- (BlackSurface (0xb812d5a0): 0:25)-
V/ActivityManager(  871): Display changed displayId=0
I/InputReader(  871): Reconfiguring input devices.  changes=0x00000004
I/InputReader(  871): Device reconfigured: id=3, name='synaptics_dsx_i2c', size720x1280, orientation 0, mode 1, display id 0
I/Zygote  (  298): Process 1076 exited due to signal (11)
I/ActivityManager(  871): Process co.euphoricvortex.fluffyMadness (pid 1076) has died

##2

This second backtrace is from a custom C++ method.

F/libc    (32566): Fatal signal 6 (SIGABRT), code -6 in tid 32622 (GLThread 28029)
I/DEBUG   (  282): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  282): Build fingerprint: 'motorola/falcon_tefco/falcon_umts:5.0.2/LXB22.46-32/31:user/release keys'
I/DEBUG   (  282): Revision: 'p3c0'
I/DEBUG   (  282): ABI: 'arm'
I/DEBUG   (  282): pid: 32566, tid: 32622, name: GLThread 28029  >>> co.euphoricvortex.fluffyMadness <<<
I/DEBUG   (  282): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
I/DEBUG   (  282):     r0 00000000  r1 00007f6e  r2 00000006  r3 00000000
I/DEBUG   (  282):     r4 a488add8  r5 00000006  r6 00000016  r7 0000010c
I/DEBUG   (  282):     r8 b7cddef8  r9 b761ed60  sl 00000000  fp a488a7d4
I/DEBUG   (  282):     ip 00007f6e  sp a488a6c8  lr b6ed7679  pc b6efd224  cpsr600f0010
I/DEBUG   (  282):
I/DEBUG   (  282): backtrace:
I/DEBUG   (  282):     #00 pc 0003c224  /system/lib/libc.so (tgkill+12)
I/DEBUG   (  282):     #01 pc 00016675  /system/lib/libc.so (pthread_kill+52)
I/DEBUG   (  282):     #02 pc 00017287  /system/lib/libc.so (raise+10)
I/DEBUG   (  282):     #03 pc 00013ad9  /system/lib/libc.so (__libc_android_abort+36)
I/DEBUG   (  282):     #04 pc 00012264  /system/lib/libc.so (abort+4)
I/DEBUG   (  282):     #05 pc 01e503a3  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (__gnu_cxx::__verbose_terminate_handler()+230)
I/DEBUG   (  282):     #06 pc 01e1a475  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (__cxxabiv1::__terminate(void (*)())+4)
I/DEBUG   (  282):     #07 pc 01e1a539  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::terminate()+8)
I/DEBUG   (  282):     #08 pc 01e1a687  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (__cxa_throw+110)
I/DEBUG   (  282):     #09 pc 01e4b289  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so
I/DEBUG   (  282):     #10 pc 014536d8  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so
I/DEBUG   (  282):     #11 pc 01e4dcef  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so
I/DEBUG   (  282):     #12 pc 0121ad84  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (__JSDownloaderDelegator::onHttpRequestCompleted(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)+236)
I/DEBUG   (  282):     #13 pc 01222de8  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNKSt7_Mem_fnIM23__JSDownloaderDelegatorFvPN7cocos2d7network10HttpClientEPNS2_12HttpResponseEEEclIJS4_S6_EvEEvPS0_DpOT_+172)
I/DEBUG   (  282):     #14 pc 012220c0  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNSt5_BindIFSt7_Mem_fnIM23__JSDownloaderDelegatorFvPN7cocos2d7network10HttpClientEPNS3_12HttpResponseEEEPS1_St12_PlaceholderILi1EESC_ILi2EEEE6__callIvJOS5_OS7_EJLj0ELj1ELj2EEEET_OSt5tupleIJDpT0_EESt12_Index_tupleIJXspT1_EEE+200)
I/DEBUG   (  282):     #15 pc 01220fc8  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNSt5_BindIFSt7_Mem_fnIM23__JSDownloaderDelegatorFvPN7cocos2d7network10HttpClientEPNS3_12HttpResponseEEEPS1_St12_PlaceholderILi1EESC_ILi2EEEEclIJS5_S7_EvEET0_DpOT_+104)
I/DEBUG   (  282):     #16 pc 0121f5d8  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::_Function_handler<void (cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*), std::_Bind<std::_Mem_fn<void (__JSDownloaderDelegator::*)(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)> (__JSDownloaderDelegator*, std::_Placeholder<1>, std::_Placeholder<2>)>>::_M_invoke(std::_Any_data const&, cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)+80)
I/DEBUG   (  282):     #17 pc 0148cc10  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::function<void (cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)>::operator()(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*) const+116)
I/DEBUG   (  282):     #18 pc 0148b9ac  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (cocos2d::network::HttpClient::dispatchResponseCallbacks()+328)
I/DEBUG   (  282):     #19 pc 01493880  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNKSt7_Mem_fnIMN7cocos2d7network10HttpClientEFvvEEclIJEvEEvPS2_DpOT_+124)
I/DEBUG   (  282):     #20 pc 01492604  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNSt5_BindIFSt7_Mem_fnIMN7cocos2d7network10HttpClientEFvvEEPS3_EE6__callIvJEJLj0EEEET_OSt5tupleIJDpT0_EESt12_Index_tupleIJXspT1_EEE+108)
I/DEBUG   (  282):     #21 pc 0149057c  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNSt5_BindIFSt7_Mem_fnIMN7cocos2d7network10HttpClientEFvvEEPS3_EEclIJEvEET0_DpOT_+60)
I/DEBUG   (  282):     #22 pc 0148e1fc  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void (cocos2d::network::HttpClient::*)()> (cocos2d::network::HttpClient*)>>::_M_invoke(std::_Any_data const&)+32)
I/DEBUG   (  282):     #23 pc 0139ad54  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::function<void ()>::operator()() const+60)
I/DEBUG   (  282):     #24 pc 01a26cb0  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (cocos2d::Scheduler::update(float)+1552)
I/DEBUG   (  282):     #25 pc 019eb894  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (cocos2d::Director::drawScene()+132)
I/DEBUG   (  282):     #26 pc 019efab0  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (cocos2d::DisplayLinkDirector::mainLoop()+136)
I/DEBUG   (  282):     #27 pc 00cdaf48  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender+40)
I/DEBUG   (  282):     #28 pc 000ae8e1  /data/dalvik-cache/arm/data@app@co.euphoricvortex.fluffyMadness-1@base.apk@classes.dex
I/DEBUG   (  282):
I/DEBUG   (  282): Tombstone written to: /data/tombstones/tombstone_07I/BootReceiver(  871): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
W/ActivityManager(  871):   Force finishing activity co.euphoricvortex.fluffyMadness/org.cocos2dx.javascript.AppActivity
W/InputDispatcher(  871): channel 'e3e8a00 co.euphoricvortex.fluffyMadness/org.cocos2dx.javascript.AppActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
E/InputDispatcher(  871): channel 'e3e8a00 co.euphoricvortex.fluffyMadness/org.cocos2dx.javascript.AppActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I/WindowState(  871): WIN DEATH: Window{e3e8a00 u0 co.euphoricvortex.fluffyMadness/org.cocos2dx.javascript.AppActivity}
W/InputDispatcher(  871): Attempted to unregister already unregistered input channel 'e3e8a00 co.euphoricvortex.fluffyMadness/org.cocos2dx.javascript.AppActivity (server)'
I/WindowState(  871): WIN DEATH: Window{3839925c u0 SurfaceView}
I/Zygote  (  298): Process 32566 exited due to signal (6)
I/SFPerfTracer(  256):      triggers: (rate: 0:20) (0 sw vsyncs) (0 skipped) (187:1360767 vsyncs) (189:1505013)
I/SFPerfTracer(  256):      triggers: (rate: 782:52354) (compose: 0:28) (post: 0:14) (render: 87:4657) (188:1479432 frames) (189:1504151)
D/SFPerfTracer(  256):        layers: (2:10) (FocusedStackFrame (0xb8154e78): 0:1831)* (DimLayer (0xb8156888): 0:14)* (DimLayer (0xb810c780): 0:29)* (DimLayer (0xb8110598): 0:1490)* (DimLayer (0xb81124f0): 0:320)* (StatusBar (0xb80a7af0): 0:25658)* (com.android.systemui.ImageWallpaper (0xb80e99e8): 0:6446)* (NavigationBar (0xb814f1d0): 0:124) (co.euphoricvortex.fluffyMadness/org.cocos2dx.javascript.AppActivity (0xb8130808): 0:27)* (SurfaceView (0xb80acb08): 189:1314)
W/ActivityManager(  871): Exception thrown during pause
W/ActivityManager(  871): android.os.DeadObjectException
W/ActivityManager(  871):       at android.os.BinderProxy.transactNative(NativeMethod)
W/ActivityManager(  871):       at android.os.BinderProxy.transact(Binder.java:496)
W/ActivityManager(  871):       at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:708)
W/ActivityManager(  871):       at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:858)
W/ActivityManager(  871):       at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2782)
W/ActivityManager(  871):       at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2639)
W/ActivityManager(  871):       at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2500)
W/ActivityManager(  871):       at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:11737)
W/ActivityManager(  871):       at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11634)
W/ActivityManager(  871):       at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12339)
W/ActivityManager(  871):       at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:11835)
W/ActivityManager(  871):       at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)

#EDIT2:

I also got these NDK stacks from the previous logcats (the second logcat is showing first):

********** Crash dump: **********
Build fingerprint: 'motorola/falcon_tefco/falcon_umts:5.0.2/LXB22.46-32/31:user/release-keys'
pid: 32566, tid: 32622, name: GLThread 28029  >>> co.euphoricvortex.fluffyMadness <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Stack frame I/DEBUG   (  282):     #00 pc 0003c224  /system/lib/libc.so (tgkill+12)
Stack frame I/DEBUG   (  282):     #01 pc 00016675  /system/lib/libc.so (pthread_kill+52)
Stack frame I/DEBUG   (  282):     #02 pc 00017287  /system/lib/libc.so (raise+10)
Stack frame I/DEBUG   (  282):     #03 pc 00013ad9  /system/lib/libc.so (__libc_android_abort+36)
Stack frame I/DEBUG   (  282):     #04 pc 00012264  /system/lib/libc.so (abort+4)
Stack frame I/DEBUG   (  282):     #05 pc 01e503a3  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (__gnu_cxx::__verbose_terminate_handler()+230): Routine __gnu_cxx::__verbose_terminate_handler() at /s/ndk-toolchain/src/gcc/gcc-4.9/libstdc++-v3/libsupc++/vterminate.cc:95
Stack frame I/DEBUG   (  282):     #06 pc 01e1a475  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (__cxxabiv1::__terminate(void (*)())+4): Routine __cxxabiv1::__terminate(void (*)()) at /s/ndk-toolchain/src/gcc/gcc-4.9/libstdc++-v3/libsupc++/eh_terminate.cc:47
Stack frame I/DEBUG   (  282):     #07 pc 01e1a539  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::terminate()+8): Routine std::terminate() at /s/ndk-toolchain/src/gcc/gcc-4.9/libstdc++-v3/libsupc++/eh_terminate.cc:57 (discriminator 1)
Stack frame I/DEBUG   (  282):     #08 pc 01e1a687  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (__cxa_throw+110): Routine __cxa_throw at /s/ndk-toolchain/src/gcc/gcc-4.9/libstdc++-v3/libsupc++/eh_throw.cc:87
Stack frame I/DEBUG   (  282):     #09 pc 01e4b289  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so: Routine std::__throw_logic_error(char const*) at /s/ndk-toolchain/src/gcc/gcc-4.9/libstdc++-v3/src/c++11/functexcept.cc:71 (discriminator 10)
Stack frame I/DEBUG   (  282):     #10 pc 014536d8  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so: Routine char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/basic_string.tcc:133
Stack frame I/DEBUG   (  282):     #11 pc 01e4dcef  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so: Routine char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) at /tmp/ndk-user/tmp/gnu-libstdc++/static-armeabithumb-4.9/include/bits/basic_string.h:1743
Stack frame I/DEBUG   (  282):     #12 pc 0121ad84  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (__JSDownloaderDelegator::onHttpRequestCompleted(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)+236): Routine __JSDownloaderDelegator::onHttpRequestCompleted(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*) at D:/Projects/Cocos/FluffyMadness/frameworks/runtime-src/proj.android/../../js-bindings/bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp:969 (discriminator 1)
Stack frame I/DEBUG   (  282):     #13 pc 01222de8  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNKSt7_Mem_fnIM23__JSDownloaderDelegatorFvPN7cocos2d7network10HttpClientEPNS2_12HttpResponseEEEclIJS4_S6_EvEEvPS0_DpOT_+172): Routine void std::_Mem_fn<void (__JSDownloaderDelegator::*)(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)>::operator()<cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*, void>(__JSDownloaderDelegator*, cocos2d::network::HttpClient*&&, cocos2d::network::HttpResponse*&&) const at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:569 (discriminator 6)
Stack frame I/DEBUG   (  282):     #14 pc 012220c0  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNSt5_BindIFSt7_Mem_fnIM23__JSDownloaderDelegatorFvPN7cocos2d7network10HttpClientEPNS3_12HttpResponseEEEPS1_St12_PlaceholderILi1EESC_ILi2EEEE6__callIvJOS5_OS7_EJLj0ELj1ELj2EEEET_OSt5tupleIJDpT0_EESt12_Index_tupleIJXspT1_EEE+200): Routine void std::_Bind<std::_Mem_fn<void (__JSDownloaderDelegator::*)(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)> (__JSDownloaderDelegator*, std::_Placeholder<1>, std::_Placeholder<2>)>::__call<void, cocos2d::network::HttpClient*&&, cocos2d::network::HttpResponse*&&, 0u, 1u, 2u>(std::tuple<cocos2d::network::HttpClient*&&, cocos2d::network::HttpResponse*&&>&&, std::_Index_tuple<0u, 1u, 2u>) at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:1264 (discriminator 12)
Stack frame I/DEBUG   (  282):     #15 pc 01220fc8  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNSt5_BindIFSt7_Mem_fnIM23__JSDownloaderDelegatorFvPN7cocos2d7network10HttpClientEPNS3_12HttpResponseEEEPS1_St12_PlaceholderILi1EESC_ILi2EEEEclIJS5_S7_EvEET0_DpOT_+104): Routine void std::_Bind<std::_Mem_fn<void (__JSDownloaderDelegator::*)(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)> (__JSDownloaderDelegator*, std::_Placeholder<1>, std::_Placeholder<2>)>::operator()<cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*, void>(cocos2d::network::HttpClient*&&, cocos2d::network::HttpResponse*&&) at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:1323 (discriminator 1)
Stack frame I/DEBUG   (  282):     #16 pc 0121f5d8  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::_Function_handler<void (cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*), std::_Bind<std::_Mem_fn<void (__JSDownloaderDelegator::*)(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)> (__JSDownloaderDelegator*, std::_Placeholder<1>, std::_Placeholder<2>)> >::_M_invoke(std::_Any_data const&, cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)+80): Routine std::_Function_handler<void (cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*), std::_Bind<std::_Mem_fn<void (__JSDownloaderDelegator::*)(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)> (__JSDownloaderDelegator*, std::_Placeholder<1>, std::_Placeholder<2>)> >::_M_invoke(std::_Any_data const&, cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*) at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:2039 (discriminator 1)
Stack frame I/DEBUG   (  282):     #17 pc 0148cc10  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::function<void (cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)>::operator()(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*) const+116): Routine std::function<void (cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*)>::operator()(cocos2d::network::HttpClient*, cocos2d::network::HttpResponse*) const at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:2439 (discriminator 2)
Stack frame I/DEBUG   (  282):     #18 pc 0148b9ac  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (cocos2d::network::HttpClient::dispatchResponseCallbacks()+328): Routine cocos2d::network::HttpClient::dispatchResponseCallbacks() at D:/Projects/Cocos/FluffyMadness/frameworks/runtime-src/proj.android/../../js-bindings/cocos2d-x/cocos/network/HttpClient-android.cpp:957
Stack frame I/DEBUG   (  282):     #19 pc 01493880  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNKSt7_Mem_fnIMN7cocos2d7network10HttpClientEFvvEEclIJEvEEvPS2_DpOT_+124): Routine void std::_Mem_fn<void (cocos2d::network::HttpClient::*)()>::operator()<, void>(cocos2d::network::HttpClient*) const at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:569 (discriminator 4)
Stack frame I/DEBUG   (  282):     #20 pc 01492604  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNSt5_BindIFSt7_Mem_fnIMN7cocos2d7network10HttpClientEFvvEEPS3_EE6__callIvJEJLj0EEEET_OSt5tupleIJDpT0_EESt12_Index_tupleIJXspT1_EEE+108): Routine void std::_Bind<std::_Mem_fn<void (cocos2d::network::HttpClient::*)()> (cocos2d::network::HttpClient*)>::__call<void, , 0u>(std::tuple<>&&, std::_Index_tuple<0u>) at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:1264 (discriminator 2)
Stack frame I/DEBUG   (  282):     #21 pc 0149057c  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (_ZNSt5_BindIFSt7_Mem_fnIMN7cocos2d7network10HttpClientEFvvEEPS3_EEclIJEvEET0_DpOT_+60): Routine void std::_Bind<std::_Mem_fn<void (cocos2d::network::HttpClient::*)()> (cocos2d::network::HttpClient*)>::operator()<, void>() at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:1323
Stack frame I/DEBUG   (  282):     #22 pc 0148e1fc  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void (cocos2d::network::HttpClient::*)()> (cocos2d::network::HttpClient*)> >::_M_invoke(std::_Any_data const&)+32): Routine std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void (cocos2d::network::HttpClient::*)()> (cocos2d::network::HttpClient*)> >::_M_invoke(std::_Any_data const&) at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:2039 (discriminator 1)
Stack frame I/DEBUG   (  282):     #23 pc 0139ad54  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (std::function<void ()>::operator()() const+60): Routine std::function<void ()>::operator()() const at C:/Android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/functional:2439
Stack frame I/DEBUG   (  282):     #24 pc 01a26cb0  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (cocos2d::Scheduler::update(float)+1552): Routine cocos2d::Scheduler::update(float) at D:/Projects/Cocos/FluffyMadness/frameworks/runtime-src/proj.android/../../js-bindings/cocos2d-x/cocos/./base/CCScheduler.cpp:979
Stack frame I/DEBUG   (  282):     #25 pc 019eb894  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (cocos2d::Director::drawScene()+132): Routine cocos2d::Director::drawScene() at D:/Projects/Cocos/FluffyMadness/frameworks/runtime-src/proj.android/../../js-bindings/cocos2d-x/cocos/./base/CCDirector.cpp:269
Stack frame I/DEBUG   (  282):     #26 pc 019efab0  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (cocos2d::DisplayLinkDirector::mainLoop()+136): Routine cocos2d::DisplayLinkDirector::mainLoop() at D:/Projects/Cocos/FluffyMadness/frameworks/runtime-src/proj.android/../../js-bindings/cocos2d-x/cocos/./base/CCDirector.cpp:1337
Stack frame I/DEBUG   (  282):     #27 pc 00cdaf48  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender+40): Routine Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender at D:/Projects/Cocos/FluffyMadness/frameworks/runtime-src/proj.android/../../js-bindings/cocos2d-x/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp:16 (discriminator 1)
Stack frame I/DEBUG   (  282):     #28 pc 000ae8e1  /data/dalvik-cache/arm/data@app@co.euphoricvortex.fluffyMadness-1@base.apk@classes.dex
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'motorola/falcon_tefco/falcon_umts:5.0.2/LXB22.46-32/31:user/release-keys'
pid: 1076, tid: 1076, name: x.fluffyMadness  >>> co.euphoricvortex.fluffyMadness <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x30
Stack frame I/DEBUG   (  282):     #00 pc 009f17a0  /data/app/co.euphoricvortex.fluffyMadness-1/lib/arm/libcocos2djs.so: Routine js::jit::AutoFlushICache::AutoFlushICache(char const*, bool) at libgcc2.c:?

@pandamicro , is your team sure this method cleans up everything it uses? (taken from HttpClient-android.cpp):

// Process Response
static void processResponse(HttpResponse* response, std::string& responseMessage)
{
    auto request = response->getHttpRequest();
    HttpRequest::Type requestType = request->getRequestType();

    if (HttpRequest::Type::GET != requestType && 
        HttpRequest::Type::POST != requestType && 
        HttpRequest::Type::PUT != requestType &&
        HttpRequest::Type::DELETE != requestType)
    {
        CCASSERT(true, "CCHttpClient: unknown request type, only GET、POST、PUT、DELETE are supported");
        return;
    }

    long responseCode = -1;
    int  retValue = 0;

    HttpURLConnection urlConnection;
    if(!urlConnection.init(request))
    {
        response->setSucceed(false);
        response->setErrorBuffer("HttpURLConnetcion init failed");
        return;
    }

    switch (requestType)
    {
        case HttpRequest::Type::GET:
            urlConnection.setRequestMethod("GET");
            break;

        case HttpRequest::Type::POST:
            urlConnection.setRequestMethod("POST");
            break;

        case HttpRequest::Type::PUT:
            urlConnection.setRequestMethod("PUT");
            break;

        case HttpRequest::Type::DELETE:
            urlConnection.setRequestMethod("DELETE");
            break;
        default:
            break;
    }

    int suc = urlConnection.connect();
    if (0 != suc)
    {
        response->setSucceed(false);
        response->setErrorBuffer("connect failed");
        response->setResponseCode(responseCode);
        return;
    }

    if (HttpRequest::Type::POST == requestType ||
        HttpRequest::Type::PUT == requestType)
    {
        urlConnection.sendRequest(request);
    }

    responseCode = urlConnection.getResponseCode();

    char* headers = urlConnection.getResponseHeaders();
    if (nullptr != headers)
    {
        writeHeaderData(headers, strlen(headers), response);
    }
    free(headers);

    //get and save cookies
    char* cookiesInfo = urlConnection.getResponseHeaderByKey("set-cookie");
    if (nullptr != cookiesInfo)
    {
        urlConnection.saveResponseCookies(cookiesInfo, strlen(cookiesInfo));
    }
    free(cookiesInfo);

    //content len
    int contentLength = urlConnection.getResponseHeaderByKeyInt("Content-Length");
    char* contentInfo = urlConnection.getResponseContent(response);
    if (nullptr != contentInfo) {
//      response->setResponseDataString(contentInfo, contentLength);
        std::vector<char> * recvBuffer = (std::vector<char>*)response->getResponseData();
        recvBuffer->clear();
        recvBuffer->insert(recvBuffer->begin(), (char*)contentInfo, ((char*)contentInfo) + urlConnection.getContentLength());
    }
    free(contentInfo);
    
    responseMessage = urlConnection.getResponseMessage();
    urlConnection.disconnect();

    // write data to HttpResponse
    response->setResponseCode(responseCode);

    if (responseCode == -1) 
    {
        response->setSucceed(false);
        response->setErrorBuffer(responseMessage.c_str());
    }
    else
    {
        response->setSucceed(true);
    }
}

My best guess is that something from the HttpRequests is not being cleaned up correctly, eventually giving the errors I get. But my C++ knowledge is limited to be sure about it.

Hey there, I edited the category for this thread to C++ (I placed it originally in Javascript) because there is definitely something wrong with HttpClient-android.cpp or any class related to it. I wish I could help or solve it myself but my C++ knowledge is limited. That’s why I’m beggin for your help here.

For example, I can cause the crash by logging in and out of Facebook inside the Android app multiple times. It eventually crashes. It must be something related to how Cocos2d-x handles the http requests.

We are seeing the same issue with cocos2d::network::HttpClient::processResponse(cocos2d::network::HttpResponse*, char*)

I am facing same issue. Do you have any solution?