-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pull: Ensure we always process queue only from main thread
I was easily reproducing a hang on pulls with thousands of requests on current git master. The initial symptom seemed to be that there are multiple code paths where we don't invoke `session_thread_process_pending_queue()`. We really need to do that any time we remove something from the outstanding queue, to ensure it gets filled again. A further issue is that we were tying the lifecycle of the pending object to the `GTask`, but the task could be unref'd from the main thread (via a `GSource` on the main thread), and that introduced threadsafety issues, because the hash table and other data suddenly could be concurrently modified. Both of these need to be fixed together. First, we introduce `Arc<Pending>`, and ensure that both the main and worker threads hold references. Second, we ensure that we re-process the queue *immediately* whenever a task is done, inside the worker thread, rather than doing it incidentally via an unref. This architecture is quite similar to what the outside pull code is doing. Closes: #350 Approved by: jlebon
- Loading branch information
1 parent
d262fc2
commit 535033a
Showing
1 changed file
with
47 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters