From 3ac1b9fe33c42f53f90f6868d82450213cf844d7 Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Tue, 17 Jan 2017 12:51:24 -0600 Subject: [PATCH] tpl: Fix deadlock in cached partials Cached partials that contained cached partials would create a deadlock. Fixes #2935 --- tpl/template_funcs.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tpl/template_funcs.go b/tpl/template_funcs.go index 6c8a9957e..8f653808b 100644 --- a/tpl/template_funcs.go +++ b/tpl/template_funcs.go @@ -1541,7 +1541,10 @@ func (tf *templateFuncster) Get(key, name string, context interface{}) (p templa tf.cachedPartials.Lock() if p, ok = tf.cachedPartials.p[key]; !ok { + tf.cachedPartials.Unlock() p = tf.t.partial(name, context) + + tf.cachedPartials.Lock() tf.cachedPartials.p[key] = p } tf.cachedPartials.Unlock()