致命信号11(SIGSEGV),代码1,tid 7061中的故障地址0x28(GLThread 42829)

时间:2016-09-30 14:28:01

标签: java android opengl-es

我正在编写一个Android应用程序,通过OpenGL ES在本机端进行图形渲染。当我在调试模式下编译它时,应用程序崩溃,但在发布模式下不会崩溃。我已经检测到它只是在设置渲染器时发生,就在它完成对(In [19]: import numpy as np In [20]: float_list = np.array([167.233, 95.6242, 181.367, 20.6354, 147.505, 41.9396, 20.3126]) # In [22]: np.split(float_list, np.where(np.diff(float_list) > 0)[0] + 1) # Out[22]: # [array([ 167.233 , 95.6242]), # array([ 181.367 , 20.6354]), # array([ 147.505 , 41.9396, 20.3126])] In [23]: map(len, np.split(float_list, np.where(np.diff(float_list) > 0)[0] + 1)) Out[23]: [2, 2, 3] )函数的调用时。发生的其他事情是当我在onSurfaceCreated行中放置一个断点时,即使我没有进入,只需继续程序的正常流程,然后它就不会崩溃。似乎存在线程同步问题,但我无法弄清楚如何解决它。

这是我的渲染器类

XXXActivity.nativeSurfaceCreated();

}

这是我的堆栈:

public class Renderer implements GLSurfaceView.Renderer {

public Renderer(Context ctx)
{

}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    XXXActivity.nativeSurfaceCreated();
}

public void onSurfaceChanged(GL10 gl, int w, int h) {
    XXXActivity.nativeSurfaceChanged(w, h); //HERE is the problem just when it finish the execution of this line.
}

public void onDrawFrame(GL10 gl) {
        XXXActivity.nativeDrawFrame();
}

这是后面的跟踪

    F/art     (26519): art/runtime/mirror/object.cc:190] Invalid state during hashcode ForwardingAddress

F/art     (26519): art/runtime/runtime.cc:284] Runtime aborting --- recursively, so no thread-specific detail!

F/art     (26519): art/runtime/runtime.cc:284] 

--------- beginning of crash

F/libc    (26519): Fatal signal 6 (SIGABRT), code -6 in tid 26533 (HeapTrimmerDaem)

I/DEBUG   (  299): [2016-09-28 10:42:59.064]

I/DEBUG   (  299): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

I/DEBUG   (  299): Build fingerprint: 'lge/w7_tmo_us/w7:5.0.2/LRX22G/150651744a25e:user/release-keys'

I/DEBUG   (  299): Revision: '6'

I/DEBUG   (  299): ABI: 'arm'

I/DEBUG   (  299): pid: 26519, tid: 26533, name: HeapTrimmerDaem  >>> com.XXX.ar.XXX <<<

I/DEBUG   (  299): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------

W/NativeCrashListener(  972): Couldn't find ProcessRecord for pid 1530015793

I/DEBUG   (  299): Abort message: 'art/runtime/gc/collector/semi_space-inl.h:37] Check failed: IsAligned<kPageSize>(obj) '

E/DEBUG   (  299): AM write failure (32 / Broken pipe)

I/DEBUG   (  299):     r0 00000000  r1 000067a5  r2 00000006  r3 00000000

I/DEBUG   (  299):     r4 a452edd8  r5 00000006  r6 00000002  r7 0000010c

I/DEBUG   (  299):     r8 00000001  r9 b78f2f48  sl b7eabab0  fp b81c5550

I/DEBUG   (  299):     ip 000067a5  sp a452e288  lr b6ec57f5  pc b6eed344  cpsr 60070010

I/DEBUG   (  299): 

I/DEBUG   (  299): backtrace:

I/DEBUG   (  299):     #00 pc 0003b344  /system/lib/libc.so (tgkill+12)

I/DEBUG   (  299):     #01 pc 000137f1  /system/lib/libc.so (pthread_kill+52)

I/DEBUG   (  299):     #02 pc 00014403  /system/lib/libc.so (raise+10)

I/DEBUG   (  299):     #03 pc 00010c55  /system/lib/libc.so (__libc_android_abort+36)

I/DEBUG   (  299):     #04 pc 0000f3f4  /system/lib/libc.so (abort+4)

I/DEBUG   (  299):     #05 pc 00226ccf  /system/lib/libart.so (art::Runtime::Abort()+170)

I/DEBUG   (  299):     #06 pc 000a6c59  /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)

I/DEBUG   (  299):     #07 pc 001efbb3  /system/lib/libart.so (art::mirror::Object::IdentityHashCode() const+390)

I/DEBUG   (  299):     #08 pc 001f4223  /system/lib/libart.so (art::Monitor::DescribeWait(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread const*)+306)

I/DEBUG   (  299):     #09 pc 00234627  /system/lib/libart.so (art::StackDumpVisitor::VisitFrame()+358)

I/DEBUG   (  299):     #10 pc 0022e8ad  /system/lib/libart.so (art::StackVisitor::WalkStack(bool)+272)

I/DEBUG   (  299):     #11 pc 00236d69  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+224)

I/DEBUG   (  299):     #12 pc 0023fc1d  /system/lib/libart.so (art::ThreadList::DumpLocked(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+120)

I/DEBUG   (  299):     #13 pc 00226a2d  /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+272)

I/DEBUG   (  299):     #14 pc 00226c77  /system/lib/libart.so (art::Runtime::Abort()+82)

I/DEBUG   (  299):     #15 pc 000a6c59  /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)

I/DEBUG   (  299):     #16 pc 0012d2f1  /system/lib/libart.so (art::gc::collector::BitmapSetSlowPathVisitor::operator()(art::mirror::Object const*) const+160)

I/DEBUG   (  299):     #17 pc 0012f5cf  /system/lib/libart.so (void art::mirror::Object::VisitReferences<true, (art::VerifyObjectFlags)0, art::gc::collector::SemiSpaceMarkObjectVisitor, art::gc::collector::SemiSpaceMarkObjectVisitor>(art::gc::collector::SemiSpaceMarkObjectVisitor const&, art::gc::collector::SemiSpaceMarkObjectVisitor const&)+1122)

I/DEBUG   (  299):     #18 pc 0013061b  /system/lib/libart.so (art::gc::collector::SemiSpace::ProcessMarkStack()+126)

I/DEBUG   (  299):     #19 pc 001307a9  /system/lib/libart.so (art::gc::collector::SemiSpace::MarkReachableObjects()+324)

I/DEBUG   (  299):     #20 pc 00130beb  /system/lib/libart.so (art::gc::collector::SemiSpace::MarkingPhase()+370)

I/DEBUG   (  299):     #21 pc 0012e479  /system/lib/libart.so (art::gc::collector::SemiSpace::RunPhases()+480)

I/DEBUG   (  299):     #22 pc 00121e37  /system/lib/libart.so (art::gc::collector::GarbageCollector::Run(art::gc::GcCause, bool)+246)

I/DEBUG   (  299):     #23 pc 00134657  /system/lib/libart.so (art::gc::Heap::Compact(art::gc::space::ContinuousMemMapAllocSpace*, art::gc::space::ContinuousMemMapAllocSpace*, art::gc::GcCause)+58)

I/DEBUG   (  299):     #24 pc 00138fa3  /system/lib/libart.so (art::gc::Heap::PerformHomogeneousSpaceCompact()+1818)

I/DEBUG   (  299):     #25 pc 0013fcc7  /system/lib/libart.so (art::gc::Heap::DoPendingTransitionOrTrim()+818)

I/DEBUG   (  299):     #26 pc 0001bd93  /system/framework/arm/boot.oat

I/DEBUG   (  299): 

I/DEBUG   (  299): Tombstone written to: /data/tombstones/tombstone_05

I/BootReceiver(  972): Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)

I/Zygote  (  325): Process 26519 exited due to signal (6)

1 个答案:

答案 0 :(得分:0)

我设法解决了自己的问题。碰巧我在XXXActivity.nativeSurfaceCreated();中初始化了一个与纹理相关的代码,但不知怎的XXXActivity.nativeDrawFrame();我在XXXActivity.nativeSurfaceCreated();之前绘制了纹理,并且由于没有创建该资源,它引发了崩溃,这就是OpenGL线程崩溃的原因。我将代码移到nativeDrawFrame中进行初始化一次。它可能不是必须美丽的解决方案,但它的工作原理。如果有人有其他解决方案,请不要犹豫在这里发布。