[master] d8afb649e Set the task arguments under the lock

Federico G. Schwindt fgsch at lodoss.net
Fri Jul 13 11:06:11 UTC 2018


commit d8afb649e465f3dce249dfd9985e34c87a056555
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