lvxiang15

引擎用的cocos2d-x
spine编辑器用的3.8.95
spine运行库用的3.8
我们游戏中会播放一些spine动画,在一些安卓设备中会出现偶现闪退,堆栈信息如下

1 #00 pc 00042778 /system/lib/libc.so (tgkill+12) [armeabi-v7a]
2 #01 pc 00040379 /system/lib/libc.so (pthread_kill+32) [armeabi-v7a]
3 #02 pc 0001c78f /system/lib/libc.so (raise+10) [armeabi-v7a]
4 #03 pc 00019931 /system/lib/libc.so (__libc_android_abort+34) [armeabi-v7a]
5 #04 pc 000174ec /system/lib/libc.so (abort+4) [armeabi-v7a]
6 #05 pc 0001b3a3 /system/lib/libc.so (__libc_fatal+16) [armeabi-v7a]
7 #06 pc 000199b9 /system/lib/libc.so (__assert2+20) [armeabi-v7a]
8 #07 pc 009b5c47 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so [armeabi-v7a]
9 #08 pc 009b5d49 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so [armeabi-v7a]
10 #09 pc 009b42e9 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so [armeabi-v7a]
11 #10 pc 009b3b97 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so [armeabi-v7a]
12 #11 pc 009b3b5f /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (__cxa_throw+74) [armeabi-v7a]
13 #12 pc 009aea43 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (operator new(unsigned int)+54) [armeabi-v7a]
14 #13 pc 005fd07f /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (std::__ndk1::__split_buffer<cocos2d::V3F_C4B_T2F, std::__ndk1::allocator<cocos2d::V3F_C4B_T2F>&>::__split_buffer(unsigned int, unsigned int, std::__ndk1::allocator<cocos2d::V3F_C4B_T2F>&)+26) [armeabi-v7a]
15 #14 pc 005fcf93 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (std::__ndk1::vector<cocos2d::V3F_C4B_T2F, std::__ndk1::allocator<cocos2d::V3F_C4B_T2F> >::__append(unsigned int)+86) [armeabi-v7a]
16 #15 pc 005fcae7 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (spine::SkeletonBatch::allocateVertices(unsigned int)+46) [armeabi-v7a]
17 #16 pc 005f80a9 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (spine::SkeletonRenderer::draw(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+852) [armeabi-v7a]
18 #17 pc 006ef450 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (cocos2d::Node::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+336) [armeabi-v7a]
19 #18 pc 006ef4b0 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (cocos2d::Node::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+432) [armeabi-v7a]
20 #19 pc 0070a544 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (cocos2d::ProtectedNode::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+532) [armeabi-v7a]
21 #20 pc 006ef4b0 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (cocos2d::Node::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+432) [armeabi-v7a]
22 #21 pc 006ef4b0 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (cocos2d::Node::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+432) [armeabi-v7a]
23 #22 pc 006ef4b0 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (cocos2d::Node::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+432) [armeabi-v7a]
24 #23 pc 0070d9e4 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (cocos2d::Scene::render(cocos2d::Renderer*)+300) [armeabi-v7a]
25 #24 pc 00757d74 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (cocos2d::Director::drawScene()+452) [armeabi-v7a]
26 #25 pc 0075a6f8 /data/app/com.c2vl.kgamebox-2/lib/arm/libcocos2dlua.so (cocos2d::DisplayLinkDirector::mainLoop()+48) [armeabi-v7a]
27 #26 pc 0380e7f5 /data/app/com.c2vl.kgamebox-2/oat/arm/base.odex (oatexec+11671541) [armeabi]
28 #27 pc 0380f187 /data/app/com.c2vl.kgamebox-2/oat/arm/base.odex (oatexec+11673991) [armeabi]
29 #28 pc 02fd7715 <removed> (oatexec+14067477) [armeabi]
30 java:
31 org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame(Cocos2dxRenderer.java:101)
32 android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1535)
33 android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)


有些闪退会报另外的错误,如下:
libc : /usr/local/google/buildbot/src/android/ndk-release-r21/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:72: abort_message: assertion "terminating with uncaught exception of type std::bad_alloc: std::bad_alloc" failed

请问能否提供一些解决问题的思路,感谢!
lvxiang15
  • 帖子: 4

Mario

抱歉,添麻烦了! 您可以修改代码,以便知道崩溃发生于哪个骨架,哪个动画以及哪个皮肤/附件吗? 您可以使用能够可靠地重现该问题的设备吗? 问题是立即发生还是仅在一段时间后发生?

Sorry for the trouble! Can you modify your code, such that you know for which skeleton and which animation and which skin/attachments the crash happens? Do you have access to a device that reliably reproduces the issue? Does the issue occur immediately, or only after some time?
头像
Mario

Mario
  • 帖子: 2489

lvxiang15

Mario 写道:抱歉,添麻烦了! 您可以修改代码,以便知道崩溃发生于哪个骨架,哪个动画以及哪个皮肤/附件吗? 您可以使用能够可靠地重现该问题的设备吗? 问题是立即发生还是仅在一段时间后发生?

Sorry for the trouble! Can you modify your code, such that you know for which skeleton and which animation and which skin/attachments the crash happens? Do you have access to a device that reliably reproduces the issue? Does the issue occur immediately, or only after some time?
没有必定重现的方式,要玩一段时间才会出现,可能1个多小时出现,有时可能要6个小时才会出现,不是在同一场景下出现,所以猜测和某个动画无关,目前看小米9se会比较容易出现,不知道这些信息有没有帮助
lvxiang15
  • 帖子: 4

Mario

恐怕无法复制它,仅基于堆栈跟踪就很难提供修复程序。

崩溃本身意味着您的进程内存不足。 但是无法确定这是由于Spine的内存泄漏还是游戏代码引起的。 您可以执行内存分析,以查看可以检测到应用程序中的任何内存泄漏(或使用我们的Spine运行时)。

恐怕如果没有更多这样的信息,从一开始就很难解决。

还请确保您使用来自我们GitHub存储库的最新spine-cocos2dx运行时。 cocos2dx本身附带了一个过时且过时的spine-cocos2dx运行时,该运行时可能存在导致您崩溃的错误。

I'm afraid without being able to reproduce it, it's going to be hard to provide a fix for it just based on the stack trace.

The crash itself means that your process ran out of memory. But it is impossible to say whether this is due to a memory leak in Spine or your game's code. You could perform memory profiling to see you can detect any memory leaks in your application (or your use of our Spine Runtimes).

I'm afraid without more such info, it will be hard to fix this from our end.

Please also make sure that you use the latest spine-cocos2dx runtime from our GitHub repository. cocos2dx itself ships an old and outdated spine-cocos2dx runtime, which may have bugs leading to the crashy you see.
头像
Mario

Mario
  • 帖子: 2489

lvxiang15

请问这个方法我做出如下修改会有什么不好的后果么?
cocos2d::V3F_C4B_T2F* SkeletonBatch::allocateVertices(uint32_t numVertices) {
...code...
_vertices.resize(_vertices.size() + numVertices * 2 + 1);
...code...
}
Mario 写道:恐怕无法复制它,仅基于堆栈跟踪就很难提供修复程序。

崩溃本身意味着您的进程内存不足。 但是无法确定这是由于Spine的内存泄漏还是游戏代码引起的。 您可以执行内存分析,以查看可以检测到应用程序中的任何内存泄漏(或使用我们的Spine运行时)。

恐怕如果没有更多这样的信息,从一开始就很难解决。

还请确保您使用来自我们GitHub存储库的最新spine-cocos2dx运行时。 cocos2dx本身附带了一个过时且过时的spine-cocos2dx运行时,该运行时可能存在导致您崩溃的错误。

I'm afraid without being able to reproduce it, it's going to be hard to provide a fix for it just based on the stack trace.

The crash itself means that your process ran out of memory. But it is impossible to say whether this is due to a memory leak in Spine or your game's code. You could perform memory profiling to see you can detect any memory leaks in your application (or your use of our Spine Runtimes).

I'm afraid without more such info, it will be hard to fix this from our end.

Please also make sure that you use the latest spine-cocos2dx runtime from our GitHub repository. cocos2dx itself ships an old and outdated spine-cocos2dx runtime, which may have bugs leading to the crashy you see.
lvxiang15
  • 帖子: 4


回到 中国Spine用户