App random crashes with Fatal signal 7 (SIGBUS), c

2019-03-17 22:07发布

Context

I'm creating an app that's supposed to show some images on a Fragment, most of them downloaded from the internet.

I'm using Glide to handle that image loading for me on my CardViews and Fresco on my image slider (And this question on SO explains why I'm using two image libs).

The Fresco part of the lib is mostly based on this fork of the AndroidImageSlider.

Important: The images that I'm trying to load can either be PNG or SVG.

More info: I'm using a Moto Maxx (international version of the Droid Turbo) running Android 5.0.2. Also happened on a Samsung Galaxy S4 running Android 4.4.2 (cyanogen mod), but it happens a lot less often.

P.S.: I'm NOT using NDK.

The problem

Sometimes, my app just crashes, out of nowhere, and even without any user interaction. And when it does, I'm getting the following error message on the logcat:

Fatal signal 7 (SIGBUS), code 2, fault addr 0x9a74c060 in tid 21894

Full stack:

04-07 07:59:08.110 21894 21894 F libc    : Fatal signal 7 (SIGBUS), code 2, fault addr 0x9a74c060 in tid 21894 (asus.saitestore)
04-07 07:59:08.161 21946 21946 E Diag_Lib:  Diag_LSM_Init: Failed to open handle to diag driver, error = 2
04-07 07:59:08.263   333   333 I DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-07 07:59:08.263   333   333 I DEBUG   : Build fingerprint: 'motorola/quark_retbr/quark_umts:5.0.2/LXG22.33-12.16/16:user/release-keys'
04-07 07:59:08.263   333   333 I DEBUG   : Revision: 'p4a0'
04-07 07:59:08.263   333   333 I DEBUG   : ABI: 'arm'
04-07 07:59:08.263   333   333 I DEBUG   : pid: 21894, tid: 21894, name: asus.saitestore  >>> org.unasus.saitestore <<<
04-07 07:59:08.264   333   333 I DEBUG   : signal 7 (SIGBUS), code 2 (BUS_ADRERR), fault addr 0x9a74c060
04-07 07:59:08.446   333   333 I DEBUG   :     r0 00000000  r1 bead50cc  r2 00000000  r3 9dae4000
04-07 07:59:08.446   333   333 I DEBUG   :     r4 9dae4000  r5 9a74c060  r6 bead50d4  r7 00000001
04-07 07:59:08.446   333   333 I DEBUG   :     r8 00063054  r9 00000000  sl 000000fe  fp 00000000
04-07 07:59:08.446   333   333 I DEBUG   :     ip 00000000  sp bead5094  lr b5952d63  pc b5a38426  cpsr 800b0030
04-07 07:59:08.447   333   333 I DEBUG   : 
04-07 07:59:08.447   333   333 I DEBUG   : backtrace:
04-07 07:59:08.447   333   333 I DEBUG   :     #00 pc 001b2426  /system/lib/libskia.so (S32_opaque_D32_nofilter_DX_neon(SkBitmapProcState const&, unsigned int const*, int, unsigned int*)+141)
04-07 07:59:08.447   333   333 I DEBUG   :     #01 pc 000ccd61  /system/lib/libskia.so (SkBitmapProcShader::BitmapProcShaderContext::shadeSpan(int, int, unsigned int*, int)+86)
04-07 07:59:08.447   333   333 I DEBUG   :     #02 pc 000d6cff  /system/lib/libskia.so (SkARGB32_Shader_Blitter::blitV(int, int, int, unsigned char)+528)
04-07 07:59:08.447   333   333 I DEBUG   :     #03 pc 001076c1  /system/lib/libskia.so
04-07 07:59:08.447   333   333 I DEBUG   :     #04 pc 0010782d  /system/lib/libskia.so
04-07 07:59:08.447   333   333 I DEBUG   :     #05 pc 001078b9  /system/lib/libskia.so
04-07 07:59:08.447   333   333 I DEBUG   :     #06 pc 00107cf3  /system/lib/libskia.so (SkScan::AntiFillRect(SkRect const&, SkRegion const*, SkBlitter*)+178)
04-07 07:59:08.447   333   333 I DEBUG   :     #07 pc 0010804b  /system/lib/libskia.so (SkScan::AntiFillRect(SkRect const&, SkRasterClip const&, SkBlitter*)+14)
04-07 07:59:08.447   333   333 I DEBUG   :     #08 pc 000e2031  /system/lib/libskia.so (SkDraw::drawRect(SkRect const&, SkPaint const&) const+252)
04-07 07:59:08.447   333   333 I DEBUG   :     #09 pc 000e3513  /system/lib/libskia.so (SkDraw::drawBitmap(SkBitmap const&, SkMatrix const&, SkPaint const&) const+276)
04-07 07:59:08.447   333   333 I DEBUG   :     #10 pc 000db7c5  /system/lib/libskia.so
04-07 07:59:08.447   333   333 I DEBUG   :     #11 pc 000db8ad  /system/lib/libskia.so (SkCanvas::drawBitmap(SkBitmap const&, float, float, SkPaint const*)+116)
04-07 07:59:08.447   333   333 I DEBUG   :     #12 pc 000f97bb  /system/lib/libskia.so (SkPicturePlayback::draw(SkCanvas&, SkDrawPictureCallback*)+1186)
04-07 07:59:08.447   333   333 I DEBUG   :     #13 pc 000b54c7  /system/framework/arm/boot.oat
04-07 07:59:09.190   333   333 I DEBUG   : Tombstone written to: /data/tombstones/tombstone_08
04-07 07:59:09.205   806   828 I BootReceiver: Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)

Once, it also gave me a different error message:

Fatal signal 11 (SIGSEGV), code 1, fault addr 0x9abe300c in tid 30052

And the full stack:

04-04 15:41:34.059: A/libc(30052): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x9abe300c in tid 30052 (asus.saitestore)
04-04 15:41:34.161: I/DEBUG(28994): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-04 15:41:34.161: I/DEBUG(28994): Build fingerprint: 'motorola/quark_retbr/quark_umts:5.0.2/LXG22.33-12.16/16:user/release-keys'
04-04 15:41:34.161: I/DEBUG(28994): Revision: 'p4a0'
04-04 15:41:34.161: I/DEBUG(28994): ABI: 'arm'
04-04 15:41:34.161: I/DEBUG(28994): pid: 30052, tid: 30052, name: asus.saitestore  >>> org.unasus.saitestore <<<
04-04 15:41:34.161: I/DEBUG(28994): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x9abe300c
04-04 15:41:34.177: I/DEBUG(28994):     r0 00000000  r1 bede70a4  r2 00000000  r3 9ce89000
04-04 15:41:34.178: I/DEBUG(28994):     r4 9ce89000  r5 9abe300c  r6 bede70ac  r7 00000001
04-04 15:41:34.178: I/DEBUG(28994):     r8 00000000  r9 00000000  sl 000000fe  fp 00000000
04-04 15:41:34.178: I/DEBUG(28994):     ip 00000000  sp bede706c  lr b5992d63  pc b5a78426  cpsr 800b0030
04-04 15:41:34.178: I/DEBUG(28994): backtrace:
04-04 15:41:34.178: I/DEBUG(28994):     #00 pc 001b2426  /system/lib/libskia.so (S32_opaque_D32_nofilter_DX_neon(SkBitmapProcState const&, unsigned int const*, int, unsigned int*)+141)
04-04 15:41:34.178: I/DEBUG(28994):     #01 pc 000ccd61  /system/lib/libskia.so (SkBitmapProcShader::BitmapProcShaderContext::shadeSpan(int, int, unsigned int*, int)+86)
04-04 15:41:34.178: I/DEBUG(28994):     #02 pc 000d6cff  /system/lib/libskia.so (SkARGB32_Shader_Blitter::blitV(int, int, int, unsigned char)+528)
04-04 15:41:34.178: I/DEBUG(28994):     #03 pc 0010721d  /system/lib/libskia.so
04-04 15:41:34.178: I/DEBUG(28994):     #04 pc 00107669  /system/lib/libskia.so
04-04 15:41:34.178: I/DEBUG(28994):     #05 pc 0010782d  /system/lib/libskia.so
04-04 15:41:34.178: I/DEBUG(28994):     #06 pc 001078b9  /system/lib/libskia.so
04-04 15:41:34.178: I/DEBUG(28994):     #07 pc 00107cf3  /system/lib/libskia.so (SkScan::AntiFillRect(SkRect const&, SkRegion const*, SkBlitter*)+178)
04-04 15:41:34.179: I/DEBUG(28994):     #08 pc 0010804b  /system/lib/libskia.so (SkScan::AntiFillRect(SkRect const&, SkRasterClip const&, SkBlitter*)+14)
04-04 15:41:34.179: I/DEBUG(28994):     #09 pc 000e2031  /system/lib/libskia.so (SkDraw::drawRect(SkRect const&, SkPaint const&) const+252)
04-04 15:41:34.179: I/DEBUG(28994):     #10 pc 000e3513  /system/lib/libskia.so (SkDraw::drawBitmap(SkBitmap const&, SkMatrix const&, SkPaint const&) const+276)
04-04 15:41:34.179: I/DEBUG(28994):     #11 pc 000db7c5  /system/lib/libskia.so
04-04 15:41:34.179: I/DEBUG(28994):     #12 pc 000db8ad  /system/lib/libskia.so (SkCanvas::drawBitmap(SkBitmap const&, float, float, SkPaint const*)+116)
04-04 15:41:34.179: I/DEBUG(28994):     #13 pc 000f97bb  /system/lib/libskia.so (SkPicturePlayback::draw(SkCanvas&, SkDrawPictureCallback*)+1186)
04-04 15:41:34.179: I/DEBUG(28994):     #14 pc 000b54c7  /system/framework/arm/boot.oat
04-04 15:41:34.820: I/DEBUG(28994): Tombstone written to: /data/tombstones/tombstone_07
04-04 15:41:34.821: I/BootReceiver(1989): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)

EDIT: Also happened on a Samsung Galaxy S4, tombstone can be found here.

How I'm loading the images

Inside my CardAdapter, I'm loading the images like this (The SVG part was taken from here):

if (mod.getImg_type() == ImageTypes.SVG) {
    GenericRequestBuilder<Uri, InputStream, SVG, PictureDrawable> requestBuilder;

    SVGDecoder decoder = new SVGDecoder(PreserveAspectRatio.STRETCH);

    requestBuilder = Glide.with(mContext)
            .using(Glide.buildStreamModelLoader(Uri.class, mContext), InputStream.class)
            .from(Uri.class)
            .as(SVG.class)
            .transcode(new SvgDrawableTranscoder(), PictureDrawable.class)
            .sourceEncoder(new StreamEncoder())
            .cacheDecoder(new FileToStreamDecoder<>(decoder))
            .decoder(decoder)
            .placeholder(R.drawable.modulo)
            .error(R.drawable.banner_error)
            .animate(android.R.anim.fade_in)
            .listener(new SvgSoftwareLayerSetter<Uri>());

    requestBuilder
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .load(Uri.parse(mod.getUrl_icon()))
            .into(cardHolder.iv_card);
}
else {
    Glide.with(mContext)
            .load(mod.getUrl_icon())
            .placeholder(R.drawable.modulo)
            .error(R.drawable.banner_error)
            .centerCrop()
            .crossFade()
            .into(cardHolder.iv_card);
}

And the XML file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/card_view"
    android:layout_width="@dimen/card_w"
    android:layout_height="@dimen/card_h"
    android:layout_margin="5dp"
    android:stateListAnimator="@anim/raise"
    card_view:cardCornerRadius="0dp"
    android:foreground="?android:attr/selectableItemBackground">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/rl_card">


        <ImageView
            android:layout_width="@dimen/card_image_w"
            android:layout_height="@dimen/card_image_h"
            android:layout_centerHorizontal="true"
            android:scaleType="fitXY"
            android:id="@+id/iv_card"
            android:src="@drawable/modulo"
            android:layout_margin="@dimen/spacing_medium" />

        <TextView
            android:id="@+id/tv_card"
            android:layout_width="@dimen/card_text_w"
            android:layout_height="@dimen/card_text_h"
            android:maxHeight="@dimen/card_text_h"
            android:maxWidth="@dimen/card_text_w"
            android:layout_below="@+id/iv_card"
            android:layout_centerHorizontal="true"
            android:ellipsize="end"
            android:maxLines="1"
            android:singleLine="true"
            android:text="Bacon ipsum dolor amet duis short ribs nostrud esse tempor."
            android:textSize="12sp"
            android:gravity="center_horizontal"
            android:layout_marginLeft="@dimen/spacing_medium"
            android:layout_marginRight="@dimen/spacing_medium" />

        <View
            android:id="@+id/card_check"
            android:layout_width="match_parent"
            android:layout_height="@dimen/card_check_h"
            android:maxHeight="@dimen/card_check_h"
            android:layout_below="@+id/tv_card"
            android:background="@color/primary_light"
            android:layout_alignParentBottom="true" />
    </RelativeLayout>

</android.support.v7.widget.CardView>

What have I found so far

I've found a few questions here on SO, but none of them really helped with my problem. And it's a bit hard to reproduce it. Sometimes the app doesn't crash at all, even after 30 minutes on the faulty screen. On the other hand, it happened just after the images were shown.

Some questions I've found:

And many others...

And here's a screenshot from the app, taken from the bug report generated by my phone:

screenshot

I have seen in some places that this problem might be related to low memory. But I think that's unlikely, since my phone got 3GB or RAM, and I'm loading fewer images comparing to the native gallery app (which is not crashing on my phone).

On the other hand, the thread on the skia issue tracker suggests it's related to the SVG lib.

Update: I've found this link on the Android issue tracker, and this one on the skia issue tracker, which is most likely related to the problem.

Other update: I've removed the slider, and the app stopped crashing. I guess the problem is in there.

Yet another update: I've changed the slider to load only PNG or only SVG in a given time. The app only crashed while loading the SVG images. So perhaps the problem is on the SVG lib.

Loading the SVG from a file also crashes.

0条回答
登录 后发表回答