Skip to content

Conversation

@alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Nov 17, 2025

  • Tests written, or not not needed

Fixes

cancelPotentialThumbnailWork() was used to detect and cancel ThumbnailGenerationTask, but the gallery row holder uses the GalleryImageGenerationTask.

Because the cancellation logic did not recognize the actual task type, it never cancelled existing work, so GalleryImageGenerationTask was always executed.

Helps

When scrolling fast, tasks pile up. AsyncTask.THREAD_POOL_EXECUTOR is not infinite, thus rejecting tasks and crashes.

java.util.concurrent.RejectedExecutionException: 
    Task android.os.AsyncTask$3@787c68 rejected from 
    java.util.concurrent.ThreadPoolExecutor@9a4d881
    [Running, pool size = 17, active threads = 17, queued tasks = 128, completed tasks = 312]

    at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2104)
    at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:848)
    at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1413)
    at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:652)
    at com.owncloud.android.ui.adapter.OCFileListDelegate.setGalleryImage(OCFileListDelegate.kt:212)
    at com.owncloud.android.ui.adapter.OCFileListDelegate.bindGalleryRowThumbnail(OCFileListDelegate.kt:116)

How to test?

Fresh install app.
Open media tab.
Check logcat. It never prints "setGalleryImage.cancelPotentialThumbnailWork()"

@alperozturk96 alperozturk96 added 3. to review performance 🚀 Performance improvement opportunities (non-crash related) labels Nov 17, 2025
@github-actions
Copy link

@github-actions
Copy link

Codacy

SpotBugs

SpotBugs increased!

@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/15973.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review performance 🚀 Performance improvement opportunities (non-crash related)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants