Skip to content

msgpack解码异常时,引起panic,rpcx没捕获异常,导致程序退出 #665

@Leadrive

Description

@Leadrive
panic: reflect: reflect.Value.SetString using unaddressable value

goroutine 106 [running]:
reflect.flag.mustBeAssignableSlow(0x98)
	C:/Go/src/reflect/value.go:260 +0x138
reflect.flag.mustBeAssignable(...)
	C:/Go/src/reflect/value.go:247
reflect.Value.SetString(0x10f3ba0, 0xc000392050, 0x98, 0xc000252f98, 0x8)
	C:/Go/src/reflect/value.go:1746 +0x37
github.com/vmihailenco/msgpack/v5.decodeStringValue(0xc000358cf0, 0x10f3ba0, 0xc000392050, 0x98, 0x10f3ba0, 0xc000392050)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode_string.go:67 +0x8b
github.com/vmihailenco/msgpack/v5.(*Decoder).DecodeValue(0xc000358cf0, 0x10f3ba0, 0xc000392050, 0x98, 0xc000392050, 0x98)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode.go:309 +0x8e
github.com/vmihailenco/msgpack/v5.decodeInterfaceValue(0xc000358cf0, 0x11513a0, 0xc000316780, 0x194, 0x11513a0, 0x11)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode_value.go:184 +0x9a
github.com/vmihailenco/msgpack/v5.(*Decoder).DecodeValue(0xc000358cf0, 0x11513a0, 0xc000316780, 0x194, 0x11513a0, 0xc000316780)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode.go:309 +0x8e
github.com/vmihailenco/msgpack/v5.decodeArrayValue(0xc000358cf0, 0x10fd780, 0xc000316780, 0x191, 0x10fd780, 0x17)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode_slice.go:141 +0x134
github.com/vmihailenco/msgpack/v5.(*Decoder).DecodeValue(0xc000358cf0, 0x10fd780, 0xc000316780, 0x191, 0x10fd780, 0xc000316780)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode.go:309 +0x8e
github.com/vmihailenco/msgpack/v5.decodeSliceValue(0xc000358cf0, 0x10d5a00, 0xc0002b3a48, 0x197, 0x1, 0x1)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode_slice.go:109 +0x205
github.com/vmihailenco/msgpack/v5.(*field).DecodeValue(0xc0002b2540, 0xc000358cf0, 0x120f9c0, 0xc0002b3a40, 0x199, 0x0, 0x0)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/types.go:118 +0x9a
github.com/vmihailenco/msgpack/v5.(*Decoder).decodeStruct(0xc000358cf0, 0x120f9c0, 0xc0002b3a40, 0x199, 0x4, 0xc0001cbac8, 0xa1e0b2)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode_map.go:324 +0x24f
github.com/vmihailenco/msgpack/v5.decodeStructValue(0xc000358cf0, 0x120f9c0, 0xc0002b3a40, 0x199, 0x120f9c0, 0x17)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode_map.go:282 +0x330
github.com/vmihailenco/msgpack/v5.(*Decoder).DecodeValue(0xc000358cf0, 0x120f9c0, 0xc0002b3a40, 0x199, 0x120f9c0, 0xc0002b3a40)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode.go:309 +0x8e
github.com/vmihailenco/msgpack/v5.decodeSliceValue(0xc000358cf0, 0x10d6500, 0xc0000c4418, 0x197, 0x1, 0x1)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode_slice.go:109 +0x205
github.com/vmihailenco/msgpack/v5.(*field).DecodeValue(0xc000231d80, 0xc000358cf0, 0x12ba120, 0xc0000c43c0, 0x199, 0x0, 0x0)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/types.go:118 +0x9a
github.com/vmihailenco/msgpack/v5.(*Decoder).decodeStruct(0xc000358cf0, 0x12ba120, 0xc0000c43c0, 0x199, 0x11, 0xc0001cbcc8, 0xa1e0b2)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode_map.go:324 +0x24f
github.com/vmihailenco/msgpack/v5.decodeStructValue(0xc000358cf0, 0x12ba120, 0xc0000c43c0, 0x199, 0x12ba120, 0x88)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode_map.go:282 +0x330
github.com/vmihailenco/msgpack/v5.(*Decoder).DecodeValue(0xc000358cf0, 0x12ba120, 0xc0000c43c0, 0x199, 0xc0000c43c0, 0x199)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode.go:309 +0x8e
github.com/vmihailenco/msgpack/v5.(*Decoder).Decode(0xc000358cf0, 0x12d0000, 0xc0000c43c0, 0x402fde, 0xc0001cbe57)
	C:/gowork/pkg/mod/github.com/vmihailenco/msgpack/v5@v5.3.4/decode.go:288 +0x178
github.com/smallnest/rpcx/codec.MsgpackCodec.Decode(0xc00009e5a3, 0x131, 0x131, 0x12d0000, 0xc0000c43c0, 0x3, 0xc0000a5ae0)
	C:/gowork/pkg/mod/github.com/smallnest/rpcx@v1.6.11/codec/codec.go:104 +0xd0
github.com/smallnest/rpcx/client.(*Client).input(0xc000372340)
	C:/gowork/pkg/mod/github.com/smallnest/rpcx@v1.6.11/client/client.go:697 +0x6d3
created by github.com/smallnest/rpcx/client.(*Client).Connect
	C:/gowork/pkg/mod/github.com/smallnest/rpcx@v1.6.11/client/connection.go:74 +0x1ee

在 C:/gowork/pkg/mod/github.com/smallnest/[email protected]/client/connection.go:74

go c.input()

msgpack解码异常,会引起panic,在线程中,没有捕获,会导致整个程序退出
vmihailenco/msgpack#309

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions