Commit 4e05d854 authored by Robert Rati's avatar Robert Rati

Fixed issue reading empty response from a get in getDebugInfo. #7572

parent 13b8d947
...@@ -1185,10 +1185,14 @@ func getDebugInfo(c *client.Client) (map[string]string, error) { ...@@ -1185,10 +1185,14 @@ func getDebugInfo(c *client.Client) (map[string]string, error) {
data := make(map[string]string) data := make(map[string]string)
for _, key := range []string{"block", "goroutine", "heap", "threadcreate"} { for _, key := range []string{"block", "goroutine", "heap", "threadcreate"} {
resp, err := http.Get(c.Get().AbsPath(fmt.Sprintf("debug/pprof/%s", key)).URL().String() + "?debug=2") resp, err := http.Get(c.Get().AbsPath(fmt.Sprintf("debug/pprof/%s", key)).URL().String() + "?debug=2")
if err != nil {
Logf("Warning: Error trying to fetch %s debug data: %v", key, err)
continue
}
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close() resp.Body.Close()
if err != nil { if err != nil {
Logf("Warning: Error trying to fetch %s debug data: %v", key, err) Logf("Warning: Error trying to read %s debug data: %v", key, err)
} }
data[key] = string(body) data[key] = string(body)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment