Skip to content

fix(throttler): ANR - #17966

Merged
alperozturk96 merged 1 commit into
masterfrom
fix/throttler
Nov 11, 2026
Merged

alperozturk96 merged 1 commit into
masterfrom
fix/throttler

Conversation

@alperozturk96

Copy link
Copy Markdown
Collaborator

Issue

The main thread was busy performing an I/O operation. Throttler call was containing IO operation thus it was blocking the main thread.

at jdk.internal.misc.Unsafe.park (Native method)
  at java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java:276)
  at android.database.sqlite.SQLiteConnectionPool.waitForConnection (SQLiteConnectionPool.java:797)
  at android.database.sqlite.SQLiteConnectionPool.acquireConnection (SQLiteConnectionPool.java:403)
This function call is performing I/O operations, which have unpredictable timing. [Learn more](https://developer.android.com/topic/performance/anrs/find-unresponsive-thread#blocking-io)
  at android.database.sqlite.SQLiteSession.acquireConnection (SQLiteSession.java:931)
  at android.database.sqlite.SQLiteSession.beginTransactionUnchecked (SQLiteSession.java:332)
  at android.database.sqlite.SQLiteSession.beginTransaction (SQLiteSession.java:311)
  at android.database.sqlite.SQLiteDatabase.beginTransaction (SQLiteDatabase.java:841)
  at android.database.sqlite.SQLiteDatabase.beginTransaction (SQLiteDatabase.java:824)
  at android.database.sqlite.SQLiteDatabase.beginTransaction (SQLiteDatabase.java:677)
  at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.beginTransaction (FrameworkSQLiteDatabase.android.kt:52)
  at com.owncloud.android.providers.FileContentProvider.query (FileContentProvider.java:470)
  at android.content.ContentProvider.query (ContentProvider.java:1669)
  at android.content.ContentProvider.query (ContentProvider.java:1765)
  at android.content.ContentProvider$Transport.query (ContentProvider.java:303)
  at android.content.ContentResolver.query (ContentResolver.java:1294)
  at android.content.ContentResolver.query (ContentResolver.java:1225)
  at android.content.ContentResolver.query (ContentResolver.java:1180)
  at com.owncloud.android.datamodel.FileDataStorageManager.getCapabilityCursorForAccount (FileDataStorageManager.java:2430)
  at com.owncloud.android.datamodel.FileDataStorageManager.getCapability (FileDataStorageManager.java:2467)
  at com.owncloud.android.ui.fragment.OCFileListFragment.getCapabilities (OCFileListFragment.java:1453)
  at com.owncloud.android.ui.fragment.OCFileListFragment.lambda$openActionsMenu$8 (OCFileListFragment.java:733)
  at com.owncloud.android.ui.fragment.OCFileListFragment.$r8$lambda$vfpfnFRXllS1hrx3IemEvxSDNzM (unavailable)
  at com.owncloud.android.ui.fragment.OCFileListFragment$$ExternalSyntheticLambda16.run (D8$$SyntheticClass)
  at com.nextcloud.client.utils.Throttler.run (Throttler.kt:31)
  at com.owncloud.android.ui.fragment.OCFileListFragment.openActionsMenu (OCFileListFragment.java:729)
  at com.owncloud.android.ui.fragment.OCFileListFragment.onOverflowIconClicked (OCFileListFragment.java:725)
  at com.owncloud.android.ui.adapter.OCFileListAdapter.lambda$bindListItemViewHolder$8 (OCFileListAdapter.java:692)
  at com.owncloud.android.ui.adapter.OCFileListAdapter.$r8$lambda$QZ1TtbC0jOaA-Uen41EIjg-gntM (unavailable)
  at com.owncloud.android.ui.adapter.OCFileListAdapter$$ExternalSyntheticLambda2.onClick (D8$$SyntheticClass)
  at android.view.View.performClick (View.java:8220)
  at android.view.View.performClickInternal (View.java:8197)
  at android.view.View.-$$Nest$mperformClickInternal (unavailable)
  at android.view.View$PerformClick.run (View.java:32040)
  at android.os.Handler.handleCallback (Handler.java:1082)
  at android.os.Handler.dispatchMessageImpl (Handler.java:135)
  at android.os.Handler.dispatchMessage (Handler.java:126)
  at android.os.Looper.loopOnce (Looper.java:295)
  at android.os.Looper.loop (Looper.java:398)
  at android.app.ActivityThread.main (ActivityThread.java:9569)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:575)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:918)

Changes

  • Moves of IO operation from main thread, see changes in OCFileListFragment.kt
  • Replaces Clock implementation to throttle with TimeSource.Monotonic and TimeMark
  • Uses Kotlin durations
  • Introduces TrailingThrottle.kt to remove 1 second out-of-sync in UploadListFragment.kt

How to test?

  • Try to open file actions
  • Have a ongoing uploads and observe state in Upload screen

@alperozturk96 alperozturk96 added this to the Nextcloud App 35.2.0 milestone Nov 5, 2026
@alperozturk96 alperozturk96 changed the title fix(throttler): threading fix(throttler): anr Nov 5, 2026
@alperozturk96 alperozturk96 changed the title fix(throttler): anr fix(throttler): ANR Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

📱 QA build

Download app-qa-debug.apk
QR code Open the QR code for this download
Commit 0e8ebb3
Version 17966
Available until 7 days after this build

The QA build installs alongside a released Nextcloud app, so you can keep
using your existing install while testing.

Downloading the file requires a GitHub account, so open this link on the
device you want to test on, or transfer the APK to it.

@alperozturk96

Copy link
Copy Markdown
Collaborator Author

/backport to stable-35.1.x

Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
@github-actions

Copy link
Copy Markdown

SpotBugs

CategoryBaseNew
Bad practice2424
Correctness4747
Dodgy code126126
Experimental11
Malicious code vulnerability11
Multithreaded correctness1313
Performance2626
Security1515
Total253253

@alperozturk96
alperozturk96 merged commit a3d8581 into master Nov 11, 2026
23 of 24 checks passed
@alperozturk96
alperozturk96 deleted the fix/throttler branch November 11, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants