Skip to content

Commit 46c1932

Browse files
committed
Fix possible lockup in pgbench with -R.
pgbench would sometimes get stuck waiting forever after its last client thread terminated, due to failing to check for there being nothing more to wait for. Bug introduced during refactoring in v10 (I didn't bother to try to assign blame to a specific commit). It's already repaired in HEAD/v12 thanks to commit 3bac77c, but v10 and v11 need this fix. Fabien Coelho, per report from Tomas Vondra; reviewed by Yoshikazu Imai Discussion: https://postgr.es/m/cc5d76c1-6144-bbed-ad1b-961d13d88f3b@2ndquadrant.com
1 parent 55862b2 commit 46c1932

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bin/pgbench/pgbench.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4515,6 +4515,10 @@ threadRun(void *arg)
45154515
}
45164516
}
45174517

4518+
/* under throttling we may have finished the last client above */
4519+
if (remains == 0)
4520+
break;
4521+
45184522
/* also wake up to print the next progress report on time */
45194523
if (progress && min_usec > 0 && thread->tid == 0)
45204524
{

0 commit comments

Comments
 (0)