【问题标题】:RenderThread SIGABRT渲染线程 SIGABRT
【发布时间】:2018-06-04 09:24:04
【问题描述】:

我收到了使用活动之间共享元素转换的本机崩溃,但仅适用于 Android 8.1 和 Google 设备(Pixel、Pixel 2、Nexus 6P 等...):

pid: 20499, tid: 22683, name: RenderThread  >>> [APPNAME] <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'sp<> assignment detected data race'
    x0   0000000000000000  x1   000000000000589b  x2   0000000000000006  x3   0000000000000008
    x4   0700007411003135  x5   0700007411003135  x6   0700007411003135  x7   3531ffffffffffff
    x8   0000000000000083  x9   0000000010000000  x10  0000007214bf4ca0  x11  0000000000000001
    x12  0000007214bf4dc0  x13  ffffffffffffffff  x14  ffffffffffff0000  x15  ffffffffffffffff
    x16  0000005c0f077fa8  x17  00000072b09c752c  x18  0000000000000008  x19  0000000000005013
    x20  000000000000589b  x21  0000000000000083  x22  00000072249f1f40  x23  00000072249f1f58
    x24  0000007214717590  x25  00000072248393a0  x26  00000072118d9220  x27  0000007214bf5350
    x28  0000007214bf5300  x29  0000007214bf4ce0  x30  00000072b097c760
    sp   0000007214bf4ca0  pc   00000072b097c788  pstate 0000000060000000
backtrace:
    #00 pc 000000000001d788  /system/lib64/libc.so (abort+120)
    #01 pc 0000000000007f08  /system/lib64/liblog.so (__android_log_assert+296)
    #02 pc 0000000000010af4  /system/lib64/libutils.so (android::sp_report_race()+28)
    #03 pc 00000000000fdd08  /system/lib64/libandroid_runtime.so (android::RootRenderNode::detachAnimators()+320)
    #04 pc 00000000000fbcac  /system/lib64/libandroid_runtime.so (android::AnimationContextBridge::destroy()+24)
    #05 pc 000000000006fbd0  /system/lib64/libhwui.so (android::uirenderer::renderthread::Bridge_destroy(android::uirenderer::renderthread::destroyArgs*)+12)
    #06 pc 00000000000718fc  /system/lib64/libhwui.so (android::uirenderer::renderthread::MethodInvokeRenderTask::run()+24)
    #07 pc 0000000000071c70  /system/lib64/libhwui.so (android::uirenderer::renderthread::SignalingRenderTask::run()+28)
    #08 pc 0000000000072a58  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+336)
    #09 pc 0000000000011478  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280)
    #10 pc 00000000000a9814  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
    #11 pc 0000000000067d80  /system/lib64/libc.so (__pthread_start(void*)+36)
    #12 pc 000000000001ec18  /system/lib64/libc.so (__start_thread+68)

如果应用程序在后台,它也会崩溃。我该如何解决这个问题?它似乎只有在启用硬件加速时才会发生,但我真的需要在我的应用程序上启用它。

【问题讨论】:

  • 你找到什么了吗?我收到以下内容,我认为与在通知 07-28 09:24:00.328 21108-21135/? 中使用自定义 RemoteViews 相关联A/libc:致命信号 6 (SIGABRT),tid 21135 (RenderThread) 中的代码 -6,pid 21108 (e.tm.free.debug)
  • 这里有同样的问题,但它发生在 Android 6 到 Android 8.1
  • 最后我发现有 2 个动画同时运行,所以我不得不稍微修改其中一个,使它们不再相互竞争。恐怕这是解决它的唯一方法,直到 Android 团队解决本机库上的问题
  • 我遇到了同样的问题,它是随机发生的。我不知道如何处理它。
  • @ene 它是随机发生的,因为它是一种竞争条件:2 个动画同时在同一个对象上运行。您可以通过禁用或延迟其中一个来修复它(以确保它在另一个完成时运行)。

标签: android crash


【解决方案1】:

我在将 AnimatedVectorDrawable 设置为 ImageView 的背景时遇到了同样的问题。所以基本上我在 recyclerview 的不同行中显示相同的动画,但使用相同的 AnimatedVectorDrawable 对象,这导致了这次崩溃。我通过为单独的 ViewHolders 创建单独的对象来解决它。

【讨论】:

    【解决方案2】:

    在尝试暂停 Activity 之后(或可能同时)尝试重新启动 AnimatedVectorDrawable 的动画循环时(无意中)看到相同的原生堆栈。

    作为参考,动画循环是这样的:

    ((Animatable2)animatable).registerAnimationCallback(new Animatable2.AnimationCallback() {
        @Override
        public void onAnimationEnd(Drawable drawable) {
            animatable.start();
        }
    });
    

    当切换离开应用程序时,记录如下:

    W/WindowManager: Unable to start animation, surface is null or no children.
    

    后跟类似的本机堆栈以用于竞争条件:

    A/DEBUG: backtrace:
    A/DEBUG:     #00 pc 0000000000021abc  /system/lib64/libc.so (abort+124)
    A/DEBUG:     #01 pc 00000000000080f8  /system/lib64/liblog.so (__android_log_assert+296)
    A/DEBUG:     #02 pc 000000000000f26c  /system/lib64/libutils.so (android::sp_report_race()+28)
    A/DEBUG:     #03 pc 000000000010d698  /system/lib64/libandroid_runtime.so (android::RootRenderNode::detachAnimators()+320)
    A/DEBUG:     #04 pc 000000000010b768  /system/lib64/libandroid_runtime.so (android::AnimationContextBridge::destroy()+24)
    A/DEBUG:     #05 pc 00000000005d211c  /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::destroy()+124)
    A/DEBUG:     #06 pc 00000000005d5550  /system/lib64/libhwui.so (std::__1::packaged_task<void ()>::operator()()+88)
    A/DEBUG:     #07 pc 00000000005870b0  /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+168)
    A/DEBUG:     #08 pc 00000000001fd60c  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+244)
    A/DEBUG:     #09 pc 000000000000fb80  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280)
    A/DEBUG:     #10 pc 0000000000083114  /system/lib64/libc.so (__pthread_start(void*)+36)
    A/DEBUG:     #11 pc 00000000000233bc  /system/lib64/libc.so (__start_thread+68)
    

    这已经停止了问题 - 它应该一直存在于 Activity 类中:

    @Override
    protected void onPause() {
        super.onPause();
    
        animatable.stop();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-02
      • 1970-01-01
      • 2012-06-21
      • 2021-07-17
      • 1970-01-01
      • 2011-08-20
      • 1970-01-01
      相关资源
      最近更新 更多