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

SIGINT gives panic when parsing log output #38

Closed
bendikro opened this issue Aug 7, 2017 · 0 comments
Closed

SIGINT gives panic when parsing log output #38

bendikro opened this issue Aug 7, 2017 · 0 comments

Comments

@bendikro
Copy link

bendikro commented Aug 7, 2017

When closing the server with CTRL+c, a panic occurs:

panic: interface conversion: interface is float64, not string

goroutine 131 [running]:
panic(0xc524e0, 0xc4209df100)
	/home/bro/programmer/go/go/src/runtime/panic.go:500 +0x1a1
github.com/hashicorp/go-plugin.parseJSON(0xc420445ef0, 0x84, 0x1, 0x1420360, 0xc4209fcbe0)
	/home/bro/programmer/fabriscale/go/ws/src/github.com/hashicorp/go-plugin/log_entry.go:118 +0x4fc
github.com/hashicorp/go-plugin.(*Client).logStderr(0xc4205172d0, 0x1411be0, 0xc420036200)
	/home/bro/programmer/fabriscale/go/ws/src/github.com/hashicorp/go-plugin/client.go:746 +0x277
created by github.com/hashicorp/go-plugin.(*Client).Start
	/home/bro/programmer/fabriscale/go/ws/src/github.com/hashicorp/go-plugin/client.go:544 +0xb3c
bendikro added a commit to bendikro/go-plugin that referenced this issue Aug 7, 2017
mitchellh added a commit that referenced this issue Aug 7, 2017
Fixes #38

hclog can properly handle interface{} types. Therefore, don't try to
turn the type into a string and just serialize the interface{}.

The serialization is done via JSON on stderr so this will effectively
and safely support any Go type witout panic. On the other side, hclog
will do a `fmt` with `%#v` for any type it can't natively support
outputting. This makes it safe to send directly to hclog.

While I was doing this work, I modified the test to also run against
grpc, so we can verify that grpc plugin logging works as well. This
should've been the case (and was) since the logging code is not specific
to protocols, but its good to gain coverage.
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