You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zonghaishang (GitHub)" <gi...@apache.org> on 2020/03/09 13:34:02 UTC

[GitHub] [dubbo-go-hessian2] zonghaishang opened issue #163: 支持解码dubbo服务调用attachment

### 背景

在service mesh场景中,使用hessian-go作为序列化框架,需要解析dubbo请求body中的attachment(里面包含group)。因为attachment在body中方法参数字节后面,所以需要先解析dubbo请求中的参数类型和参数值,然后才能去解析到attachemt。


**What happened**:

目前发现解析attachment之前,先解析方法的参数类型和参数值报错了。类似参数类型解析不到go对应的类型:`can not find go type name com.raycloud.notify.api.domain.StopNotifyJob in registry`.

因为请求的参数类型,是java应用发到service mesh的,因此service mesh无法提前注册`StopNotifyJob`类型,并且也无法知道它的类型。 

**What you expected to happen**:

类似java的hessian序列化行为,如果反序列化类型找不到(比如是class类型),可以降级为hashmap(对应golang里面的map或者sync.Map). 这样参数解析完之后,也能解析到attachment。

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

这个是真实线上java(dubbo 2.4.9)调用mesh的二进制字节流:

```
	bytes := []byte{
		///**0000**/0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x0a, 0x58, 0x0a, 0x04, 0x06, 0x01, 0x00, 0x00, 0x08, 0x00,
		///**0010**/0x45, 0x00, 0x02, 0x3f, 0x4a, 0x68, 0x40, 0x00, 0x3f, 0x06, 0x68, 0x77, 0xc0, 0xa8, 0xb5, 0xe6,
		///**0020**/0x0a, 0x04, 0x06, 0x47, 0xa5, 0xae, 0x78, 0x50, 0x83, 0x85, 0xf3, 0x81, 0xef, 0xf7, 0xd1, 0x21,
		///**0030**/0x80, 0x18, 0x00, 0xe5, 0xbd, 0x80, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x3f, 0x3d, 0x72, 0x74,
		/**0040**//*0x12, 0x16, 0x03, 0x56, */0xda, 0xbb, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c,
		/**0050**/0x00, 0x00, 0x01, 0xfb, 0x05, 0x32, 0x2e, 0x36, 0x2e, 0x32, 0x30, 0x30, 0x63, 0x6f, 0x6d, 0x2e,
		/**0060**/0x72, 0x61, 0x79, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e,
		/**0070**/0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4e, 0x6f, 0x74, 0x69,
		/**0080**/0x66, 0x79, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x0e, 0x32, 0x2e, 0x30,
		/**0090**/0x2e, 0x31, 0x2d, 0x76, 0x70, 0x63, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x0d, 0x73, 0x74, 0x6f, 0x70,
		/**00a0**/0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4a, 0x6f, 0x62, 0x30, 0x2e, 0x4c, 0x63, 0x6f, 0x6d, 0x2f,
		/**00b0**/0x72, 0x61, 0x79, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2f,
		/**00c0**/0x61, 0x70, 0x69, 0x2f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x53, 0x74, 0x6f, 0x70, 0x4e,
		/**00d0**/0x6f, 0x74, 0x69, 0x66, 0x79, 0x4a, 0x6f, 0x62, 0x3b, 0x43, 0x30, 0x2c, 0x63, 0x6f, 0x6d, 0x2e,
		/**00e0**/0x72, 0x61, 0x79, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e,
		/**00f0**/0x61, 0x70, 0x69, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x4e,
		/**0100**/0x6f, 0x74, 0x69, 0x66, 0x79, 0x4a, 0x6f, 0x62, 0x98, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
		/**0110**/0x06, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x04, 0x6e, 0x69, 0x63, 0x6b, 0x04, 0x74, 0x79, 0x70,
		/**0120**/0x65, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x06, 0x61, 0x70, 0x70,
		/**0130**/0x4b, 0x65, 0x79, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x08, 0x74, 0x61, 0x6f, 0x62, 0x61, 0x6f,
		/**0140**/0x49, 0x64, 0x60, 0x01, 0x31, 0x01, 0x31, 0x01, 0x31, 0x01, 0x31, 0x01, 0x31, 0x01, 0x31, 0x91,
		/**0150**/0xe1, 0x48, 0x05, 0x61, 0x2e, 0x73, 0x2e, 0x75, 0x0a, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x74,
		/**0160**/0x65, 0x73, 0x74, 0x05, 0x61, 0x2e, 0x73, 0x2e, 0x74, 0x10, 0x35, 0x33, 0x35, 0x36, 0x32, 0x35,
		/**0170**/0x38, 0x38, 0x39, 0x38, 0x37, 0x37, 0x31, 0x33, 0x31, 0x34, 0x05, 0x61, 0x2e, 0x73, 0x2e, 0x64,
		/**0180**/0x10, 0x6b, 0x65, 0x66, 0x75, 0x2e, 0x6b, 0x75, 0x61, 0x69, 0x6d, 0x61, 0x69, 0x2e, 0x63, 0x6f,
		/**0190**/0x6d, 0x04, 0x70, 0x61, 0x74, 0x68, 0x30, 0x30, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x61, 0x79, 0x63,
		/**01a0**/0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x2e,
		/**01b0**/0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4a, 0x6f,
		/**01c0**/0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x41, 0x70,
		/**01d0**/0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x14, 0x63, 0x6f, 0x6d, 0x2d, 0x72, 0x61,
		/**01e0**/0x79, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2d, 0x78, 0x09, 0x69,
		/**01f0**/0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x30, 0x30, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x61,
		/**0200**/0x79, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x61, 0x70,
		/**0210**/0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79,
		/**0220**/0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69,
		/**0230**/0x6f, 0x6e, 0x0e, 0x32, 0x2e, 0x30, 0x2e, 0x31, 0x2d, 0x76, 0x70, 0x63, 0x2d, 0x74, 0x65, 0x73,
		/**0240**/0x74, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x04, 0x35, 0x30, 0x30, 0x30, 0x5a,

	}
```


**Anything else we need to know?**:


[ Full content available at: https://github.com/apache/dubbo-go-hessian2/issues/163 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo-go-hessian2] zonghaishang commented on issue #163: 支持解码dubbo服务调用attachment

Posted by "zonghaishang (GitHub)" <gi...@apache.org>.
项目依赖hessian2的基线:

  digest = "1:f4be968368b6c78a68a439d7ef71c782b7036d185925e4dd1d2d6e773dcc59c3"
  name = "github.com/apache/dubbo-go-hessian2"
  packages = [
    ".",
    "java_exception",
  ]
  pruneopts = "UT"
  revision = "0ef010e9ccf4fea50b122e43ba2c0ba62a260fcb"
  version = "v1.3.0"

[ Full content available at: https://github.com/apache/dubbo-go-hessian2/issues/163 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org