Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using json handler, it report that PANIC: reflect: call of reflect.Value.MapKeys on ptr Value #71

Open
Wang-Kai opened this issue Nov 23, 2018 · 0 comments

Comments

@Wang-Kai
Copy link

Wang-Kai commented Nov 23, 2018

Exactly, i love apex/log, i use it in many project.

But recently in a high load project, i report an odd bug PANIC: reflect: call of reflect.Value.MapKeys on ptr Value, it a little challenging .

line 48 | log.WithFields(log.Fields{
	    		"Method": r.Method,
	    		"Body":   reqBodyStr,
	    		"API":    r.URL.Path,
line 52 | }).Info("LoggerMiddleware")

Bug trace

/usr/lib/golang/src/encoding/json/encode.go:333 +0x82
encoding/json.(*encodeState).marshal(0xc0000c62c0, 0x807320, 0xc0001300e0, 0x7f0e582c0100, 0x0, 0x0)
	/usr/lib/golang/src/encoding/json/encode.go:305 +0xf4
encoding/json.(*Encoder).Encode(0xc000132230, 0x807320, 0xc0001300e0, 0x9acb6116ee30, 0xc0001b01e0)
	/usr/lib/golang/src/encoding/json/stream.go:200 +0x8a
gitlab.ucloudadmin.com/UserProduct/ukms-svc/vendor/github.com/apex/log/handlers/json.(*Handler).HandleLog(0xc00011a210, 0xc0001300e0, 0x0, 0x0)
	/root/kai.wang/go/src/gitlab.ucloudadmin.com/UserProduct/ukms-svc/vendor/github.com/apex/log/handlers/json/json.go:33 +0x8f
gitlab.ucloudadmin.com/UserProduct/ukms-svc/vendor/github.com/apex/log.(*Logger).log(0xcf1500, 0x1, 0xc000130070, 0x823089, 0x10)
	/root/kai.wang/go/src/gitlab.ucloudadmin.com/UserProduct/ukms-svc/vendor/github.com/apex/log/logger.go:146 +0x7f
gitlab.ucloudadmin.com/UserProduct/ukms-svc/vendor/github.com/apex/log.(*Entry).Info(0xc000130070, 0x823089, 0x10)
	/root/kai.wang/go/src/gitlab.ucloudadmin.com/UserProduct/ukms-svc/vendor/github.com/apex/log/entry.go:86 +0x50
gitlab.ucloudadmin.com/UserProduct/ukms-svc/middleware.Logger.func1(0x7f0e5822d080, 0xc00011e018, 0xc000126100, 0xc000280040)
	/root/kai.wang/go/src/gitlab.ucloudadmin.com/UserProduct/ukms-svc/middleware/logger.go:52 +0x37c
gitlab.ucloudadmin.com/UserProduct/ukms-svc/vendor/github.com/urfave/negroni.HandlerFunc.ServeHTTP(0x840698, 0x7f0e5822d080, 0xc00011e018, 0xc000126100, 0xc000280040)

Can you help me solve it ? or give me some tips ?

Thank you so much, my idol.

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

No branches or pull requests

1 participant