-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Potential UI thread blocking issue #12752
Copy link
Copy link
Closed
Labels
bugIssue is related to a bugIssue is related to a bugdatabaseIssue and PRs related to database operationsIssue and PRs related to database operationsperformanceRelated to performance and optimisation; affects the speed or memory efficiency of the applicationRelated to performance and optimisation; affects the speed or memory efficiency of the application
Metadata
Metadata
Assignees
Labels
bugIssue is related to a bugIssue is related to a bugdatabaseIssue and PRs related to database operationsIssue and PRs related to database operationsperformanceRelated to performance and optimisation; affects the speed or memory efficiency of the applicationRelated to performance and optimisation; affects the speed or memory efficiency of the application
Checklist
Affected version
v0.28.0
Steps to reproduce the bug
The code calls Room.databaseBuilder(...).build() on the main thread, which performs disk I/O operations.
Expected behavior
No response
Actual behavior
No response
Screenshots/Screen recordings
No response
Logs
No response
Affected Android/Custom ROM version
No response
Affected device model
No response
Additional information
Hello Developer,
I used a static analysis tool to examine NewPipe and found that in PlaylistFragment.java, LocalPlaylistFragment.java, and BookmarkFragment.java, the onCreate methods all invoke getInstance synchronously. However, getInstance calls Room.databaseBuilder(...).build() on the main thread, which performs disk I/O operations and may block the UI thread.
According to Android development best practices, this database initialization should be moved off the UI thread to avoid potential UI freezes.