panic : interface conversion: interface is nil, not jsoniter.ValEncoder
go version : 16.3 ENV : PRODUCTION stack: panic({0x12fc400, 0xc000c24600}) /micro/go/src/runtime/panic.go:1038 +0x215 github.com/json-iterator/go.(*frozenConfig).getEncoderFromCache(...) /var/lib/jenkins/workspace/UserService/vendor/github.com/json-iterator/go/config.go:109 github.com/json-iterator/go.(*Stream).WriteVal(0xc003e80480, {0x13dfc60, 0xc0023dd0c0}) /var/lib/jenkins/workspace/UserService/vendor/github.com/json-iterator/go/reflect.go:93 +0x105 github.com/json-iterator/go.(*frozenConfig).MarshalToString(0xc000133ae0, {0x13dfc60, 0xc0023dd0c0}) /var/lib/jenkins/workspace/UserService/vendor/github.com/json-iterator/go/config.go:289 +0xa6 github.com/json-iterator/go.MarshalToString(...) /var/lib/jenkins/workspace/UserService/vendor/github.com/json-iterator/go/adapter.go:44
I've read json-iterator/go/config.go 109, get nil valDecoder from cache
So many this errors, and I can't reproduce it.
input value is a grpc msg,not nil
github.com/json-iterator/go v1.1.12
+1
Recently we met a problem , the end of error comes from github.com/json-iterator/go/config.go:107
func (cfg *frozenConfig) getDecoderFromCache(cacheKey uintptr) ValDecoder {
decoder, found := cfg.decoderCache.Load(cacheKey)
if found {
return decoder.(ValDecoder)
}
return nil
}
decoder is nil yet found is true.
and then we get the panic
interface conversion: interface is nil, not jsoniter.ValDecodergoroutine 208649965 [running]:runtime/debug.Stack() /micro/go/src/runtime/debug/stack.go:24 +0x65github.com/asim/go-micro/plugins/server/grpc/v3.(*grpcServer).processRequest.func1.1() /var/lib/jenkins/workspace/UserService/vendor/github.com/asim/go-micro/plugins/server/grpc/v3/grpc.go:401 +0x85panic({0x1307260, 0xc0067012c0}) /micro/go/src/runtime/panic.go:1038 +0x215github.com/json-iterator/go.(*frozenConfig).getDecoderFromCache(...) /var/lib/jenkins/workspace/UserService/vendor/github.com/json-iterator/go/config.go:101github.com/json-iterator/go.(*Iterator).ReadVal(0xc001258090, {0x1384dc0, 0xc002005440}) /var/lib/jenkins/workspace/UserService/vendor/github.com/json-iterator/go/reflect.go:65 +0x85github.com/json-iterator/go.(*frozenConfig).UnmarshalFromString(0xc0000d5cc0, {0xc0002dac40, 0xc00028c3c0}, {0x1384dc0, 0xc002005440}) /var/lib/jenkins/workspace/UserService/vendor/github.com/json-iterator/go/config.go:327 +0xb9github.com/json-iterator/go.UnmarshalFromString(...) /var/lib/jenkins/workspace/UserService/vendor/github.com/json-iterator/go/adapter.go:21crazyfox-micro/tkpkg/json.UnmarshalFromString(...)
it results a huge scope of mistakes and me hope you can help us with this . thanks a lot.