pantasystem / Milktea

Misskey, MastodonのAndroidクライアント「Milktea」のソースコード
GNU General Public License v3.0
247 stars 22 forks source link

一部カスタム絵文字を表示しようとするとクラッシュする #1932

Closed pantasystem closed 8 months ago

pantasystem commented 8 months ago

例えば下記投稿に添付されているカスタム絵文字を表示しようとするとクラッシュする https://misskey.backspace.fm/notes/9lc9kwylec

pantasystem commented 8 months ago
runtime.cc:691]   at android.util.SparseArray.put(SparseArray.java:284)
2023-10-27 22:49:33.253 30820-30969 eyandroidclient         jp.panta.misskeyandroidclient        A  runtime.cc:691]   at android.util.SparseArray.append(SparseArray.java:466)
                                                                                                    runtime.cc:691]   at android.view.accessibility.WeakSparseArray.append(WeakSparseArray.java:33)
                                                                                                    runtime.cc:691]   at android.view.accessibility.AccessibilityNodeIdManager.registerViewWithId(AccessibilityNodeIdManager.java:48)
                                                                                                    runtime.cc:691]   - locked <0x0f88087f> (a android.view.accessibility.WeakSparseArray)
                                                                                                    runtime.cc:691]   at android.view.View.onAttachedToWindow(View.java:21425)
                                                                                                    runtime.cc:691]   at android.widget.TextView.onAttachedToWindow(TextView.java:8495)
                                                                                                    runtime.cc:691]   at android.view.View.dispatchAttachedToWindow(View.java:21980)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
                                                                                                    runtime.cc:691]   ... repeated 6 times
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.addViewInner(ViewGroup.java:5318)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.addView(ViewGroup.java:5104)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.addView(ViewGroup.java:5044)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.RecyclerView$5.addView(RecyclerView.java:950)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.ChildHelper.addView(ChildHelper.java:107)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.RecyclerView$LayoutManager.addViewInt(RecyclerView.java:9430)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.RecyclerView$LayoutManager.addView(RecyclerView.java:9388)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.RecyclerView$LayoutManager.addView(RecyclerView.java:9375)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1676)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1622)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:687)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4645)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4348)
                                                                                                    runtime.cc:691]   at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4919)
                                                                                                    runtime.cc:691]   at android.view.View.layout(View.java:24421)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.layout(ViewGroup.java:6440)
                                                                                                    runtime.cc:691]   at androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:688)
                                                                                                    runtime.cc:691]   at android.view.View.layout(View.java:24421)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.layout(ViewGroup.java:6440)
                                                                                                    runtime.cc:691]   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
                                                                                                    runtime.cc:691]   at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    runtime.cc:691]   at android.view.View.layout(View.java:24421)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.layout(ViewGroup.java:6440)
                                                                                                    runtime.cc:691]   at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1873)
                                                                                                    runtime.cc:691]   at android.view.View.layout(View.java:24421)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.layout(ViewGroup.java:6440)
                                                                                                    runtime.cc:691]   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
                                                                                                    runtime.cc:691]   at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    runtime.cc:691]   at android.view.View.layout(View.java:24421)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.layout(ViewGroup.java:6440)
                                                                                                    runtime.cc:691]   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1891)
                                                                                                    runtime.cc:691]   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1729)
                                                                                                    runtime.cc:691]   at android.widget.LinearLayout.onLayout(LinearLayout.java:1638)
                                                                                                    runtime.cc:691]   at android.view.View.layout(View.java:24421)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.layout(ViewGroup.java:6440)
2023-10-27 22:49:33.253 30820-30969 eyandroidclient         jp.panta.misskeyandroidclient        A  runtime.cc:691]   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
                                                                                                    runtime.cc:691]   at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    runtime.cc:691]   at android.view.View.layout(View.java:24421)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.layout(ViewGroup.java:6440)
                                                                                                    runtime.cc:691]   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1891)
                                                                                                    runtime.cc:691]   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1729)
                                                                                                    runtime.cc:691]   at android.widget.LinearLayout.onLayout(LinearLayout.java:1638)
                                                                                                    runtime.cc:691]   at android.view.View.layout(View.java:24421)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.layout(ViewGroup.java:6440)
                                                                                                    runtime.cc:691]   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
                                                                                                    runtime.cc:691]   at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    runtime.cc:691]   at com.android.internal.policy.DecorView.onLayout(DecorView.java:789)
                                                                                                    runtime.cc:691]   at android.view.View.layout(View.java:24421)
                                                                                                    runtime.cc:691]   at android.view.ViewGroup.layout(ViewGroup.java:6440)
                                                                                                    runtime.cc:691]   at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:4258)
                                                                                                    runtime.cc:691]   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3583)
                                                                                                    runtime.cc:691]   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2465)
                                                                                                    runtime.cc:691]   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9305)
                                                                                                    runtime.cc:691]   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1339)
                                                                                                    runtime.cc:691]   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1348)
                                                                                                    runtime.cc:691]   at android.view.Choreographer.doCallbacks(Choreographer.java:952)
                                                                                                    runtime.cc:691]   at android.view.Choreographer.doFrame(Choreographer.java:882)
                                                                                                    runtime.cc:691]   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1322)
                                                                                                    runtime.cc:691]   at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    runtime.cc:691]   at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    runtime.cc:691]   at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    runtime.cc:691]   at android.os.Looper.loop(Looper.java:294)
                                                                                                    runtime.cc:691]   at android.app.ActivityThread.main(ActivityThread.java:8177)
                                                                                                    runtime.cc:691]   at java.lang.reflect.Method.invoke(Native method)
                                                                                                    runtime.cc:691]   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    runtime.cc:691]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
                                                                                                    runtime.cc:691] 
                                                                                                    runtime.cc:691] "FinalizerDaemon" prio=5 tid=9 Waiting
                                                                                                    runtime.cc:691]   | group="" sCount=1 ucsCount=0 flags=1 obj=0x14a00330 self=0xb40000706ad1be40
                                                                                                    runtime.cc:691]   | sysTid=30833 nice=4 cgrp=top-app sched=0/0 handle=0x6f37908cb0
                                                                                                    runtime.cc:691]   | state=S schedstat=( 88146826 39879620 163 ) utm=8 stm=0 core=3 HZ=100
                                                                                                    runtime.cc:691]   | stack=0x6f37805000-0x6f37807000 stackSize=1039KB
                                                                                                    runtime.cc:691]   | held mutexes=
                                                                                                    runtime.cc:691]   native: #00 pc 00055e1c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28) (BuildId: c74277f481a383c87215b672f6465e24)
pantasystem commented 8 months ago

ちなみにこのカスタム絵文字TextViewにEmojiSpanとして表示するときだけクラッシュする リアクション一覧などのImageViewなどに表示している時は問題ない

pantasystem commented 8 months ago

これが原因では?

runtime.cc:691]   native: #145 pc 0023ea64  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke+144) (BuildId: a5fcf27f4a71b07dff05c648ad58e3cd)
                                                                                                    runtime.cc:691]   native: #146 pc 0054436c  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback+1600) (BuildId: a5fcf27f4a71b07dff05c648ad58e3cd)
                                                                                                    runtime.cc:691]   native: #147 pc 000be6a8  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start+208) (BuildId: c74277f481a383c87215b672f6465e24)
                                                                                                    runtime.cc:691]   native: #148 pc 0005b21c  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: c74277f481a383c87215b672f6465e24)
                                                                                                    runtime.cc:691]   at android.graphics.Bitmap.nativeCreate(Native method)
                                                                                                    runtime.cc:691]   at android.graphics.Bitmap.createBitmap(Bitmap.java:1206)
                                                                                                    runtime.cc:691]   at android.graphics.Bitmap.createBitmap(Bitmap.java:1163)
                                                                                                    runtime.cc:691]   at android.graphics.Bitmap.createBitmap(Bitmap.java:1111)
                                                                                                    runtime.cc:691]   at android.graphics.Bitmap.createBitmap(Bitmap.java:1070)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool.createBitmap(LruBitmapPool.java:175)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool.getDirty(LruBitmapPool.java:168)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.resource.bitmap.Downsampler.setInBitmap(Downsampler.java:923)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeFromWrappedStreams(Downsampler.java:412)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:285)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:222)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:62)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:18)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.resource.bitmap.BitmapDrawableDecoder.decode(BitmapDrawableDecoder.java:58)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodePath.decodeResourceWithList(DecodePath.java:92)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodePath.decodeResource(DecodePath.java:70)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodePath.decode(DecodePath.java:59)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.LoadPath.loadWithExceptionList(LoadPath.java:76)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.LoadPath.load(LoadPath.java:57)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodeJob.runLoadPath(DecodeJob.java:539)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodeJob.decodeFromFetcher(DecodeJob.java:503)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodeJob.decodeFromData(DecodeJob.java:489)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:434)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:399)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:211)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:101)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onDataReady(MultiModelLoader.java:145)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:45)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:95)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:88)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:280)
2023-10-27 23:09:00.699   973-1280  eyandroidclient         jp.panta.misskeyandroidclient        A  runtime.cc:691]   at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235)
                                                                                                    runtime.cc:691]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                    runtime.cc:691]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:421)
                                                                                                    runtime.cc:691]   at java.lang.Thread.run(Thread.java:1012)
                                                                                                    runtime.cc:691]   at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultPriorityThreadFactory$1.run(GlideExecutor.java:380)
                                                                                                    runtime.cc:691] 
2023-10-27 23:09:00.700   973-1280  libc                    jp.panta.misskeyandroidclient        A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 1280 (glide-source-th), pid 973 (eyandroidclient)
2023-10-27 23:09:00.720   973-983   eyandroidclient         jp.panta.misskeyandroidclient        I  NativeAlloc concurrent copying GC freed 496832(15MB) AllocSpace objects, 44(1812KB) LOS objects, 32% fr
pantasystem commented 8 months ago

思うにサイズが大きすぎる画像を読み込んでしまっているのが原因