commit fba1c01f5ad1c8c5973200213fc44273a8ea3e78 from: Mark Jamsek via: Thomas Adam date: Fri Jan 03 10:46:48 2025 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 - 4cef9d7c76a821328add4b99dd9873b1cac5f827 commit + fba1c01f5ad1c8c5973200213fc44273a8ea3e78 blob - af194327c47dd9397d815e9ddd4ece646d627acc blob + 3512ab341118eeaffa45969a14846501ab8387b2 --- tog/tog.c +++ tog/tog.c @@ -4025,6 +4025,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) {