Skip to content

Commit 2c761ac

Browse files
karlvrnigoroll
authored andcommitted
fix: always wake the new head of the waiting queue
Previously multiple threads could signal completion to one waiting queue head, resulting in underuse of available backend connections.
1 parent 7098d04 commit 2c761ac

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

bin/varnishd/cache/cache_backend.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ vbe_dir_getfd(VRT_CTX, struct worker *wrk, VCL_BACKEND dir, struct backend *bp,
246246
}
247247
if (cw->cw_state != CW_BE_BUSY)
248248
bp->n_conn++;
249+
250+
if (!VTAILQ_EMPTY(&bp->cw_head) && !BE_BUSY(bp)) {
251+
/* Signal the new head of the waiting queue */
252+
vbe_connwait_signal_locked(bp);
253+
}
254+
249255
Lck_Unlock(bp->director->mtx);
250256

251257
if (cw->cw_state == CW_BE_BUSY) {

0 commit comments

Comments
 (0)