cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.22k stars 7.06k forks source link

Crashing on Android 4.4 links with gpu memory and the Internet Connection #17616

Open Mishok43 opened 7 years ago

Mishok43 commented 7 years ago

Hello. Our game sometimes chashes if a player tries to login to Facebook or executes some graphic effects or just on the spot only on Android 4.4. If a player isn't connected to the Internet this bug appears much less than with the Internet. We have understood by logcat that the game crashes after these errors:

W/Adreno-GSL(11826): : sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL(11826): : ioctl_kgsl_sharedmem_alloc: FATAL ERROR : (null)

And some logs from GP:

#00 pc 0008f0cc /system/lib/libskia.so
#01 pc 000eafe9 /system/lib/libskia.so
#02 pc 000eb4f1 /system/lib/libskia.so (SkLinearGradient::shadeSpan(int, int, unsigned int*, int)+208)
#03 pc 0009cdef /system/lib/libskia.so (SkARGB32_Shader_Blitter::blitRect(int, int, int, int)+294)
#04 pc 000c8af9 /system/lib/libskia.so
#05 pc 000c8b7f /system/lib/libskia.so
#06 pc 000c938d /system/lib/libskia.so (SkScan::AntiFillRect(SkRect const&, SkRegion const*, SkBlitter*)+192)
#07 pc 000c93a7 /system/lib/libskia.so (SkScan::AntiFillRect(SkRect const&, SkRasterClip const&, SkBlitter*)+14)
#08 pc 000a8905 /system/lib/libskia.so (SkDraw::drawRect(SkRect const&, SkPaint const&) const+214)
#09 pc 000a1083 /system/lib/libskia.so (SkCanvas::drawRect(SkRect const&, SkPaint const&)+102)
#10 pc 0007b7b7 /system/lib/libandroid_runtime.so
#11 pc 00020d0c /system/lib/libdvm.so (dvmPlatformInvoke+112)
#12 pc 000519af /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#13 pc 0002a1a0 /system/lib/libdvm.so
#14 pc 00031650 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#15 pc 0002ece8 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#16 pc 000640f9 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+392)
#17 pc 0006c05f /system/lib/libdvm.so
#18 pc 0002a1a0 /system/lib/libdvm.so
#19 pc 00031650 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#20 pc 0002ece8 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#21 pc 00063e15 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::_valist)+336)
#22 pc 0004d597 /system/lib/libdvm.so
#23 pc 000520df /system/lib/libandroid_runtime.so
#24 pc 00053673 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+354)
#25 pc 0000105b /system/bin/app_process
#26 pc 0000e513 /system/lib/libc.so (_libcinit+50)
#27 pc 00000d7c /system/bin/app_process

That's why we came to the conclusion that our game has problems with gpu, rendering some textures, drawing. But on the other side, if a device is offline, the game is more stable and it's very difficult to achieve some crashes. And it's strange. If it's online and player executes some graphic effects - game always crashes. But the game has never crashed after starting these effects if it doesn't have the Internet connection. And executing these graphic effects doesn't create some request to the Internet and doesn't deal with it. And these crashes're produced only on Android 4.4.

For preparing textures we use TexturePacker.

We tried to fix it by some solutions, but nothing helped:

  1. Using older verions of Facebook SDK (because the majority of crashes happenes when player is online and tries to login to Facebook)
  2. Disabled hardwareAccelerated
  3. Enabled using largeHeap
  4. Enabled method Power of 2 for preparing texture atlases in the TexturePacker
  5. Created some extra objects, widgets and sprites in the game
  6. Compiled special for arm-v7
  7. We checked formats of all textures. And nothing doesn't have RGB555\RGB556. All is RGBA8888\RGBA4444

What's the problem? How can the Internet connection links with these errors? How can we fix it? Thank you for helping.

dumganhar commented 7 years ago

@Mishok43 How did you use Facebook SDK?

Mishok43 commented 7 years ago

@dumganhar Thank you, for the answer. I use the Facebook SDK Plugin from sdkbox for working with Facebook.

Mishok43 commented 7 years ago

@tongwangj Unfortunately, I haven't solved the problem yet (

Mishok43 commented 7 years ago

@tongwangj Do you use the AdColony lib in your project?

Mishok43 commented 7 years ago

@tongwangj Did you try to remove AdColony lib from your project for fixing the bug? I have a lot of problems with the lib and maybe it's the reason of the strange bug. Or you had met this bug before you added this AdColony lib to the project?

Mishok43 commented 7 years ago

@tongwangj Hi. I have tried to remove AdColony plugin from project - 0 results. Did you try to change Facebook SDK version or some dependies? Maybe you know something more about this problem. It's awful, because 4.4 - is one of the most popular android version in the World.

Mishok43 commented 7 years ago

@tongwangj I tried it. It didn't helped. Maybe deleting Facebook SDK will help (if it's true, we can try to change version of it).

Mishok43 commented 7 years ago

@dumganhar Well, Do you have any ideas about this bug? What's the probable reasons of the strange behavior?