Repository navigation
Give folder listings their own thread pool - #116
Conversation
Listings, folder counts, previews and descriptions all ran on the global thread pool. Counting huge or slow subfolders could occupy every thread and queue the listing of a folder just opened behind them, so clicks seemed to do nothing until a few retries overtook the stuck work. Listings now run on a dedicated pool, and folder counts on a small separate one. Backend::showItem was missing Q_INVOKABLE, so clicking a file in the columns view threw "Property 'showItem' ... is not a function". Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
[Medium impact] The PR appears safe to merge; the previous browsing blocker is fixed. SummaryFolder reads use a dedicated pool with eight threads.
No new actionable issues were found. The previous finding is fixed. Reviews (4) · Last reviewed commit: "Say the listing pool's quit wait is a gr..." · Reviewed by Greptile |
|
Thanks for this, @OmarGonD. Reviewed at 17abb37. Both bugs are real, still present on It conflicts with What was run, on a disposable Omarchy VM:
Findings
Related. #119 stops a folder count partway through a folder once it has been overtaken. It shortens how long counts hold a thread and complements this branch rather than competing with it. #128 adds a D-Bus activation file so a cold Show in folder request starts Folio. That's a different failure: its path calls Second opinion. Codex at medium effort and muse-wonder (via pi, thinking high) each reviewed the diff read-only. Both reached the same findings on scope, the counting pool, the neutralized test and the stale comments. They had the same brief, and the reviewers could read this session's notes, so that agreement isn't independent confirmation. muse-wonder found something new: the concrete teardown path through Next step is yours: bring in |
Listings stay on their own pool, now reachable as FolderModel::listingPool() so the overtaken-read test can constrain it. The showItem Q_INVOKABLE moves to its own pull request. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for the review. Pushed:
Not changed: the 8 listing threads are still a fixed number. Full suite passes. |
The pool is still never deleted, so a listing hung on a dead mount can't stop Folio quitting, but a post routine now gives one that is just finishing a second before the statics it uses (QMimeDatabase) are destroyed. Once its model is gone a listing stops at the next entry, so that second covers everything but a hung read. The pool takes Qt's default thread count instead of a fixed 8, the trade-off comment the post routine replaces is gone, and listingPool()'s declaration moves out of the middle of list()'s comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, @OmarGonD. I re-reviewed 7b2bd9b and, at the maintainer's request to keep bug fixes as simple as they can be, pushed one commit on top: 6043f49. Since my last comment. The What 6043f49 changes:
Against the branch's base, What was run, on a disposable Omarchy VM:
Second opinion. Codex at medium effort and muse-wonder (via pi, thinking high) reviewed the simplified diff read-only. Both confirm the earlier findings are fixed or moot and the two tests are the shortest that bite. Both point out that the one-second wait narrows the teardown race but doesn't close it: a listing stalled for over a second that wakes during static teardown can still reach those statics. The only full fix is waiting indefinitely at quit, which brings back the hang on dead mounts, so the narrower race is the trade this branch takes. They could read this session's notes, so their agreement isn't independent confirmation. Still open:
|
Without a set count the pool sizes itself to the CPU count, so on a one-CPU machine a single listing stuck in a filesystem call on a dead mount holds the only thread and every later listing, local folders included, waits behind it; changing folders can't interrupt a thread inside a syscall. The fixed 8 is what lets browsing survive a few stuck mounts. The test now also holds seven listing threads, and fails at a pool sized to fewer than 8 CPUs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A listing stuck past the one-second wait can still reach statics such as kindForMime()'s QMimeDatabase once they are destroyed; the comment said only that one just finishing gets a second, losing the caveat the author had written down. The stuck-work test also drains the listing pool first, so a leftover listing can't take the slot it relies on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Greptile's P1 on
What was run, on a disposable Omarchy VM with 4 CPUs:
Second opinion. Codex at medium effort and muse-wonder (via pi, thinking high) reviewed the fix read-only. I asked them specifically whether any other part of 6043f49 weakened your design the same way. Both found that the dropped teardown caveat was the only reasoning lost, and it's now restored. Otherwise they found nothing. They agreed the fixed 8 is a better choice than scaling with the CPU count, since listings wait on filesystems rather than on CPUs. The one remaining difference from your version is that quitting can now take up to a second longer while a listing is stuck. A second round on 0cfff70 found nothing left to act on. They could read this session's notes, so their agreement isn't independent confirmation. Still open:
|


Problem
Sometimes clicking a folder shows nothing, and the contents only appear after several more clicks (seen in large trees such as ~/Projects).
Folder listings, folder counts, previews and descriptions all ran on the global thread pool. Counting huge or slow subfolders can occupy every thread and queue the listing of the folder just opened behind them. Further clicks bump the generation and overtake the stuck work, which is why retrying eventually works.
Changes
FolderModel::listingPool(). Folder counts, previews and descriptions stay on the global pool.qAddPostRoutinegives running listings up to a second to finish at quit; one stuck longer can still reach destroyed statics.folderModelListsWhileOtherWorkIsStuckfails with listings back on the global pool or without the fixed 8 threads.folderModelStopsReadingWhatsBeenOvertakennow constrains the listing pool, so it fails again if overtaken reads never stop.The
Q_INVOKABLEfix forBackend::showItemthat was part of the first version landed separately in #136.Testing
🤖 Generated with Claude Code