Commit 1ec38efb authored by Nils Goroll's avatar Nils Goroll Committed by Pål Hermunn Johansen

Close a race in the round robin director - for real now

The previous code allowed the compiler to re-read nxt from
rr->nxt which could have been incremented cocurrently.

Fixes #2378
parent 19a73184
......@@ -70,9 +70,9 @@ vmod_rr_resolve(const struct director *dir, struct worker *wrk,
CAST_OBJ_NOTNULL(rr, dir->priv, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC);
vdir_rdlock(rr->vd);
for (u = 0; u < rr->vd->n_backend; u++) {
nxt = rr->nxt %= rr->vd->n_backend;
nxt = rr->nxt % rr->vd->n_backend;
rr->nxt = nxt + 1;
be = rr->vd->backend[nxt];
rr->nxt++;
CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC);
if (be->healthy(be, bo, NULL))
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment