ANR risk due to runBlocking blocking main thread during database access

Open
#6,829 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Roniscend is already working on this.

Since Apr 9, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
android, kotlin

Research direction

Start in DepictsPresenter.kt at getRecentDepictedItems() and trace how depictsDao.depictsList().await() is scheduled; inspect nearby call sites or tests to understand the expected threading and results. Done when database access no longer blocks the main UI thread and the existing behavior is verified.

Written by the indexing model from the issue text.

Description

In DepictsPresenter.kt [getRecentDepictedItems()], there is an unsafe runBlocking { depictsDao.depictsList().await() } operation wrapping a database query mapping on the mainThreadScheduler. Utilizing runBlocking intercepts the thread here, actively blocking the Main UI Thread during Room sweeps, causing jank, skipped frames, and severe ANRs

Dominant language
Kotlin
Stars
1.2k
Forks
1.4k
Avg merge
1d 4h
Merged PRs (30d)
156

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from commons-app/apps-android-commons

All issues in commons-app/apps-android-commons

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.