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.25k stars 7.06k forks source link

crash in org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native Method) #9657

Open iamjohnwang opened 9 years ago

iamjohnwang commented 9 years ago

My game is base on v3.0, the main login is developed with lua. I use a 3rd party crash log collector library to collect crash log. I found that the game sometimes crash in org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native Method) (please find detailed information about the crash below), I have no idea how this crash happen, and I also find that the crash probability of release version is higher then debug version. Is there any idea how this crash happen or what I should do to identify the problem? Thanks!

Stacktrack

SIGSEGV(SEGV_ACCERR)

00 pc 5568b018

     #00  lr 54e84cf0  <unknown>

java: org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native Method) org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame(Cocos2dxRenderer.java:95) android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1533) android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1257)

Other threads

Binder_2(1633):

dalvik.system.NativeStart.run(Native Method)

Controller sPushMessage Processing Thread(1639):

android.os.MessageQueue.nativePollOnce(Native Method) android.os.MessageQueue.next(MessageQueue.java:125) android.os.Looper.loop(Looper.java:124) android.os.HandlerThread.run(HandlerThread.java:60)

pool-4-thread-1(1664):

java.lang.Object.wait(Native Method) java.lang.Thread.parkFor(Thread.java:1231) sun.misc.Unsafe.park(Unsafe.java:323) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:197) java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:421) java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:320) java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:875) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) java.lang.Thread.run(Thread.java:856)

SoundPool(1636):

dalvik.system.NativeStart.run(Native Method)

BUGLY_THREAD(1642):

java.lang.Object.wait(Native Method) java.lang.Thread.parkFor(Thread.java:1231) sun.misc.Unsafe.park(Unsafe.java:323) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:197) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2061) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1062) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:779) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) java.lang.Thread.run(Thread.java:856)

Signal Catcher(1627):

dalvik.system.NativeStart.run(Native Method)

android.hardware.SystemSensorManager$SensorThread(1654):

android.hardware.SystemSensorManager.sensors_data_poll(Native Method) android.hardware.SystemSensorManager$SensorThread$SensorThreadRunnable.run(SystemSensorManager.java:122) java.lang.Thread.run(Thread.java:856)

Compiler(1628):

dalvik.system.NativeStart.run(Native Method)

InstallHelper f(1646):

android.os.MessageQueue.nativePollOnce(Native Method) android.os.MessageQueue.next(MessageQueue.java:125) android.os.Looper.loop(Looper.java:124) android.os.HandlerThread.run(HandlerThread.java:60)

WebViewCoreThread(1656):

android.os.MessageQueue.nativePollOnce(Native Method) android.os.MessageQueue.next(MessageQueue.java:125) android.os.Looper.loop(Looper.java:124) android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:837) java.lang.Thread.run(Thread.java:856)

Binder_1(1632):

dalvik.system.NativeStart.run(Native Method)

FinalizerDaemon(1630):

java.lang.Object.wait(Native Method) java.lang.Object.wait(Object.java:401) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:102) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:73) java.lang.Daemons$FinalizerDaemon.run(Daemons.java:169) java.lang.Thread.run(Thread.java:856)

GC(1626):

dalvik.system.NativeStart.run(Native Method)

CookieSyncManager(1657):

android.os.MessageQueue.nativePollOnce(Native Method) android.os.MessageQueue.next(MessageQueue.java:125) android.os.Looper.loop(Looper.java:124) android.webkit.WebSyncManager.run(WebSyncManager.java:92) android.webkit.CookieSyncManager.run(CookieSyncManager.java:58) java.lang.Thread.run(Thread.java:856)

SoundPoolThread(1637):

dalvik.system.NativeStart.run(Native Method)

BUGLY_THREAD(1645):

java.lang.Object.wait(Native Method) java.lang.Thread.parkFor(Thread.java:1231) sun.misc.Unsafe.park(Unsafe.java:323) java.util.concurrent.locks.LockSupport.park(LockSupport.java:157) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1057) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:779) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) java.lang.Thread.run(Thread.java:856)

main(1):

android.os.MessageQueue.nativePollOnce(Native Method) android.os.MessageQueue.next(MessageQueue.java:125) android.os.Looper.loop(Looper.java:124) android.app.ActivityThread.main(ActivityThread.java:4829) java.lang.reflect.Method.invokeNative(Native Method) java.lang.reflect.Method.invoke(Method.java:511) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) dalvik.system.NativeStart.main(Native Method)

Binder_3(1640):

dalvik.system.NativeStart.run(Native Method)

FinalizerWatchdogDaemon(1631):

java.lang.Object.wait(Native Method) java.lang.Object.wait(Object.java:364) java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:214) java.lang.Thread.run(Thread.java:856)

BUGLY_THREAD(1643):

java.lang.Object.wait(Native Method) java.lang.Thread.parkFor(Thread.java:1231) sun.misc.Unsafe.park(Unsafe.java:323) java.util.concurrent.locks.LockSupport.park(LockSupport.java:157) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1057) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:779) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) java.lang.Thread.run(Thread.java:856)

Thread-1661(1661):

dalvik.system.NativeStart.run(Native Method)

AsyncTask #1(1659):

java.lang.Object.wait(Native Method) java.lang.Thread.parkFor(Thread.java:1231) sun.misc.Unsafe.park(Unsafe.java:323) java.util.concurrent.locks.LockSupport.park(LockSupport.java:157) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022) java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) java.lang.Thread.run(Thread.java:856)

pool-4-thread-2(1665):

java.lang.Object.wait(Native Method) java.lang.Thread.parkFor(Thread.java:1231) sun.misc.Unsafe.park(Unsafe.java:323) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:197) java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:421) java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:320) java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:875) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) java.lang.Thread.run(Thread.java:856)

ReferenceQueueDaemon(1629):

java.lang.Object.wait(Native Method) java.lang.Object.wait(Object.java:364) java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:129) java.lang.Thread.run(Thread.java:856)

GLThread 1635(1635):

dalvik.system.VMStack.getThreadStackTrace(Native Method) java.lang.Thread.getStackTrace(Thread.java:591) java.lang.Thread.getAllStackTraces(Thread.java:528) com.tencent.bugly.proguard.a.a(BUGLY:189) com.tencent.bugly.crashreport.crash.jni.a.packageCrashDatas(BUGLY:158) com.tencent.bugly.crashreport.crash.jni.a.handleNativeException(BUGLY:234) org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native Method) org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame(Cocos2dxRenderer.java:95) android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1533) android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1257)

Controller Message Processing Thread(1638):

android.os.MessageQueue.nativePollOnce(Native Method) android.os.MessageQueue.next(MessageQueue.java:125) android.os.Looper.loop(Looper.java:124) android.os.HandlerThread.run(HandlerThread.java:60)

java.lang.ProcessManager(1634):

java.lang.Object.wait(Native Method) java.lang.Object.wait(Object.java:364) java.lang.ProcessManager.waitForMoreChildren(ProcessManager.java:140) java.lang.ProcessManager.watchChildren(ProcessManager.java:105) java.lang.ProcessManager.access$000(ProcessManager.java:40) java.lang.ProcessManager$1.run(ProcessManager.java:58)

minggo commented 9 years ago

Could you please give more information:

iamjohnwang commented 9 years ago

This issue it not reproducible, it happens uncertainly. I capture this log with a 3rd party crash log collector(http://bugly.qq.com/).


From the log, it seems that the stack has been corrupted.

SIGSEGV(SEGV_ACCERR)

00 pc 5568b018

00 lr 54e84cf0


And for other occasion, the crash log look like this: SIGSEGV(SEGV_MAPERR)

00 pc 0031eb0c /data/app-lib/cn.mlong.sgf-1/libcocos2dlua.so (cocosbuilder::CCBReader::readNodeGraphFromData(std::shared_ptrcocos2d::Data, cocos2d::Ref*, cocos2d::Size const&) +db)

     #00  lr 0000dcd5  /system/lib/libc.so (free +db)

java: org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native Method) org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame(Cocos2dxRenderer.java:95) android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523) android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

dcshi commented 9 years ago

I meet the same problem too, @iamjohnwang , your problem has gone?