This is an automated email from the ASF dual-hosted git repository. elsloo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push: new 8227159 Add TM poller panic stacktrace 8227159 is described below commit 8227159c6f1910330a006be6d2d29ea65ebde4c9 Author: Robert Butts <r...@apache.org> AuthorDate: Mon Feb 19 15:08:12 2018 -0700 Add TM poller panic stacktrace Currently, if the poller panics, it prints a useless error. This changes it to print the stacktrace, making it possible to debug the line and call stack of the nil pointer reference. --- traffic_monitor/poller/poller.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/traffic_monitor/poller/poller.go b/traffic_monitor/poller/poller.go index a8fff5e..ef74059 100644 --- a/traffic_monitor/poller/poller.go +++ b/traffic_monitor/poller/poller.go @@ -23,6 +23,7 @@ import ( "math/rand" "net/http" "os" + "runtime" "sync/atomic" "time" @@ -135,6 +136,7 @@ func (p MonitorConfigPoller) Poll() { } else { log.Errorf("MonitorConfigPoller failed without panic\n") } + log.Errorf("%s\n", stacktrace()) os.Exit(1) // The Monitor can't run without a MonitorConfigPoller }() for { @@ -273,7 +275,7 @@ func diffConfigs(old HttpPollerConfig, new HttpPollerConfig) ([]string, []HTTPPo Interval: new.Interval, NoKeepAlive: new.NoKeepAlive, ID: id, - PollConfig: pollCfg, + PollConfig: pollCfg, }) } return deletions, additions @@ -289,7 +291,7 @@ func diffConfigs(old HttpPollerConfig, new HttpPollerConfig) ([]string, []HTTPPo Interval: new.Interval, NoKeepAlive: new.NoKeepAlive, ID: id, - PollConfig: newPollCfg, + PollConfig: newPollCfg, }) } } @@ -301,10 +303,22 @@ func diffConfigs(old HttpPollerConfig, new HttpPollerConfig) ([]string, []HTTPPo Interval: new.Interval, NoKeepAlive: new.NoKeepAlive, ID: id, - PollConfig: newPollCfg, + PollConfig: newPollCfg, }) } } return deletions, additions } + +func stacktrace() []byte { + initialBufSize := 1024 + buf := make([]byte, initialBufSize) + for { + n := runtime.Stack(buf, true) + if n < len(buf) { + return buf[:n] + } + buf = make([]byte, len(buf)*2) + } +} -- To stop receiving notification emails like this one, please contact els...@apache.org.