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

This commit is contained in:
Robert Rati 2015-05-26 11:08:17 -04:00
parent 13b8d947fc
commit 4e05d85413

View File

@ -1185,10 +1185,14 @@ func getDebugInfo(c *client.Client) (map[string]string, error) {
data := make(map[string]string)
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")
if err != nil {
Logf("Warning: Error trying to fetch %s debug data: %v", key, err)
continue
}
body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
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)
}