Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Error when doing the json parsing. #17

Open
kalashnikov opened this issue Jan 4, 2016 · 4 comments
Open

Error when doing the json parsing. #17

kalashnikov opened this issue Jan 4, 2016 · 4 comments

Comments

@kalashnikov
Copy link

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 "https://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?

@rakyll
Copy link
Owner

rakyll commented Jan 6, 2016

Related to #15.

@rakyll
Copy link
Owner

rakyll commented Jan 7, 2016

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 rakyll closed this as completed Jan 7, 2016
@kalashnikov
Copy link
Author

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}

@rakyll rakyll reopened this Jan 11, 2016
@rakyll
Copy link
Owner

rakyll commented Jan 11, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants