Skip to content

Crash generated by DrawableUtils #1952

Description

@HDESTRADAP

Stack trace

Error, cannot access an invalid/free'd bitmap here!
runtime.cc:691] All threads:
runtime.cc:691] DALVIK THREADS (325):
runtime.cc:691] "main" prio=10 tid=1 Runnable
runtime.cc:691]   | group="" sCount=0 ucsCount=0 flags=0 obj=0x723401c8 self=0xb4000070906796f0
runtime.cc:691]   | sysTid=13154 nice=-10 cgrp=top-app sched=0/0 handle=0x733e78b4f8
runtime.cc:691]   | state=R schedstat=( 36312776301 4115807481 43801 ) utm=3283 stm=348 core=1 HZ=100
runtime.cc:691]   | stack=0x7fd27e9000-0x7fd27eb000 stackSize=8188KB
runtime.cc:691]   | held mutexes= "abort lock" "mutator lock"(shared held)
runtime.cc:691]   native: #00 pc 00438384  /apex/com.android.art/lib64/libart.so (art::DumpNativeStack+108) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #01 pc 00474f5c  /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack const+828) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #02 pc 00474624  /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run+208) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #03 pc 0035036c  /apex/com.android.art/lib64/libart.so (art::ThreadList::RunCheckpoint+452) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #04 pc 007c6674  /apex/com.android.art/lib64/libart.so (art::ThreadList::Dump+1716) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #05 pc 007913c4  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort+2140) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #06 pc 000357d0  /apex/com.google.mainline.primary.libs@340724000/lib64/libbase.so/5cbcb48dc4a1ceb71422e6e07e9f12bb952b969b1d4789234c07c3b6241482a6f3a09733800aa23496f3dcd787dd1ded12735fe6dc5b3049d050d96b769bc049/libbase.so (android::base::SetAborter::$_0::__invoke+80) (BuildId: 9facd15119941cde449a7a03cf8ba918)
runtime.cc:691]   native: #07 pc 00012360  /system/lib64/liblog.so (__android_log_assert+256) (BuildId: e930db2fe39e163137e5bb0c456a8953)
runtime.cc:691]   native: #08 pc 00317fc0  /system/lib64/libhwui.so (android::CanvasJNI::initRaster +156) (BuildId: 1178351e2ee9668d0f2e2865813d9ee6)
runtime.cc:691]   native: #09 pc 00377030  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #10 pc 00360880  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #11 pc 00490738  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>+1380) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #12 pc 0050a2f8  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>+1648) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #13 pc 003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #14 pc 003f1ef0  /system/framework/framework.jar (android.graphics.Canvas.<init>)
runtime.cc:691]   native: #15 pc 0037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute +356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #16 pc 0037c560  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+672) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #17 pc 00377168  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #18 pc 02107f9c  /memfd:jit-cache (deleted) (offset 2000000) (com.datadog.android.sessionreplay.internal.recorder.wrappers.CanvasWrapper.createCanvas$dd_sdk_android_session_replay_release+156)
runtime.cc:691]   native: #19 pc 020c9348  /memfd:jit-cache (deleted) (offset 2000000) (com.datadog.android.sessionreplay.internal.utils.DrawableUtils.drawOnCanvas+296)
runtime.cc:691]   native: #20 pc 0215d3fc  /memfd:jit-cache (deleted) (offset 2000000) (com.datadog.android.sessionreplay.internal.utils.DrawableUtils.access$drawOnCanvas+108)
runtime.cc:691]   native: #21 pc 020d42c4  /memfd:jit-cache (deleted) (offset 2000000) (com.datadog.android.sessionreplay.internal.utils.DrawableUtils$createBitmapOfApproxSizeFromDrawable$1$1.onSuccess$lambda$0+292)
runtime.cc:691]   native: #22 pc 0215c648  /memfd:jit-cache (deleted) (offset 2000000) (com.datadog.android.sessionreplay.internal.utils.DrawableUtils$createBitmapOfApproxSizeFromDrawable$1$1.$r8$lambda$BrJKCxiqQUQ1PjYLdsF0hj-twAM+104)
runtime.cc:691]   native: #23 pc 020d446c  /memfd:jit-cache (deleted) (offset 2000000) (com.datadog.android.sessionreplay.internal.utils.DrawableUtils$createBitmapOfApproxSizeFromDrawable$1$1$$ExternalSyntheticLambda0.run+172)
runtime.cc:691]   native: #24 pc 003605a4  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #25 pc 004906b4  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>+1248) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #26 pc 0050aca4  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>+4124) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #27 pc 003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #28 pc 001d6bb4  /system/framework/framework.jar (android.os.Handler.handleCallback)
runtime.cc:691]   native: #29 pc 0037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute +356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #30 pc 0049120c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>+4152) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #31 pc 0050a2f8  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>+1648) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #32 pc 003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #33 pc 001d69fc  /system/framework/framework.jar (android.os.Handler.dispatchMessage)
runtime.cc:691]   native: #34 pc 0037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute +356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #35 pc 0037c560  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+672) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #36 pc 00377168  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #37 pc 02034498  /memfd:jit-cache (deleted) (offset 2000000) (android.os.Looper.loopOnce+1496)
runtime.cc:691]   native: #38 pc 00360880  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #39 pc 00490738  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>+1380) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #40 pc 0050a2f8  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>+1648) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #41 pc 003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #42 pc 001fc57c  /system/framework/framework.jar (android.os.Looper.loop)
runtime.cc:691]   native: #43 pc 0037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute +356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #44 pc 0049120c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>+4152) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #45 pc 0050a2f8  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>+1648) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #46 pc 003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #47 pc 001c3970  /system/framework/framework.jar (android.app.ActivityThread.main)
runtime.cc:691]   native: #48 pc 0037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute +356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #49 pc 0037c560  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+672) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #50 pc 00377168  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #51 pc 00360880  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #52 pc 0026a904  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<8>+780) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #53 pc 0026a5e8  /apex/com.android.art/lib64/libart.so (art::Method_invoke +32) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #54 pc 00377030  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #55 pc 003605a4  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #56 pc 004906b4  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>+1248) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #57 pc 00509f94  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>+780) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #58 pc 003797d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #59 pc 0050cd00  /system/framework/framework.jar (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run)
runtime.cc:691]   native: #60 pc 0037cde0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute +356) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #61 pc 0037c560  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+672) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   native: #62 pc 00377168  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: b10f5696fea1b32039b162aef3850ed3)
runtime.cc:691]   at android.graphics.Canvas.nInitRaster(Native method)
runtime.cc:691]   at android.graphics.Canvas.<init>(Canvas.java:117)
runtime.cc:691]   at com.datadog.android.sessionreplay.internal.recorder.wrappers.CanvasWrapper.createCanvas$dd_sdk_android_session_replay_release(CanvasWrapper.kt:19)
runtime.cc:691]   at com.datadog.android.sessionreplay.internal.utils.DrawableUtils.drawOnCanvas(DrawableUtils.kt:118)
runtime.cc:691]   at com.datadog.android.sessionreplay.internal.utils.DrawableUtils.access$drawOnCanvas(DrawableUtils.kt:31)
runtime.cc:691]   at com.datadog.android.sessionreplay.internal.utils.DrawableUtils$createBitmapOfApproxSizeFromDrawable$1$1.onSuccess$lambda$0(DrawableUtils.kt:68)

Reproduction steps

We can't replicate with a barebones project, this just started happening in our App.
We were using Datadog v2.4.0 (this is were the crash started to happen) We've been using that version for a few months.

We also got this crash: #1795 . So we updated to v2.71 as a first step. However, we're still getting the Canvas/DrawableUtils crash.

From the error message it seems there's an issue with Bitmap manipulation at Datadog SDK level:

Error, cannot access an invalid/free'd bitmap here!

Volume

Not yet in Production

Affected SDK versions

33

Latest working SDK version

33

Does the crash manifest in the latest SDK version?

Yes

Kotlin / Java version

Kotlin 1.8.10

Gradle / AGP version

8.3.0

Other dependencies versions

No response

Device Information

No response

Other relevant information

We are using SessionReplay.

val sessionReplayConfig = SessionReplayConfiguration.Builder(dataDogSamplingRateAndroid)
                .addExtensionSupport(MaterialExtensionSupport())
                .setPrivacy(SessionReplayPrivacy.MASK)
                .build()
            SessionReplay.enable(sessionReplayConfig)

If we disable this code, then the App doesn't crash.

Metadata

Metadata

Assignees

Labels

crashSDK induced crash

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions