gom icon indicating copy to clipboard operation
gom copied to clipboard

Error when doing the json parsing.

Open kalashnikov opened this issue 10 years ago • 4 comments

Hi,

I got following error message and it looks strange.

error fetching stats: json: cannot unmarshal number into Go value of type main.stats

2__t0__ssh_

Using Go1.5 with Martini and invoke by gom -target "http://localhost:3000". Ubuntu 14.04.


I found that's because it cannot get the pprofstats info.

After updating, I got new message.

error fetching stats: invalid character '<' looking for beginning of value

2__t0__ssh_

Any suggestion to debug?

kalashnikov avatar Jan 04 '16 14:01 kalashnikov

Related to https://github.com/rakyll/gom/pull/15/.

rakyll avatar Jan 06 '16 06:01 rakyll

You need to manually register gom/http.Handler() to respond to /debug/_gom.

import gomhttp "github.com/rakyll/gom/http"

// ...
h := gomhttp.Handler()
m.Use(func(res http.ResponseWriter, req *http.Request) {
  if req.URL.Path == "/debug/_gom" {
    h(res, req)
  }
})

rakyll avatar Jan 07 '16 20:01 rakyll

I add as you suggested. But still get same error message.

error fetching stats: invalid character '<' looking for beginning of value

/debug/_gom shows below line

{"goroutine":28,"thread":9,"block":0,"timestamp":1452401805}

kalashnikov avatar Jan 10 '16 05:01 kalashnikov

I guess this is related to the body's being gzipped or not. I will try to reproduce and send out a fix soon.

rakyll avatar Jan 11 '16 19:01 rakyll