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"
"io/ioutil" "io/ioutil"
"runtime" "runtime"
"runtime/debug"
"sync" "sync"
"time" "time"
@ -271,6 +272,7 @@ func (ctl *Control) reader() {
defer func() { defer func() {
if err := recover(); err != nil { if err := recover(); err != nil {
ctl.Error("panic error: %v", err) ctl.Error("panic error: %v", err)
ctl.Error(string(debug.Stack()))
} }
}() }()
defer ctl.readerShutdown.Done() defer ctl.readerShutdown.Done()
@ -319,6 +321,7 @@ func (ctl *Control) msgHandler() {
defer func() { defer func() {
if err := recover(); err != nil { if err := recover(); err != nil {
ctl.Error("panic error: %v", err) ctl.Error("panic error: %v", err)
ctl.Error(string(debug.Stack()))
} }
}() }()
defer ctl.msgHandlerShutdown.Done() 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") err = fmt.Errorf("type [http] not support when vhost_http_port is not set")
} }
if err = cfg.DomainConf.checkForSvr(); err != nil { if err = cfg.DomainConf.checkForSvr(); err != nil {
err = fmt.Errorf("proxy [%s] domain conf check error: %v", cfg.ProxyName, err)
return return
} }
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") return fmt.Errorf("type [https] not support when vhost_https_port is not set")
} }
if err = cfg.DomainConf.checkForSvr(); err != nil { if err = cfg.DomainConf.checkForSvr(); err != nil {
err = fmt.Errorf("proxy [%s] domain conf check error: %v", cfg.ProxyName, err)
return return
} }
return return

View File

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