[6.0] dd5ea4a22 Set the task arguments under the lock

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:53:19 UTC 2018


commit dd5ea4a221c8783fd24de1531f3679213322b2c6
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Fri Jul 13 12:02:23 2018 +0100

    Set the task arguments under the lock
    
    I've been torturing varnish with this change for some time and was
    not able to reproduce the problem.
    
    Should fix #2719.

diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index 2c0ad150f..7cd02533d 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -214,13 +214,12 @@ Pool_Task_Arg(struct worker *wrk, enum task_prio prio, task_func_t *func,
 		wrk2 = wrk;
 		retval = 0;
 	}
-	Lck_Unlock(&pp->mtx);
 	AZ(wrk2->task.func);
-
 	assert(arg_len <= WS_Reserve(wrk2->aws, arg_len));
 	memcpy(wrk2->aws->f, arg, arg_len);
 	wrk2->task.func = func;
 	wrk2->task.priv = wrk2->aws->f;
+	Lck_Unlock(&pp->mtx);
 	if (retval)
 		AZ(pthread_cond_signal(&wrk2->cond));
 	return (retval);


More information about the varnish-commit mailing list