robocanic commented on PR #1639:
URL: https://github.com/apache/dubbo-admin/pull/1639#issuecomment-7073637337

   在 `0a54879` 上复测后,同一份 proto 中定义的 `Any` 载荷已经能正常编解码。还剩一个会影响正常调用的场景:载荷类型定义在独立的 
proto 文件里,服务端反射能按名称查到它,但服务 proto 没有直接或间接导入它。这是合法用法,因为声明 `google.protobuf.Any` 
字段只需要导入 `any.proto`。
   
   我把现有测试里的 `fixture.Payload` 移到单独的 `payload.proto`,保留它在服务端反射注册表中的注册,得到两个结果:
   
   - 请求的 `Any` 携带 `fixture.Payload` 时,Admin 返回 `InvalidArgument`,provider 收到 0 
次业务调用。
   - 响应的 `Any` 携带同一类型时,provider 已成功执行 1 次,Admin 随后返回 `IDL response encoding 
failed`。对有副作用的方法,用户看到失败后重试,可能导致业务重复执行。
   
   原因是 `dynamicpb.NewTypes(files)` 目前只包含服务描述符及其导入的文件。建议请求解码和响应编码共用一个支持按需查询的 
resolver:本地找不到类型时,从 `Any` 的 type URL 取出 Protobuf 全名,通过现有反射连接发起 
`FileContainingSymbol` 
查询,补齐该类型及其依赖后继续编解码。补查沿用现有超时和描述符数量、大小限制。可以把上述独立文件场景加进回归测试,并在响应侧同时断言 Admin 
成功返回、provider 只执行一次。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to