commit 0b3936e0d1faf40aca2dcb9951b9df8c83d9824e from: Mark Jamsek date: Tue Dec 31 05:40:31 2024 UTC tog: fix log view race condition evinced by regress When the commit graph has been traversed, we set the log_complete flag to signal the main thread that we've completed iterating commit history, which request_log_commits() checks and, if set, returns early instead of calling trigger_log_thread(). If called, trigger_log_thread() wakes the log thread, then waits on the log thread to unblock when another commit has been loaded. There's a race between the log thread setting the log_complete flag and request_log_commits() checking it, which causes trigger_load_thread() to wait on a signal that never unblocks because there are no more commits to be loaded. ok stsp@ commit - 2862fe8b5e48e0894e87c0278730d089d5d6ecaf commit + 0b3936e0d1faf40aca2dcb9951b9df8c83d9824e blob - ce0e59563dca13d6cbb9942f09da18f0433fbab0 blob + bb66caa58e383b540e51ea5efe6f0c6eba29fb7d --- tog/tog.c +++ tog/tog.c @@ -4021,6 +4021,8 @@ log_thread(void *arg) TAILQ_FIRST(&a->real_commits->head); *a->selected_entry = *a->first_displayed_entry; } + if (done) + a->log_complete = 1; errcode = pthread_cond_signal(&a->commit_loaded); if (errcode) {