apache/dubbo-go-hessian2

hessian 解参panic

zonghaishang opened this issue · 8 comments

hessian: github.com/apache/dubbo-go-hessian2 v1.4.1-0.20200516085443-fa6429e4481d

What happened:

stack source: https://github.com/mosn/mosn/blob/9409ffa46969e2389f0debb9b442feb865c8ec08/pkg/protocol/xprotocol/dubbo/decoder.go#L241

runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x7a
mosn.io/mosn/pkg/protocol/xprotocol/dubbo.getServiceAwareMeta.func1()
        /go/pkg/mod/mosn.io/mosn@v1.3.1-0.20221214065759-115fe50bb7e8/pkg/protocol/xprotocol/dubbo/decoder.go:229 +0x55
panic({0x3f06e20, 0x57dbc30})
        /usr/local/go/src/runtime/panic.go:890 +0x262
github.com/apache/dubbo-go-hessian2.(*Decoder).decType(0xc00183dc70)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/decode.go:181 +0x5e1
github.com/apache/dubbo-go-hessian2.(*Decoder).decMap(0xc00183dc70, 0x4d)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/map.go:248 +0x28f
github.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue(0xc00183dc70)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/decode.go:256 +0xeb4
github.com/apache/dubbo-go-hessian2.(*Decoder).skip(0xc00183dc70, {{0xc001949ad0, 0x33}, {0xc00019f880, 0x7, 0x7}, {0x0, 0x0, 0x0}})
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/object.go:589 +0xc5
github.com/apache/dubbo-go-hessian2.(*Decoder).decObject(0xc00183dc70, 0x61)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/object.go:657 +0x13f2
github.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue(0xc00183dc70)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/decode.go:260 +0xfff
github.com/apache/dubbo-go-hessian2.(*Decoder).decObject(0xc00183dc70, 0x43)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/object.go:626 +0x550
github.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue(0xc00183dc70)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/decode.go:260 +0xfff
github.com/apache/dubbo-go-hessian2.(*Decoder).skip(0xc00183dc70, {{0xc000f4fc00, 0x36}, {0xc001882e80, 0x4, 0x4}, {0x0, 0x0, 0x0}})
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/object.go:589 +0xc5
github.com/apache/dubbo-go-hessian2.(*Decoder).decObject(0xc00183dc70, 0x60)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/object.go:657 +0x13f2
github.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue(0xc00183dc70)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/decode.go:260 +0xfff
github.com/apache/dubbo-go-hessian2.(*Decoder).decObject(0xc00183dc70, 0x43)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/object.go:626 +0x550
github.com/apache/dubbo-go-hessian2.(*Decoder).DecodeValue(0xc00183dc70)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/decode.go:260 +0xfff
github.com/apache/dubbo-go-hessian2.(*Decoder).Decode(0xc00183dc70)
        /go/pkg/mod/github.com/apache/dubbo-go-hessian2@v1.4.1-0.20200516085443-fa6429e4481d/decode.go:189 +0x53
mosn.io/mosn/pkg/protocol/xprotocol/dubbo.getServiceAwareMeta({0x4564ab0, 0xc001987bf0}, 0xc000f7b2c0)
        /go/pkg/mod/mosn.io/mosn@v1.3.1-0.20221214065759-115fe50bb7e8/pkg/protocol/xprotocol/dubbo/decoder.go:241 +0x1d6d

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

@zonghaishang the v1.4.1 was released three years ago, does the latest version v1.12.3 works?

@zonghaishang the v1.4.1 was released three years ago, does the latest version v1.12.3 works?

I'll test it with the new version this week

@zonghaishang does it work to use the latest version?

@zonghaishang does it work to use the latest version?

我一会试一下,先找下问题原因

image

解析 dubbo框架 org.apache.dubbo.common.url.component.ServiceConfigURL 类属性 URLParam 导致 panic, 调试模式hessain go解析不到 URLParam EXTRA_PARAMS map的type类型。

image

原始报文:


0040   da bb c2 00 7d ce e0 7c 1b be 60 c2   			 ....}..|..`.
0050   00 00 06 1a 05 32 2e 30 2e 32 30 27 6f 72 67 2e   .....2.0.20'org.
0060   61 70 61 63 68 65 2e 64 75 62 62 6f 2e 6d 6f 6e   apache.dubbo.mon
0070   69 74 6f 72 2e 4d 6f 6e 69 74 6f 72 53 65 72 76   itor.MonitorServ
0080   69 63 65 05 30 2e 30 2e 30 07 63 6f 6c 6c 65 63   ice.0.0.0.collec
0090   74 1d 4c 6f 72 67 2f 61 70 61 63 68 65 2f 64 75   t.Lorg/apache/du
00a0   62 62 6f 2f 63 6f 6d 6d 6f 6e 2f 55 52 4c 3b 43   bbo/common/URL;C
00b0   30 36 6f 72 67 2e 61 70 61 63 68 65 2e 64 75 62   06org.apache.dub
00c0   62 6f 2e 63 6f 6d 6d 6f 6e 2e 75 72 6c 2e 63 6f   bo.common.url.co
00d0   6d 70 6f 6e 65 6e 74 2e 53 65 72 76 69 63 65 43   mponent.ServiceC
00e0   6f 6e 66 69 67 55 52 4c 94 0a 61 74 74 72 69 62   onfigURL..attrib
00f0   75 74 65 73 08 75 72 6c 50 61 72 61 6d 0a 75 72   utes.urlParam.ur
0100   6c 41 64 64 72 65 73 73 0d 68 61 73 68 43 6f 64   lAddress.hashCod
0110   65 43 61 63 68 65 60 4e 43 30 33 6f 72 67 2e 61   eCache`NC03org.a
0120   70 61 63 68 65 2e 64 75 62 62 6f 2e 63 6f 6d 6d   pache.dubbo.comm
0130   6f 6e 2e 75 72 6c 2e 63 6f 6d 70 6f 6e 65 6e 74   on.url.component
0140   2e 55 52 4c 50 6c 61 69 6e 50 61 72 61 6d 97 11   .URLPlainParam..
0150   4d 45 54 48 4f 44 5f 50 41 52 41 4d 45 54 45 52   METHOD_PARAMETER
0160   53 0c 45 58 54 52 41 5f 50 41 52 41 4d 53 05 56   S.EXTRA_PARAMS.V
0170   41 4c 55 45 03 4b 45 59 0d 68 61 73 68 43 6f 64   ALUE.KEY.hashCod
0180   65 43 61 63 68 65 10 65 6e 61 62 6c 65 43 6f 6d   eCache.enableCom
0190   70 72 65 73 73 65 64 08 72 61 77 50 61 72 61 6d   pressed.rawParam
01a0   61 4d 30 25 6a 61 76 61 2e 75 74 69 6c 2e 43 6f   aM0%java.util.Co
01b0   6c 6c 65 63 74 69 6f 6e 73 24 55 6e 6d 6f 64 69   llections$Unmodi
01c0   66 69 61 62 6c 65 4d 61 70 06 6f 75 74 70 75 74   fiableMap.output
01d0   48 03 6d 61 78 01 30 5a 07 65 6c 61 70 73 65 64   H.max.0Z.elapsed
01e0   48 03 6d 61 78 03 39 38 30 5a 05 69 6e 70 75 74   H.max.980Z.input
01f0   48 03 6d 61 78 01 30 5a 0a 63 6f 6e 63 75 72 72   H.max.0Z.concurr
0200   65 6e 74 48 03 6d 61 78 01 34 5a 5a 4d 90 06 6d   entH.max.4ZZM..m
0210   65 74 68 6f 64 08 73 61 79 48 65 6c 6c 6f 0a 63   ethod.sayHello.c
0220   6f 6e 63 75 72 72 65 6e 74 01 31 05 64 75 62 62   oncurrent.1.dubb
0230   6f 05 32 2e 30 2e 32 09 69 6e 74 65 72 66 61 63   o.2.0.2.interfac
0240   65 30 35 63 6f 6d 2e 62 65 73 74 70 61 79 2e 64   e05com.bestpay.d
0250   65 76 6f 70 73 2e 63 7a 6f 6e 65 6d 65 73 68 70   evops.czonemeshp
0260   72 6f 76 69 64 65 72 2e 65 76 65 6e 74 2e 43 7a   rovider.event.Cz
0270   6f 6e 65 45 76 65 6e 74 07 76 65 72 73 69 6f 6e   oneEvent.version
0280   4e 07 65 6c 61 70 73 65 64 04 35 31 31 30 06 6f   N.elapsed.5110.o
0290   75 74 70 75 74 01 30 0e 6d 61 78 2e 63 6f 6e 63   utput.0.max.conc
02a0   75 72 72 65 6e 74 01 34 05 69 6e 70 75 74 01 30   urrent.4.input.0
02b0   0b 61 70 70 6c 69 63 61 74 69 6f 6e 0f 77 61 6e   .application.wan
02c0   67 68 61 6e 63 6f 6e 73 75 6d 65 72 08 70 72 6f   ghanconsumer.pro
02d0   76 69 64 65 72 0e 31 37 32 2e 31 37 2e 32 32 30   vider.172.17.220
02e0   2e 31 39 32 07 73 75 63 63 65 73 73 02 32 37 07   .192.success.27.
02f0   66 61 69 6c 75 72 65 01 30 0b 6d 61 78 2e 65 6c   failure.0.max.el
0300   61 70 73 65 64 03 39 38 30 09 6d 61 78 2e 69 6e   apsed.980.max.in
0310   70 75 74 01 30 0a 6d 61 78 2e 6f 75 74 70 75 74   put.0.max.output
0320   01 30 05 67 72 6f 75 70 4e 09 74 69 6d 65 73 74   .0.groupN.timest
0330   61 6d 70 0d 31 36 39 39 35 38 30 39 39 37 35 38   amp.169958099758
0340   38 5a 70 04 5b 69 6e 74 43 30 2e 63 6f 6d 2e 61   8Zp.[intC0.com.a
0350   6c 69 62 61 62 61 2e 63 6f 6d 2e 63 61 75 63 68   libaba.com.cauch
0360   6f 2e 68 65 73 73 69 61 6e 2e 69 6f 2e 42 69 74   o.hessian.io.Bit
0370   53 65 74 48 61 6e 64 6c 65 91 05 77 6f 72 64 73   SetHandle..words
0380   62 70 05 5b 6c 6f 6e 67 8f 46 31 31 6d 65 74 68   bp.[long.F11meth
0390   6f 64 3d 73 61 79 48 65 6c 6c 6f 26 63 6f 6e 63   od=sayHello&conc
03a0   75 72 72 65 6e 74 3d 31 26 64 75 62 62 6f 3d 32   urrent=1&dubbo=2
03b0   2e 30 2e 32 26 69 6e 74 65 72 66 61 63 65 3d 63   .0.2&interface=c
03c0   6f 6d 2e 62 65 73 74 70 61 79 2e 64 65 76 6f 70   om.bestpay.devop
03d0   73 2e 63 7a 6f 6e 65 6d 65 73 68 70 72 6f 76 69   s.czonemeshprovi
03e0   64 65 72 2e 65 76 65 6e 74 2e 43 7a 6f 6e 65 45   der.event.CzoneE
03f0   76 65 6e 74 26 76 65 72 73 69 6f 6e 3d 26 65 6c   vent&version=&el
0400   61 70 73 65 64 3d 35 31 31 30 26 6f 75 74 70 75   apsed=5110&outpu
0410   74 3d 30 26 6d 61 78 2e 63 6f 6e 63 75 72 72 65   t=0&max.concurre
0420   6e 74 3d 34 26 69 6e 70 75 74 3d 30 26 61 70 70   nt=4&input=0&app
0430   6c 69 63 61 74 69 6f 6e 3d 77 61 6e 67 68 61 6e   lication=wanghan
0440   63 6f 6e 73 75 6d 65 72 26 70 72 6f 76 69 64 65   consumer&provide
0450   72 3d 31 37 32 2e 31 37 2e 32 32 30 2e 31 39 32   r=172.17.220.192
0460   26 73 75 63 63 65 73 73 3d 32 37 26 66 61 69 6c   &success=27&fail
0470   75 72 65 3d 30 26 6d 61 78 2e 65 6c 61 70 73 65   ure=0&max.elapse
0480   64 3d 39 38 30 26 6d 61 78 2e 69 6e 70 75 74 3d   d=980&max.input=
0490   30 26 6d 61 78 2e 6f 75 74 70 75 74 3d 30 26 67   0&max.output=0&g
04a0   72 6f 75 70 3d 26 74 69 6d 65 73 74 61 6d 70 3d   roup=&timestamp=
04b0   31 36 39 39 35 38 30 39 39 37 35 38 38 43 30 34   1699580997588C04
04c0   6f 72 67 2e 61 70 61 63 68 65 2e 64 75 62 62 6f   org.apache.dubbo
04d0   2e 63 6f 6d 6d 6f 6e 2e 75 72 6c 2e 63 6f 6d 70   .common.url.comp
04e0   6f 6e 65 6e 74 2e 50 61 74 68 55 52 4c 41 64 64   onent.PathURLAdd
04f0   72 65 73 73 96 04 70 6f 72 74 04 68 6f 73 74 04   ress..port.host.
0500   70 61 74 68 08 70 61 73 73 77 6f 72 64 08 75 73   path.password.us
0510   65 72 6e 61 6d 65 08 70 72 6f 74 6f 63 6f 6c 63   ername.protocolc
0520   90 0e 31 37 32 2e 31 37 2e 32 32 30 2e 31 39 32   ..172.17.220.192
0530   30 3e 63 6f 6d 2e 62 65 73 74 70 61 79 2e 64 65   0>com.bestpay.de
0540   76 6f 70 73 2e 63 7a 6f 6e 65 6d 65 73 68 70 72   vops.czonemeshpr
0550   6f 76 69 64 65 72 2e 65 76 65 6e 74 2e 43 7a 6f   ovider.event.Czo
0560   6e 65 45 76 65 6e 74 2f 73 61 79 48 65 6c 6c 6f   neEvent/sayHello
0570   4e 4e 05 63 6f 75 6e 74 8f 48 04 70 61 74 68 30   NN.count.H.path0
0580   27 6f 72 67 2e 61 70 61 63 68 65 2e 64 75 62 62   'org.apache.dubb
0590   6f 2e 6d 6f 6e 69 74 6f 72 2e 4d 6f 6e 69 74 6f   o.monitor.Monito
05a0   72 53 65 72 76 69 63 65 12 72 65 6d 6f 74 65 2e   rService.remote.
05b0   61 70 70 6c 69 63 61 74 69 6f 6e 0f 77 61 6e 67   application.wang
05c0   68 61 6e 63 6f 6e 73 75 6d 65 72 0c 58 2d 43 41   hanconsumer.X-CA
05d0   4c 4c 45 52 2d 41 50 50 0f 77 61 6e 67 68 61 6e   LLER-APP.wanghan
05e0   63 6f 6e 73 75 6d 65 72 0d 78 2d 72 70 63 2d 73   consumer.x-rpc-s
05f0   65 72 76 69 63 65 30 27 6f 72 67 2e 61 70 61 63   ervice0'org.apac
0600   68 65 2e 64 75 62 62 6f 2e 6d 6f 6e 69 74 6f 72   he.dubbo.monitor
0610   2e 4d 6f 6e 69 74 6f 72 53 65 72 76 69 63 65 09   .MonitorService.
0620   69 6e 74 65 72 66 61 63 65 30 27 6f 72 67 2e 61   interface0'org.a
0630   70 61 63 68 65 2e 64 75 62 62 6f 2e 6d 6f 6e 69   pache.dubbo.moni
0640   74 6f 72 2e 4d 6f 6e 69 74 6f 72 53 65 72 76 69   tor.MonitorServi
0650   63 65 07 76 65 72 73 69 6f 6e 05 30 2e 30 2e 30   ce.version.0.0.0
0660   07 74 69 6d 65 6f 75 74 04 31 30 30 30 5a         .timeout.1000Z

@zonghaishang does it work to use the latest version?

v1.12.3 升级一下可以工作,不过这块看着变化比较大,暂时不太确定会不会引入新的问题

旧版本距离太久远了,也不太方便修改,修改了也没办法合并到最新版本。
hessian2中目前已有较多测试用例,可以在 mosn 的测试用例下再验证一下,还是建议升级到新版本。