Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji reactions make the app lag and ultimately crash #559

Open
likeazir opened this issue Oct 27, 2024 · 0 comments · May be fixed by #572
Open

Emoji reactions make the app lag and ultimately crash #559

likeazir opened this issue Oct 27, 2024 · 0 comments · May be fixed by #572
Labels
bug Something isn't working

Comments

@likeazir
Copy link

likeazir commented Oct 27, 2024

Describe the bug

Something about enabling emoji reactions makes moshidon crash.

I did my best to collect some clues on what's happening, feel free to ask for more info.

To reproduce

Steps to reproduce the behavior:

  1. Instance with >20000 emotes
  2. turn on settings -> instance -> show emoji reactions in timelines -> show add button
  3. scroll through moderately populated feed, it lags from the beginning, and after approximately 200 or 300 posts it crashes

Does this issue also occur with the respective upstream release?
Yes (Megalodon)

Moshidon version
d81eb6a, no modifications debug build running on a Fairphone 5

Crash log
I did not really manage to track down the source of all this memory usage.

2024-10-27 14:59:59.437 10486-10486 MessageQueue-JNI        org...stodon.android.moshinda.debug  E  java.lang.OutOfMemoryError: Failed to allocate a 56 byte allocation with 5066880 free bytes and 4948KB until OOM, target footprint 536870912, growth limit 536870912; giving up on allocation because <1% of heap free after GC.
                                                                                                    	at android.net.Uri.parse(Uri.java:466)
                                                                                                    	at me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest.<init>(UrlImageLoaderRequest.java:44)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard$SingleCategoryAdapter.lambda$new$0(CustomEmojiPopupKeyboard.java:242)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard$SingleCategoryAdapter.$r8$lambda$4MiXBTpf0wNyHQhD-Wq1Y-nOQpU(Unknown Source:0)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard$SingleCategoryAdapter$$ExternalSyntheticLambda0.apply(Unknown Source:4)
                                                                                                    	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:209)
                                                                                                    	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1725)
                                                                                                    	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
                                                                                                    	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:503)
                                                                                                    	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
                                                                                                    	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:236)
                                                                                                    	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:706)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard$SingleCategoryAdapter.<init>(CustomEmojiPopupKeyboard.java:242)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard.onCreateView(CustomEmojiPopupKeyboard.java:119)
                                                                                                    	at org.joinmastodon.android.ui.PopupKeyboard.ensureView(PopupKeyboard.java:41)
                                                                                                    	at org.joinmastodon.android.ui.PopupKeyboard.getView(PopupKeyboard.java:47)
                                                                                                    	at org.joinmastodon.android.ui.displayitems.EmojiReactionsStatusDisplayItem$Holder.onBind(EmojiReactionsStatusDisplayItem.java:184)
                                                                                                    	at org.joinmastodon.android.ui.displayitems.EmojiReactionsStatusDisplayItem$Holder.onBind(EmojiReactionsStatusDisplayItem.java:145)
                                                                                                    	at me.grishka.appkit.utils.BindableViewHolder.bind(BindableViewHolder.java:33)
                                                                                                    	at org.joinmastodon.android.fragments.BaseStatusListFragment$DisplayItemsAdapter.onBindViewHolder(BaseStatusListFragment.java:1218)
                                                                                                    	at org.joinmastodon.android.fragments.BaseStatusListFragment$DisplayItemsAdapter.onBindViewHolder(BaseStatusListFragment.java:1202)
                                                                                                    	at me.grishka.appkit.views.UsableRecyclerView$FooterRecyclerAdapter.onBindViewHolder(UsableRecyclerView.java:433)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7256)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7339)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6197)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6463)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6303)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6299)
                                                                                                    	at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2328)
                                                                                                    	at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:571)
                                                                                                    	at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1589)
                                                                                                    	at androidx.recyclerview.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1393)
                                                                                                    	at androidx.recyclerview.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1134)
                                                                                                    	at androidx.recyclerview.widget.GridLayoutManager.scrollVerticallyBy(GridLayoutManager.java:385)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1965)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView.scrollByInternal(RecyclerView.java:2064)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView.onTouchEvent(RecyclerView.java:3522)
                                                                                                    	at me.grishka.appkit.views.UsableRecyclerView.onTouchEvent(UsableRecyclerView.java:148)
                                                                                                    	at android.view.View.dispatchTouchEvent(View.java:15657)
2024-10-27 14:59:59.442 10486-10486 AndroidRuntime          org...stodon.android.moshinda.debug  E  FATAL EXCEPTION: main
                                                                                                    Process: org.joinmastodon.android.moshinda.debug, PID: 10486
                                                                                                    java.lang.OutOfMemoryError: Failed to allocate a 56 byte allocation with 5066880 free bytes and 4948KB until OOM, target footprint 536870912, growth limit 536870912; giving up on allocation because <1% of heap free after GC.
                                                                                                    	at android.net.Uri.parse(Uri.java:466)
                                                                                                    	at me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest.<init>(UrlImageLoaderRequest.java:44)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard$SingleCategoryAdapter.lambda$new$0(CustomEmojiPopupKeyboard.java:242)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard$SingleCategoryAdapter.$r8$lambda$4MiXBTpf0wNyHQhD-Wq1Y-nOQpU(Unknown Source:0)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard$SingleCategoryAdapter$$ExternalSyntheticLambda0.apply(Unknown Source:4)
                                                                                                    	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:209)
                                                                                                    	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1725)
                                                                                                    	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
                                                                                                    	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:503)
                                                                                                    	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
                                                                                                    	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:236)
                                                                                                    	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:706)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard$SingleCategoryAdapter.<init>(CustomEmojiPopupKeyboard.java:242)
                                                                                                    	at org.joinmastodon.android.ui.CustomEmojiPopupKeyboard.onCreateView(CustomEmojiPopupKeyboard.java:119)
                                                                                                    	at org.joinmastodon.android.ui.PopupKeyboard.ensureView(PopupKeyboard.java:41)
                                                                                                    	at org.joinmastodon.android.ui.PopupKeyboard.getView(PopupKeyboard.java:47)
                                                                                                    	at org.joinmastodon.android.ui.displayitems.EmojiReactionsStatusDisplayItem$Holder.onBind(EmojiReactionsStatusDisplayItem.java:184)
                                                                                                    	at org.joinmastodon.android.ui.displayitems.EmojiReactionsStatusDisplayItem$Holder.onBind(EmojiReactionsStatusDisplayItem.java:145)
                                                                                                    	at me.grishka.appkit.utils.BindableViewHolder.bind(BindableViewHolder.java:33)
                                                                                                    	at org.joinmastodon.android.fragments.BaseStatusListFragment$DisplayItemsAdapter.onBindViewHolder(BaseStatusListFragment.java:1218)
                                                                                                    	at org.joinmastodon.android.fragments.BaseStatusListFragment$DisplayItemsAdapter.onBindViewHolder(BaseStatusListFragment.java:1202)
                                                                                                    	at me.grishka.appkit.views.UsableRecyclerView$FooterRecyclerAdapter.onBindViewHolder(UsableRecyclerView.java:433)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7256)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7339)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6197)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6463)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6303)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6299)
                                                                                                    	at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2328)
                                                                                                    	at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:571)
                                                                                                    	at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1589)
                                                                                                    	at androidx.recyclerview.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1393)
                                                                                                    	at androidx.recyclerview.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1134)
                                                                                                    	at androidx.recyclerview.widget.GridLayoutManager.scrollVerticallyBy(GridLayoutManager.java:385)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1965)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView.scrollByInternal(RecyclerView.java:2064)
                                                                                                    	at androidx.recyclerview.widget.RecyclerView.onTouchEvent(RecyclerView.java:3522)
                                                                                                    	at me.grishka.appkit.views.UsableRecyclerView.onTouchEvent(UsableRecyclerView.java:148)

profiling
after this i enabled large heap for the debug build, still crashing

memory usage as reported by complete profiler
image

after clicking "record" java allocs
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant