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

Make loading updates async from main AppCenter window #1471

Closed
hanaral opened this issue Jan 4, 2021 · 6 comments · Fixed by #1964
Closed

Make loading updates async from main AppCenter window #1471

hanaral opened this issue Jan 4, 2021 · 6 comments · Fixed by #1964
Labels
Priority: Medium Should be addressed when time allows Status: Confirmed Verified by someone other than the reporter

Comments

@hanaral
Copy link

hanaral commented Jan 4, 2021

What Happened

Trying to do a search for example, will make the AppCenter lock up for a while if the AppCenter is loading a large amount of available upgrades in the background

Expected Behavior

The updating process is seperate from the fronted so that the user does not face lockups just trying use the app normally

Steps to Reproduce

  1. Open AppCenter and immediately try to search
  2. It should chug (or even lock up in the case of my install HDD on my desktop)

This seems to be less obvious with an SSD, but you can still see it freeze for a second even with a small number of available upgrades

Platform Information

elementary OS 6 Daily
Tested on Lenovo ThinkPad X240 and desktop with AMD Ryzen 3 1200 & RX 570

@hanaral hanaral changed the title AppCenter chugs when loading all upgradable Make loading updates async from main AppCenter window Jan 20, 2021
@cassidyjames cassidyjames added Priority: Medium Should be addressed when time allows Status: Confirmed Verified by someone other than the reporter labels Feb 11, 2021
@cassidyjames cassidyjames pinned this issue Feb 11, 2021
@ids1024
Copy link
Contributor

ids1024 commented Dec 13, 2021

I don't know if there's any good tooling to check what is blocking an application's main thread, but running in gdb and hitting ctrl+c when the UI is blocked is one way to get a trace of what seems to be blocking.

One thing I'm seeing is the call to Flatpak.Transaction.run in FlatpakBackend.get_download_size_by_id. That function is async but the documentation for flatpak_transaction_run explicitly states "Note that this call blocks until the transaction is done.".

I think there are various other issues like that (in both the flatpak and packagekit backends). Given there doesn't seem to by an asynchronous API for this, presumably all such calls into libflatpak should be in a separate thread or process.

@davidmhewitt
Copy link
Member

@ids1024 Most of the long running operations in the Backend classes are already run in a separate thread. There's a thread pool and a pattern of a public async method queueing up work via a private internal worker method on that pool.

You'll definitely see that for the install/update/remove methods. It's possible that this specific one was just missed for some reason.

@ids1024
Copy link
Contributor

ids1024 commented Dec 13, 2021

Yes, most of those operations happen in a background thread, but this issue seems to exist due to a few that do not.

It seems like there should be a good way to profile what functions are blocking the UI thread. That would help for getting a more complete picture of what issues there are here.

@davidmhewitt
Copy link
Member

I believe sysprof's "speedtrack" should be able to identify blocking I/O happening on the main thread.

@aral
Copy link

aral commented Dec 14, 2021

I’ve noticed that checking for app updates blocks the main thread rather considerably (to the point where I thought the app had hung the first few times it happens). I can reproduce every time I launch AppCenter.

@danieleiervo
Copy link

A full year is gone and I can still reproduce: are there any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium Should be addressed when time allows Status: Confirmed Verified by someone other than the reporter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants