From 913207ae57a65e7346a8ef244c8e5b70ef5cdd2d Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Fri, 9 Jun 2017 02:11:58 +0800 Subject: [PATCH] Fix pool contains wrong environment metadata (#221) The generic pool manager creates a generic pool with the reference of environment metadata. Since the reference is address of loop variable, so the content of metadata will be replaced with the last element of envs. So pool manager sets up logging with wrong env. --- poolmgr/gpm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poolmgr/gpm.go b/poolmgr/gpm.go index deaada7f7..3214a2618 100644 --- a/poolmgr/gpm.go +++ b/poolmgr/gpm.go @@ -157,8 +157,8 @@ func (gpm *GenericPoolManager) eagerPoolCreator() { // creating pools for envs that are actually used by functions. Also we might want // to keep these eagerly created pools smaller than the ones created when there are // actual function calls. - for _, env := range envs { - _, err := gpm.GetPool(&env) + for i := range envs { + _, err := gpm.GetPool(&envs[i]) if err != nil { log.Printf("eager-create pool failed: %v", err) }