logs panic debug strace info

This commit is contained in:
fatedier 2018-05-11 10:42:57 +08:00
parent b2a2037032
commit 1464836f05
3 changed files with 12 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import (
"io"
"io/ioutil"
"runtime"
"runtime/debug"
"sync"
"time"
@ -271,6 +272,7 @@ func (ctl *Control) reader() {
defer func() {
if err := recover(); err != nil {
ctl.Error("panic error: %v", err)
ctl.Error(string(debug.Stack()))
}
}()
defer ctl.readerShutdown.Done()
@ -319,6 +321,7 @@ func (ctl *Control) msgHandler() {
defer func() {
if err := recover(); err != nil {
ctl.Error("panic error: %v", err)
ctl.Error(string(debug.Stack()))
}
}()
defer ctl.msgHandlerShutdown.Done()

View File

@ -512,6 +512,7 @@ func (cfg *HttpProxyConf) CheckForSvr() (err error) {
err = fmt.Errorf("type [http] not support when vhost_http_port is not set")
}
if err = cfg.DomainConf.checkForSvr(); err != nil {
err = fmt.Errorf("proxy [%s] domain conf check error: %v", cfg.ProxyName, err)
return
}
return
@ -574,6 +575,7 @@ func (cfg *HttpsProxyConf) CheckForSvr() (err error) {
return fmt.Errorf("type [https] not support when vhost_https_port is not set")
}
if err = cfg.DomainConf.checkForSvr(); err != nil {
err = fmt.Errorf("proxy [%s] domain conf check error: %v", cfg.ProxyName, err)
return
}
return

View File

@ -17,6 +17,7 @@ package server
import (
"fmt"
"io"
"runtime/debug"
"sync"
"time"
@ -125,6 +126,7 @@ func (ctl *Control) RegisterWorkConn(conn net.Conn) {
defer func() {
if err := recover(); err != nil {
ctl.conn.Error("panic error: %v", err)
ctl.conn.Error(string(debug.Stack()))
}
}()
@ -145,6 +147,7 @@ func (ctl *Control) GetWorkConn() (workConn net.Conn, err error) {
defer func() {
if err := recover(); err != nil {
ctl.conn.Error("panic error: %v", err)
ctl.conn.Error(string(debug.Stack()))
}
}()
@ -199,6 +202,7 @@ func (ctl *Control) writer() {
defer func() {
if err := recover(); err != nil {
ctl.conn.Error("panic error: %v", err)
ctl.conn.Error(string(debug.Stack()))
}
}()
@ -228,6 +232,7 @@ func (ctl *Control) reader() {
defer func() {
if err := recover(); err != nil {
ctl.conn.Error("panic error: %v", err)
ctl.conn.Error(string(debug.Stack()))
}
}()
@ -254,6 +259,7 @@ func (ctl *Control) stoper() {
defer func() {
if err := recover(); err != nil {
ctl.conn.Error("panic error: %v", err)
ctl.conn.Error(string(debug.Stack()))
}
}()
@ -292,6 +298,7 @@ func (ctl *Control) manager() {
defer func() {
if err := recover(); err != nil {
ctl.conn.Error("panic error: %v", err)
ctl.conn.Error(string(debug.Stack()))
}
}()
@ -306,7 +313,6 @@ func (ctl *Control) manager() {
case <-heartbeat.C:
if time.Since(ctl.lastPing) > time.Duration(g.GlbServerCfg.HeartBeatTimeout)*time.Second {
ctl.conn.Warn("heartbeat timeout")
ctl.allShutdown.Start()
return
}
case rawMsg, ok := <-ctl.readCh: