From 0e5463652fd0145ba8a842f3961eb214d1800a07 Mon Sep 17 00:00:00 2001 From: chenzhihui Date: Tue, 1 Dec 2020 12:47:35 +0800 Subject: [PATCH 1/6] fix pool deadlock --- pkg/container/pool/list.go | 2 +- pkg/container/pool/slice.go | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/container/pool/list.go b/pkg/container/pool/list.go index 97e9afc5c..ec40fca6a 100644 --- a/pkg/container/pool/list.go +++ b/pkg/container/pool/list.go @@ -50,7 +50,7 @@ func NewList(c *Config) *List { // Reload reload config. func (p *List) Reload(c *Config) error { p.mu.Lock() - p.startCleanerLocked(time.Duration(c.IdleTimeout)) + //p.startCleanerLocked(time.Duration(c.IdleTimeout)) p.conf = c p.mu.Unlock() return nil diff --git a/pkg/container/pool/slice.go b/pkg/container/pool/slice.go index 6876565ed..8a02b509f 100644 --- a/pkg/container/pool/slice.go +++ b/pkg/container/pool/slice.go @@ -61,7 +61,7 @@ func NewSlice(c *Config) *Slice { // Reload reload config. func (p *Slice) Reload(c *Config) error { p.mu.Lock() - p.startCleanerLocked(time.Duration(c.IdleTimeout)) + //p.startCleanerLocked(time.Duration(c.IdleTimeout)) p.setActive(c.Active) p.setIdle(c.Idle) p.conf = c @@ -260,7 +260,6 @@ func (p *Slice) openNewItem(ctx context.Context) { // // If n <= 0, no idle items are retained. func (p *Slice) setIdle(n int) { - p.mu.Lock() if n > 0 { p.conf.Idle = n } else { @@ -278,7 +277,6 @@ func (p *Slice) setIdle(n int) { closing = p.freeItem[maxIdle:] p.freeItem = p.freeItem[:maxIdle] } - p.mu.Unlock() for _, c := range closing { c.close() } @@ -293,13 +291,11 @@ func (p *Slice) setIdle(n int) { // If n <= 0, then there is no limit on the number of open items. // The default is 0 (unlimited). func (p *Slice) setActive(n int) { - p.mu.Lock() p.conf.Active = n if n < 0 { p.conf.Active = 0 } syncIdle := p.conf.Active > 0 && p.maxIdleItemsLocked() > p.conf.Active - p.mu.Unlock() if syncIdle { p.setIdle(n) } From 312a69eee4f11a8eb6d34311ab269323e6f3e580 Mon Sep 17 00:00:00 2001 From: chenzhihui Date: Tue, 1 Dec 2020 12:58:11 +0800 Subject: [PATCH 2/6] fix workflow --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9a2ebaa6b..01f15a742 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -92,7 +92,7 @@ jobs: - name: Set up Env run: | - echo "::set-env name=GOPATH::$(go env GOPATH)" + # echo "::set-env name=GOPATH::$(go env GOPATH)" echo "::add-path::$(go env GOPATH)/bin" - name: Check out code into the Go module directory From c2d871bf340912fab2d51ee811adc779a7b3cd05 Mon Sep 17 00:00:00 2001 From: chenzhihui Date: Tue, 1 Dec 2020 13:01:16 +0800 Subject: [PATCH 3/6] remove deprecating command --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 01f15a742..2c3a69783 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -93,7 +93,7 @@ jobs: - name: Set up Env run: | # echo "::set-env name=GOPATH::$(go env GOPATH)" - echo "::add-path::$(go env GOPATH)/bin" + # echo "::add-path::$(go env GOPATH)/bin" - name: Check out code into the Go module directory uses: actions/checkout@v2 From 0d2cabd939d864c353bc2db8b343222c05fbc4fb Mon Sep 17 00:00:00 2001 From: Windfarer Date: Tue, 1 Dec 2020 17:19:52 +0800 Subject: [PATCH 4/6] recover env --- .github/workflows/go.yml | 4 ++-- go.mod | 1 + go.sum | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2c3a69783..9a2ebaa6b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -92,8 +92,8 @@ jobs: - name: Set up Env run: | - # echo "::set-env name=GOPATH::$(go env GOPATH)" - # echo "::add-path::$(go env GOPATH)/bin" + echo "::set-env name=GOPATH::$(go env GOPATH)" + echo "::add-path::$(go env GOPATH)/bin" - name: Check out code into the Go module directory uses: actions/checkout@v2 diff --git a/go.mod b/go.mod index d8c80fc05..8e2f518a7 100644 --- a/go.mod +++ b/go.mod @@ -32,6 +32,7 @@ require ( github.com/leodido/go-urn v1.1.0 // indirect github.com/mattn/go-colorable v0.1.4 // indirect github.com/mattn/go-isatty v0.0.10 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/montanaflynn/stats v0.5.0 github.com/openzipkin/zipkin-go v0.2.1 github.com/otokaze/mock v0.0.0-20190125081256-8282b7a7c7c3 diff --git a/go.sum b/go.sum index d351be9ad..9de294c66 100644 --- a/go.sum +++ b/go.sum @@ -465,8 +465,6 @@ google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRn google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.28.1 h1:C1QC6KzgSiLyBabDi87BbjaGreoRgGUF5nOyvfrAZ1k= google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= From 6785585b173be57ff877bcc9d3515dbb913111a2 Mon Sep 17 00:00:00 2001 From: Windfarer Date: Tue, 1 Dec 2020 17:29:01 +0800 Subject: [PATCH 5/6] fix env --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9a2ebaa6b..ce6d3e2e6 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -92,8 +92,8 @@ jobs: - name: Set up Env run: | - echo "::set-env name=GOPATH::$(go env GOPATH)" - echo "::add-path::$(go env GOPATH)/bin" + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Check out code into the Go module directory uses: actions/checkout@v2 From 6d5f0a1b3c6b5aa1d9723379d379e237260a8b9f Mon Sep 17 00:00:00 2001 From: Windfarer Date: Tue, 1 Dec 2020 18:20:09 +0800 Subject: [PATCH 6/6] cleaning --- pkg/container/pool/list.go | 1 - pkg/container/pool/slice.go | 1 - 2 files changed, 2 deletions(-) diff --git a/pkg/container/pool/list.go b/pkg/container/pool/list.go index ec40fca6a..7155953e6 100644 --- a/pkg/container/pool/list.go +++ b/pkg/container/pool/list.go @@ -50,7 +50,6 @@ func NewList(c *Config) *List { // Reload reload config. func (p *List) Reload(c *Config) error { p.mu.Lock() - //p.startCleanerLocked(time.Duration(c.IdleTimeout)) p.conf = c p.mu.Unlock() return nil diff --git a/pkg/container/pool/slice.go b/pkg/container/pool/slice.go index 8a02b509f..512ece39b 100644 --- a/pkg/container/pool/slice.go +++ b/pkg/container/pool/slice.go @@ -61,7 +61,6 @@ func NewSlice(c *Config) *Slice { // Reload reload config. func (p *Slice) Reload(c *Config) error { p.mu.Lock() - //p.startCleanerLocked(time.Duration(c.IdleTimeout)) p.setActive(c.Active) p.setIdle(c.Idle) p.conf = c