From f9a0d891a1635b69788ca31035728098d5f24997 Mon Sep 17 00:00:00 2001 From: fatedier Date: Tue, 17 Jan 2017 22:48:21 +0800 Subject: [PATCH] pool: fix panic caused by sending to closed channel, fix #237 --- src/models/server/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/models/server/server.go b/src/models/server/server.go index 978a509..364e624 100644 --- a/src/models/server/server.go +++ b/src/models/server/server.go @@ -445,6 +445,12 @@ func (p *ProxyServer) getWorkConn() (workConn *conn.Conn, err error) { } func (p *ProxyServer) connectionPoolManager(closeCh <-chan struct{}) { + defer func() { + if r := recover(); r != nil { + log.Warn("ProxyName [%s], connectionPoolManager panic %v", p.Name, r) + } + }() + for { // check if we need more work connections and send messages to frpc to get more time.Sleep(time.Duration(2) * time.Second)