elsloo closed pull request #1894: Add Monitor poller panic stacktrace URL: https://github.com/apache/incubator-trafficcontrol/pull/1894
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/traffic_monitor/poller/poller.go b/traffic_monitor/poller/poller.go index a8fff5e1f5..ef7405902c 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) + } +} ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services