davemorrissey / subsampling-scale-image-view

Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.
Apache License 2.0
7.88k stars 1.2k forks source link

Crash when opening HEIC and zoom in #559

Open tprochazka opened 3 years ago

tprochazka commented 3 years ago

Hard to say now if it is an Android bug or this library issue. But when I use it with HEIC it always crashes on Android 11, I tested the emulator and also the Samsung device.

Maybe it is because it creates too many parallel decoding threads because normal decoding of one heic image works without a crash. It crashes only when I zoom in enough to enable the tiling mechanism.

2021-09-16 17:56:10.265 4532-4643/ E/HeifDecoderImpl: getSize: not supported!
2021-09-16 17:56:10.335 4532-4643/ E/HeifDecoderImpl: getSize: not supported!
2021-09-16 17:56:10.343 4532-4643/ E/HeifDecoderImpl: getSize: not supported!
2021-09-16 17:56:10.374 4532-4643/ E/HeifDecoderImpl: getSize: not supported!
2021-09-16 17:56:10.422 4532-4643/ E/HeifDecoderImpl: getSize: not supported!
2021-09-16 17:56:10.430 4532-4643/ E/HeifDecoderImpl: getSize: not supported!
2021-09-16 17:56:10.465 435-460/? E/OMXNodeInstance: getConfig(0xed141430:google.hevc.decoder, ConfigAndroidVendorExtension(0x6f100004)) ERROR: UnsupportedIndex(0x8000101a)
2021-09-16 17:56:11.717 435-460/? E/OMXNodeInstance: getConfig(0xed141430:google.hevc.decoder, ConfigAndroidVendorExtension(0x6f100004)) ERROR: UnsupportedIndex(0x8000101a)
2021-09-16 17:56:11.880 522-1389/system_process E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
2021-09-16 17:56:14.558 435-462/? E/OMXNodeInstance: getConfig(0xed141430:google.hevc.decoder, ConfigAndroidVendorExtension(0x6f100004)) ERROR: UnsupportedIndex(0x8000101a)
2021-09-16 17:56:14.827 4532-5852/ A/RefBase: decStrong() called on 0xb6a16bb0 too many times
2021-09-16 17:56:14.882 435-462/? E/OMXNodeInstance: getConfig(0xed141430:google.hevc.decoder, ConfigAndroidVendorExtension(0x6f100004)) ERROR: UnsupportedIndex(0x8000101a)
2021-09-16 17:56:15.447 4532-5852/ A/android.cleane: runtime.cc:655] Runtime aborting...
    runtime.cc:655] Dumping all threads without mutator lock held
    runtime.cc:655] All threads:
    runtime.cc:655] DALVIK THREADS (110):
    runtime.cc:655] "HeifDecode" prio=6 tid=39 Runnable
    runtime.cc:655]   | group="" sCount=0 dsCount=0 flags=0 obj=0x13900040 self=0xe2ad8810
    runtime.cc:655]   | sysTid=5852 nice=-2 cgrp=top-app sched=0/0 handle=0xb407c1e0
    runtime.cc:655]   | state=R schedstat=( 8536198 1876185 42 ) utm=0 stm=0 core=0 HZ=100
    runtime.cc:655]   | stack=0xb3f81000-0xb3f83000 stackSize=1008KB
    runtime.cc:655]   | held mutexes= "abort lock" "mutator lock"(shared held)
    runtime.cc:655]   native: #00 pc 00544bfe  /apex/com.android.art/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+110)
    runtime.cc:655]   native: #01 pc 006a26f7  /apex/com.android.art/lib/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+1015)
    runtime.cc:655]   native: #02 pc 0069bfd1  /apex/com.android.art/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+65)
    runtime.cc:655]   native: #03 pc 006c8014  /apex/com.android.art/lib/libart.so (art::DumpCheckpoint::Run(art::Thread*)+1172)
    runtime.cc:655]   native: #04 pc 006c10c6  /apex/com.android.art/lib/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+630)
    runtime.cc:655]   native: #05 pc 006c002e  /apex/com.android.art/lib/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool)+2446)
    runtime.cc:655]   native: #06 pc 006540dd  /apex/com.android.art/lib/libart.so (art::AbortState::DumpAllThreads(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*) const+445)
    runtime.cc:655]   native: #07 pc 0063b6af  /apex/com.android.art/lib/libart.so (art::Runtime::Abort(char const*)+1967)
    runtime.cc:655]   native: #08 pc 00025a23  /apex/com.android.art/lib/libartbase.so (std::__1::__function::__func<void (*)(char const*), std::__1::allocator<void (*)(char const*)>, void (char const*)>::operator()(char const*&&)+35)
    runtime.cc:655]   native: #09 pc 0001588f  /system/lib/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+79)
    runtime.cc:655]   native: #10 pc 00006dbd  /system/lib/liblog.so (__android_log_assert+285)
    runtime.cc:655]   native: #11 pc 000102a2  /system/lib/libutils.so (android::RefBase::decStrong(void const*) const+146)
    runtime.cc:655]   native: #12 pc 00004de4  /system/lib/libheif.so (android::HeifDecoderImpl::decodeAsync()+436)
    runtime.cc:655]   native: #13 pc 00004c23  /system/lib/libheif.so (android::HeifDecoderImpl::DecodeThread::threadLoop()+35)
    runtime.cc:655]   native: #14 pc 00015116  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+374)
    runtime.cc:655]   native: #15 pc 00098fee  /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+174)
    runtime.cc:655]   native: #16 pc 000147d9  /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+457)
    runtime.cc:655]   native: #17 pc 000e6974  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+100)
    runtime.cc:655]   native: #18 pc 00078567  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71)
    runtime.cc:655]   (no managed stack frames)
    runtime.cc:655]
    runtime.cc:655] "main" prio=7 tid=1 Native
    runtime.cc:655]   | group="" sCount=1 dsCount=0 flags=1 obj=0x715ef008 self=0xe2ac3810
    runtime.cc:655]   | sysTid=4532 nice=-4 cgrp=top-app sched=0/0 handle=0xf10d2478
    runtime.cc:655]   | state=S schedstat=( 7255181121 2876415249 13437 ) utm=408 stm=316 core=1 HZ=100
    runtime.cc:655]   | stack=0xff43d000-0xff43f000 stackSize=8192KB
    runtime.cc:655]   | held mutexes=
    runtime.cc:655]   native: #00 pc 00000b97  [vdso] (__kernel_vsyscall+7)
2021-09-16 17:56:15.447 4532-5852/ A/android.cleane: runtime.cc:655]   native: #01 pc 0005ad68  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40)
    runtime.cc:655]   native: #02 pc 001d846c  /apex/com.android.art/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+108)
    runtime.cc:655]   native: #03 pc 001d83f3  /apex/com.android.art/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+35)
    runtime.cc:655]   native: #04 pc 003f091f  /apex/com.android.art/lib/libart.so (art::(anonymous namespace)::CheckJNI::ExceptionCheck(_JNIEnv*)+591)
    runtime.cc:655]   native: #05 pc 01afe17e  /data/app/~~sivgFDiKr7-mdsgCdmBTMA==/com.google.android.trichromelibrary_410410681-68IbsquogDsaMt5O837IbQ==/TrichromeLibrary.apk!libmonochrome.so (offset 637000) (???)
    runtime.cc:655]   at android.os.MessageQueue.nativePollOnce(Native method)
    runtime.cc:655]   at android.os.MessageQueue.next(MessageQueue.java:335)
    runtime.cc:655]   at android.os.Looper.loop(Looper.java:183)
    runtime.cc:655]   at android.app.ActivityThread.main(ActivityThread.java:7656)
    runtime.cc:655]   at java.lang.reflect.Method.invoke(Native method)
    runtime.cc:655]   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    runtime.cc:655]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
    runtime.cc:655]
    runtime.cc:655]
    runtime.cc:655] "AsyncTask #4" prio=4 tid=57 Blocked
    runtime.cc:655]   | group="" sCount=1 dsCount=0 flags=1 obj=0x12c88ba8 self=0xe2af6410
    runtime.cc:655]   | sysTid=4677 nice=10 cgrp=top-app sched=0/0 handle=0xb63e91e0
    runtime.cc:655]   | state=S schedstat=( 303141575 594111286 1133 ) utm=14 stm=15 core=1 HZ=100
    runtime.cc:655]   | stack=0xb62e6000-0xb62e8000 stackSize=1040KB
    runtime.cc:655]   | held mutexes=
    runtime.cc:655]   native: #00 pc 00000b97  [vdso] (__kernel_vsyscall+7)
    runtime.cc:655]   native: #01 pc 0005ad68  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40)
    runtime.cc:655]   native: #02 pc 001d6273  /apex/com.android.art/lib/libart.so (art::Mutex::ExclusiveLock(art::Thread*)+403)
    runtime.cc:655]   native: #03 pc 0053927a  /apex/com.android.art/lib/libart.so (void art::Monitor::Lock<(art::LockReason)1>(art::Thread*)+1802)
    runtime.cc:655]   native: #04 pc 005407e2  /apex/com.android.art/lib/libart.so (art::Monitor::MonitorEnter(art::Thread*, art::ObjPtr<art::mirror::Object>, bool)+626)
    runtime.cc:655]   native: #05 pc 0078bbd6  /apex/com.android.art/lib/libart.so (artLockObjectFromCode+70)
    runtime.cc:655]   native: #06 pc 00133095  /apex/com.android.art/lib/libart.so (mterp_op_monitor_enter+21)
    runtime.cc:655]   native: #07 pc 003c0882  /system/framework/framework.jar (android.graphics.BitmapRegionDecoder.decodeRegion+18)
    runtime.cc:655]   native: #08 pc 007a335e  /apex/com.android.art/lib/libart.so (MterpInvokeVirtual+1806)
    runtime.cc:655]   native: #09 pc 00135921  /apex/com.android.art/lib/libart.so (mterp_op_invoke_virtual+33)
    runtime.cc:655]   native: #10 pc 00994224  /data/app/~~T4yy9njta3wCAb1xGEzjhA==/com.avast.android.cleaner-Re-YQOgFeHyiRTKRyIoRGg==/oat/x86/base.vdex (com.davemorrissey.labs.subscaleview.decoder.SkiaImageRegionDecoder.decodeRegion+60)
    runtime.cc:655]   native: #11 pc 007a53be  /apex/com.android.art/lib/libart.so (MterpInvokeInterface+2126)
    runtime.cc:655]   native: #12 pc 00135b21  /apex/com.android.art/lib/libart.so (mterp_op_invoke_interface+33)
    runtime.cc:655]   native: #13 pc 0097b31e  /data/app/~~T4yy9njta3wCAb1xGEzjhA==/com.avast.android.cleaner-Re-YQOgFeHyiRTKRyIoRGg==/oat/x86/base.vdex (com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground+258)
    runtime.cc:655]   native: #14 pc 007a335e  /apex/com.android.art/lib/libart.so (MterpInvokeVirtual+1806)
2021-09-16 17:56:15.451 4532-5852/ A/android.cleane: runtime.cc:655]   native: #15 pc 00135921  /apex/com.android.art/lib/libart.so (mterp_op_invoke_virtual+33)
    runtime.cc:655]   native: #16 pc 0097b410  /data/app/~~T4yy9njta3wCAb1xGEzjhA==/com.avast.android.cleaner-Re-YQOgFeHyiRTKRyIoRGg==/oat/x86/base.vdex (com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground+4)
    runtime.cc:655]   native: #17 pc 007a335e  /apex/com.android.art/lib/libart.so (MterpInvokeVirtual+1806)
    runtime.cc:655]   native: #18 pc 00135921  /apex/com.android.art/lib/libart.so (mterp_op_invoke_virtual+33)
    runtime.cc:655]   native: #19 pc 0034daac  /system/framework/framework.jar (offset 92b000) (android.os.AsyncTask$3.call+40)
    runtime.cc:655]   native: #20 pc 007a53be  /apex/com.android.art/lib/libart.so (MterpInvokeInterface+2126)
    runtime.cc:655]   native: #21 pc 00135b21  /apex/com.android.art/lib/libart.so (mterp_op_invoke_interface+33)
    runtime.cc:655]   native: #22 pc 001ef01a  /apex/com.android.art/javalib/core-oj.jar (java.util.concurrent.FutureTask.run+62)
    runtime.cc:655]   native: #23 pc 007a53be  /apex/com.android.art/lib/libart.so (MterpInvokeInterface+2126)
    runtime.cc:655]   native: #24 pc 00135b21  /apex/com.android.art/lib/libart.so (mterp_op_invoke_interface+33)
    runtime.cc:655]   native: #25 pc 001f9e6a  /apex/com.android.art/javalib/core-oj.jar (java.util.concurrent.ThreadPoolExecutor.runWorker+158)
    runtime.cc:655]   native: #26 pc 007a335e  /apex/com.android.art/lib/libart.so (MterpInvokeVirtual+1806)
    runtime.cc:655]   native: #27 pc 00135921  /apex/com.android.art/lib/libart.so (mterp_op_invoke_virtual+33)
    runtime.cc:655]   native: #28 pc 001f8c2c  /apex/com.android.art/javalib/core-oj.jar (java.util.concurrent.ThreadPoolExecutor$Worker.run+4)
    runtime.cc:655]   native: #29 pc 007a53be  /apex/com.android.art/lib/libart.so (MterpInvokeInterface+2126)
    runtime.cc:655]   native: #30 pc 00135b21  /apex/com.android.art/lib/libart.so (mterp_op_invoke_interface+33)
    runtime.cc:655]   native: #31 pc 000eb7d0  /apex/com.android.art/javalib/core-oj.jar (java.lang.Thread.run+8)
    runtime.cc:655]   native: #32 pc 0036fc82  /apex/com.android.art/lib/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.10914192770458939989)+370)
    runtime.cc:655]   native: #33 pc 00379c80  /apex/com.android.art/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+176)
    runtime.cc:655]   native: #34 pc 0078d185  /apex/com.android.art/lib/libart.so (artQuickToInterpreterBridge+1061)
    runtime.cc:655]   native: #35 pc 0014238d  /apex/com.android.art/lib/libart.so (art_quick_to_interpreter_bridge+77)
    runtime.cc:655]   native: #36 pc 0013baa2  /apex/com.android.art/lib/libart.so (art_quick_invoke_stub+338)
    runtime.cc:655]   native: #37 pc 001d0501  /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+241)
    runtime.cc:655]   native: #38 pc 006311dc  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+620)
    runtime.cc:655]   native: #39 pc 006313f5  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+85)
    runtime.cc:655]   native: #40 pc 00699561  /apex/com.android.art/lib/libart.so (art::Thread::CreateCallback(void*)+1537)
    runtime.cc:655]   native: #41 pc 000e6974  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+100)
    runtime.cc:655]   native: #42 pc 00078567  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71)
    runtime.cc:655]   at android.graphics.BitmapRegionDecoder.decodeRegion(BitmapRegionDecoder.java:192)
2021-09-16 17:56:15.455 4532-5852/ A/android.cleane: runtime.cc:655]   - waiting to lock <0x037ec0e7> (a java.lang.Object) held by thread 29
    runtime.cc:655]   at com.davemorrissey.labs.subscaleview.decoder.SkiaImageRegionDecoder.decodeRegion(SkiaImageRegionDecoder.java:127)
    runtime.cc:655]   at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground(SubsamplingScaleImageView.java:1800)
    runtime.cc:655]   at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground(SubsamplingScaleImageView.java:1771)
    runtime.cc:655]   at android.os.AsyncTask$3.call(AsyncTask.java:394)
    runtime.cc:655]   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    runtime.cc:655]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    runtime.cc:655]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    runtime.cc:655]   at java.lang.Thread.run(Thread.java:923)
    runtime.cc:655]
    runtime.cc:655]
    runtime.cc:655] "AsyncTask #7" prio=4 tid=26 Blocked
    runtime.cc:655]   | group="" sCount=1 dsCount=0 flags=1 obj=0x12c8b558 self=0xe2af0210
    runtime.cc:655]   | sysTid=5646 nice=10 cgrp=top-app sched=0/0 handle=0xbb95b1e0
    runtime.cc:655]   | state=S schedstat=( 48037008 13899459 81 ) utm=4 stm=0 core=1 HZ=100
    runtime.cc:655]   | stack=0xbb858000-0xbb85a000 stackSize=1040KB
    runtime.cc:655]   | held mutexes=
    runtime.cc:655]   native: #00 pc 00000b97  [vdso] (__kernel_vsyscall+7)
    runtime.cc:655]   native: #01 pc 0005ad68  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40)
    runtime.cc:655]   native: #02 pc 001d6273  /apex/com.android.art/lib/libart.so (art::Mutex::ExclusiveLock(art::Thread*)+403)
    runtime.cc:655]   native: #03 pc 0053927a  /apex/com.android.art/lib/libart.so (void art::Monitor::Lock<(art::LockReason)1>(art::Thread*)+1802)
    runtime.cc:655]   native: #04 pc 005407e2  /apex/com.android.art/lib/libart.so (art::Monitor::MonitorEnter(art::Thread*, art::ObjPtr<art::mirror::Object>, bool)+626)
    runtime.cc:655]   native: #05 pc 0078bbd6  /apex/com.android.art/lib/libart.so (artLockObjectFromCode+70)
    runtime.cc:655]   native: #06 pc 00133095  /apex/com.android.art/lib/libart.so (mterp_op_monitor_enter+21)
    runtime.cc:655]   native: #07 pc 003c0882  /system/framework/framework.jar (android.graphics.BitmapRegionDecoder.decodeRegion+18)
    runtime.cc:655]   native: #08 pc 007a335e  /apex/com.android.art/lib/libart.so (MterpInvokeVirtual+1806)
    runtime.cc:655]   native: #09 pc 00135921  /apex/com.android.art/lib/libart.so (mterp_op_invoke_virtual+33)
    runtime.cc:655]   native: #10 pc 00994224  /data/app/~~T4yy9njta3wCAb1xGEzjhA==/com.avast.android.cleaner-Re-YQOgFeHyiRTKRyIoRGg==/oat/x86/base.vdex (com.davemorrissey.labs.subscaleview.decoder.SkiaImageRegionDecoder.decodeRegion+60)
    runtime.cc:655]   native: #11 pc 007a53be  /apex/com.android.art/lib/libart.so (MterpInvokeInterface+2126)
    runtime.cc:655]   native: #12 pc 00135b21  /apex/com.android.art/lib/libart.so (mterp_op_invoke_interface+33)
    runtime.cc:655]   native: #13 pc 0097b31e  /data/app/~~T4yy9njta3wCAb1xGEzjhA==/com.avast.android.cleaner-Re-YQOgFeHyiRTKRyIoRGg==/oat/x86/base.vdex (com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground+258)
    runtime.cc:655]   native: #14 pc 007a335e  /apex/com.android.art/lib/libart.so (MterpInvokeVirtual+1806)
    runtime.cc:655]   native: #15 pc 00135921  /apex/com.android.art/lib/libart.so (mterp_op_invoke_virtual+33)
    runtime.cc:655]   native: #16 pc 0097b410  /data/app/~~T4yy9njta3wCAb1xGEzjhA==/com.avast.android.cleaner-Re-YQOgFeHyiRTKRyIoRGg==/oat/x86/base.vdex (com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground+4)
    runtime.cc:655]   native: #17 pc 007a335e  /apex/com.android.art/lib/libart.so (MterpInvokeVirtual+1806)
    runtime.cc:655]   native: #18 pc 00135921  /apex/com.android.art/lib/libart.so (mterp_op_invoke_virtual+33)
    runtime.cc:655]   native: #19 pc 0034daac  /system/framework/framework.jar (offset 92b000) (android.os.AsyncTask$3.call+40)
    runtime.cc:655]   native: #20 pc 007a53be  /apex/com.android.art/lib/libart.so (MterpInvokeInterface+2126)
    runtime.cc:655]   native: #21 pc 00135b21  /apex/com.android.art/lib/libart.so (mterp_op_invoke_interface+33)
    runtime.cc:655]   native: #22 pc 001ef01a  /apex/com.android.art/javalib/core-oj.jar (java.util.concurrent.FutureTask.run+62)
    runtime.cc:655]   native: #23 pc 0036fc82  /apex/com.android.art/lib/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.10914192770458939989)+370)
    runtime.cc:655]   native: #24 pc 00379c80  /apex/com.android.art/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+176)
2021-09-16 17:56:15.456 4532-5852/ A/android.cleane: runtime.cc:655]   native: #25 pc 0078d185  /apex/com.android.art/lib/libart.so (artQuickToInterpreterBridge+1061)
    runtime.cc:655]   native: #26 pc 0014238d  /apex/com.android.art/lib/libart.so (art_quick_to_interpreter_bridge+77)
    runtime.cc:655]   native: #27 pc 021b03bb  /memfd:jit-cache (deleted) (offset 2000000) (com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$ScaleAndTranslate.-$$Nest$fgetscale+363)
    runtime.cc:655]   native: #28 pc 0013baa2  /apex/com.android.art/lib/libart.so (art_quick_invoke_stub+338)
    runtime.cc:655]   native: #29 pc 001d0501  /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+241)
    runtime.cc:655]   native: #30 pc 00386881  /apex/com.android.art/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+385)
    runtime.cc:655]   native: #31 pc 0037abbe  /apex/com.android.art/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1070)
    runtime.cc:655]   native: #32 pc 007a3017  /apex/com.android.art/lib/libart.so (MterpInvokeVirtual+967)
    runtime.cc:655]   native: #33 pc 00135921  /apex/com.android.art/lib/libart.so (mterp_op_invoke_virtual+33)
    runtime.cc:655]   native: #34 pc 001f8c2c  /apex/com.android.art/javalib/core-oj.jar (java.util.concurrent.ThreadPoolExecutor$Worker.run+4)
    runtime.cc:655]   native: #35 pc 007a53be  /apex/com.android.art/lib/libart.so (MterpInvokeInterface+2126)
    runtime.cc:655]   native: #36 pc 00135b21  /apex/com.android.art/lib/libart.so (mterp_op_invoke_interface+33)
    runtime.cc:655]   native: #37 pc 000eb7d0  /apex/com.android.art/javalib/core-oj.jar (java.lang.Thread.run+8)
    runtime.cc:655]   native: #38 pc 0036fc82  /apex/com.android.art/lib/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.10914192770458939989)+370)
    runtime.cc:655]   native: #39 pc 00379c80  /apex/com.android.art/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+176)
    runtime.cc:655]   native: #40 pc 0078d185  /apex/com.android.art/lib/libart.so (artQuickToInterpreterBridge+1061)
    runtime.cc:655]   native: #41 pc 0014238d  /apex/com.android.art/lib/libart.so (art_quick_to_interpreter_bridge+77)
    runtime.cc:655]   native: #42 pc 0013baa2  /apex/com.android.art/lib/libart.so (art_quick_invoke_stub+338)
    runtime.cc:655]   native: #43 pc 001d0501  /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+241)
    runtime.cc:655]   native: #44 pc 006311dc  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+620)
    runtime.cc:655]   native: #45 pc 006313f5  /apex/com.android.art/lib/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+85)
    runtime.cc:655]   native: #46 pc 00699561  /apex/com.android.art/lib/libart.so (art::Thread::CreateCallback(void*)+1537)
    runtime.cc:655]   native: #47 pc 000e6974  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+100)
    runtime.cc:655]   native: #48 pc 00078567  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71)
    runtime.cc:655]   at android.graphics.BitmapRegionDecoder.decodeRegion(BitmapRegionDecoder.java:192)
    runtime.cc:655]   - waiting to lock <0x037ec0e7> (a java.lang.Object) held by thread 29
    runtime.cc:655]   at com.davemorrissey.labs.subscaleview.decoder.SkiaImageRegionDecoder.decodeRegion(SkiaImageRegionDecoder.java:127)
2021-09-16 17:56:15.456 4532-5852/ A/android.cleane: runtime.cc:655]   at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground(SubsamplingScaleImageView.java:1800)
    runtime.cc:655]   at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground(SubsamplingScaleImageView.java:1771)
    runtime.cc:655]   at android.os.AsyncTask$3.call(AsyncTask.java:394)
    runtime.cc:655]   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    runtime.cc:655]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    runtime.cc:655]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    runtime.cc:655]   at java.lang.Thread.run(Thread.java:923)
    runtime.cc:655]
    runtime.cc:655] "AsyncTask #9" prio=4 tid=29 Native
    runtime.cc:655]   | group="" sCount=1 dsCount=0 flags=1 obj=0x12c0a0f0 self=0xe2ad0a10
    runtime.cc:655]   | sysTid=5798 nice=10 cgrp=top-app sched=0/0 handle=0xbcbd91e0
    runtime.cc:655]   | state=S schedstat=( 27814864 13698976 150 ) utm=2 stm=0 core=1 HZ=100
    runtime.cc:655]   | stack=0xbcad6000-0xbcad8000 stackSize=1040KB
    runtime.cc:655]   | held mutexes=
    runtime.cc:655]   native: #00 pc 00000b97  [vdso] (__kernel_vsyscall+7)
    runtime.cc:655]   native: #01 pc 0005ad68  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40)
    runtime.cc:655]   native: #02 pc 001d846c  /apex/com.android.art/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+108)
    runtime.cc:655]   native: #03 pc 001d83f3  /apex/com.android.art/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+35)
    runtime.cc:655]   native: #04 pc 003fce7e  /apex/com.android.art/lib/libart.so (art::(anonymous namespace)::CheckJNI::SetField(char const*, _JNIEnv*, _jobject*, _jfieldID*, bool, art::Primitive::Type, art::(anonymous namespace)::JniValueType)+670)
    runtime.cc:655]   native: #05 pc 003e5432  /apex/com.android.art/lib/libart.so (art::(anonymous namespace)::CheckJNI::SetIntField(_JNIEnv*, _jobject*, _jfieldID*, int)+50)
    runtime.cc:655]   native: #06 pc 0023be43  /system/lib/libhwui.so (nativeDecodeRegion(_JNIEnv*, _jobject*, long long, int, int, int, int, _jobject*, long long, long long)+1219)
    runtime.cc:655]   at android.graphics.BitmapRegionDecoder.nativeDecodeRegion(Native method)
    runtime.cc:655]   at android.graphics.BitmapRegionDecoder.decodeRegion(BitmapRegionDecoder.java:197)
    runtime.cc:655]   - locked <0x037ec0e7> (a java.lang.Object)
    runtime.cc:655]   at com.davemorrissey.labs.subscaleview.decoder.SkiaImageRegionDecoder.decodeRegion(SkiaImageRegionDecoder.java:127)
    runtime.cc:655]   at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground(SubsamplingScaleImageView.java:1800)
    runtime.cc:655]   at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$TileLoadTask.doInBackground(SubsamplingScaleImageView.java:1771)
    runtime.cc:655]   at android.os.AsyncTask$3.call(AsyncTask.java:394)
    runtime.cc:655]   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    runtime.cc:655]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    runtime.cc:655]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    runtime.cc:655]   at java.lang.Thread.run(Thread.java:923)
    runtime.cc:655]
    runtime.cc:655]
    runtime.cc:655] Aborting thread:
    runtime.cc:655] "HeifDecode" prio=6 tid=39 Native
    runtime.cc:655]   | group="" sCount=0 dsCount=0 flags=0 obj=0x13900040 self=0xe2ad8810
    runtime.cc:655]   | sysTid=5852 nice=-2 cgrp=top-app sched=0/0 handle=0xb407c1e0
    runtime.cc:655]   | state=R schedstat=( 423769653 83321579 511 ) utm=12 stm=30 core=3 HZ=100
    runtime.cc:655]   | stack=0xb3f81000-0xb3f83000 stackSize=1008KB
    runtime.cc:655]   | held mutexes= "abort lock"
    runtime.cc:655]   native: #00 pc 00544bfe  /apex/com.android.art/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+110)
    runtime.cc:655]   native: #01 pc 006a26f7  /apex/com.android.art/lib/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+1015)
    runtime.cc:655]   native: #02 pc 0069bfd1  /apex/com.android.art/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+65)
    runtime.cc:655]   native: #03 pc 00654125  /apex/com.android.art/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread*) const+53)
    runtime.cc:655]   native: #04 pc 0063b91b  /apex/com.android.art/lib/libart.so (art::Runtime::Abort(char const*)+2587)
    runtime.cc:655]   native: #05 pc 00025a23  /apex/com.android.art/lib/libartbase.so (std::__1::__function::__func<void (*)(char const*), std::__1::allocator<void (*)(char const*)>, void (char const*)>::operator()(char const*&&)+35)
    runtime.cc:655]   native: #06 pc 0001588f  /system/lib/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+79)
    runtime.cc:655]   native: #07 pc 00006dbd  /system/lib/liblog.so (__android_log_assert+285)
    runtime.cc:655]   native: #08 pc 000102a2  /system/lib/libutils.so (android::RefBase::decStrong(void const*) const+146)
    runtime.cc:655]   native: #09 pc 00004de4  /system/lib/libheif.so (android::HeifDecoderImpl::decodeAsync()+436)
    runtime.cc:655]   native: #10 pc 00004c23  /system/lib/libheif.so (android::HeifDecoderImpl::DecodeThread::threadLoop()+35)
    runtime.cc:655]   native: #11 pc 00015116  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+374)
    runtime.cc:655]   native: #12 pc 00098fee  /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+174)
    runtime.cc:655]   native: #13 pc 000147d9  /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+457)
    runtime.cc:655]   native: #14 pc 000e6974  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+100)
    runtime.cc:655]   native: #15 pc 00078567  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71)
    runtime.cc:655]   (no managed stack frames)
    runtime.cc:655]
davemorrissey commented 3 years ago

You could try setExecutor(AsyncTask.SERIAL_EXECUTOR) to see if this makes a difference. However, BitmapRegionDecoder is synchronized and the use of THREAD_POOL_EXECUTOR is simply to reduce contention with other tasks running in the app, tiles are not actually decoded in parallel. I suspect this is an issue in Android code or Skia.

I had never heard of HEIC before now. I can't find anything conclusive but I suspect Skia might not fully support it.

tprochazka commented 3 years ago

I found the solution here https://stackoverflow.com/questions/65643305/heifdecoderimpl-causes-decstrong-called-too-many-times It is a workaround, the issue happens only with Bitmap.Config.RGB_565

davemorrissey commented 3 years ago

That's useful info, thanks. I don't think this can be the default though, as the library is not aware of the format of the image it's showing. Are you happy for this to be closed?

tprochazka commented 3 years ago

It is not related to the image format. Bitmap.Config.HARDWARE can be and should be used as the default for all current devices. It saves heap memory and keeps data just in graphics memory. It is available since API 26, but until API 28 it is problematic on some devices. Coil library has excellent detection for that

https://github.com/coil-kt/coil/blob/e95e1ccfda6d7a9dfcdfb2b11b331aeaecce0370/coil-base/src/main/java/coil/memory/HardwareBitmapService.kt

I think that this issue is still valid for this library, at least for other developers that are stuck on it, as a workaround to fix it. Until it is fixed or at least mentioned in README. But it is, of course, your decision..

davemorrissey commented 3 years ago

I'm reluctant to make changes when I don't know what the impact will be and can't support the library properly. Developers can override the default bitmap config if they need to.

YPB123 commented 2 years ago

the answer helps me, thanks!!!