You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/13 11:59:53 UTC

[GitHub] [dubbo-go] 63isOK opened a new issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

63isOK opened a new issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454


   <!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
   
   -->
   
   
   **What happened**:
   go中不同包有同名数据结构注册,注册的java 路径不一样. 客户端调用服务端后,在解析服务端返回的数据时,会因为类型冲突导致报错,类似:
   err=reflect.Set: value of type record_interface.Result is not assignable to record_interface.Result
   **What you expected to happen**:
   解析不出现异常
   **How to reproduce it (as minimally and precisely as possible)**:
   不同package里的数据结构本就是隔离的,不应该因为同名就导致解析失败
   **Anything else we need to know?**:
   h2,dubbo-go v3,dubbo协议


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] ChangedenCZD commented on issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
ChangedenCZD commented on issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454#issuecomment-918781466


   有demo可以重现吗


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] ChangedenCZD commented on issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
ChangedenCZD commented on issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454#issuecomment-920506247


   **解决方案**
   hessian.RegisterPOJO时支持同JavaClass不同go struct(包路径不同)
   
   **有关改动**
   dubbo-go/protocol/dubbo/impl/hessian.go
   - 反序列化响应体时需传入对应函数的返回值,用于推断对应的go struct
   - 若不传入函数的返回值,则使用首次通过hessian.RegisterPOJO注册的JavaClass对应的go struct(与旧逻辑一致)
   
   dubbo-go-hessian2
   - 改动较大
   - 需要从hessian.RegisterPOJO开始支持同JavaClass不同go struct(包路径不同)
   - 有关调用了getStructInfo、getStructDefByIndex的地方都需要改动


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] ChangedenCZD removed a comment on issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
ChangedenCZD removed a comment on issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454#issuecomment-918746986


   有相关demo吗


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] wongoo commented on issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454#issuecomment-920624833


   @63isOK 实际案例是什么情况? java调用go吗? 是一个java对象不同业务场景需要解析为不同的go结构吗? 为何不定义一个go结构体即可?


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] ChangedenCZD commented on issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
ChangedenCZD commented on issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454#issuecomment-918746986


   有相关demo吗


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] ChangedenCZD edited a comment on issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
ChangedenCZD edited a comment on issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454#issuecomment-922169925


   @wongoo 不同JavaName的触发条件
   ![image](https://user-images.githubusercontent.com/9605663/133870736-8de92267-cb15-425f-9499-bbe7e55a09f5.png)
   
   ![1631934824165_670CBFB7-7009-45a5-AACA-7401D0F9F5E5](https://user-images.githubusercontent.com/9605663/133870696-58b6f1c6-7307-4a90-ac9c-ed07f25d3fd9.png)
   
   javaName入参是org.apache.dubbo.User,pojoRegistrt.j2g[javaName]返回的goName存在同名的情况,导致pojoRegistry.registry[g]获取了最后注册的那个同名struct
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] AlexStocks closed issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
AlexStocks closed issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454


   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] ChangedenCZD commented on issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
ChangedenCZD commented on issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454#issuecomment-922169925


   @wongoo 具体触发条件
   ![image](https://user-images.githubusercontent.com/9605663/133870736-8de92267-cb15-425f-9499-bbe7e55a09f5.png)
   
   ![1631934824165_670CBFB7-7009-45a5-AACA-7401D0F9F5E5](https://user-images.githubusercontent.com/9605663/133870696-58b6f1c6-7307-4a90-ac9c-ed07f25d3fd9.png)
   
   javaName入参是org.apache.dubbo.User,pojoRegistrt.j2g[javaName]返回的goName存在同名的情况,导致pojoRegistry.registry[g]获取了最后注册的那个同名struct
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] ChangedenCZD commented on issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
ChangedenCZD commented on issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454#issuecomment-920691942


   > @63isOK 实际案例是什么情况? java调用go吗? 是一个java对象不同业务场景需要解析为不同的go结构吗? 为何不定义一个go结构体即可?
   
   我按他描述做了个demo,能够复现


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] ChangedenCZD removed a comment on issue #1454: go中不同package里的数据结构,不应该因为同名而引起异常

Posted by GitBox <gi...@apache.org>.
ChangedenCZD removed a comment on issue #1454:
URL: https://github.com/apache/dubbo-go/issues/1454#issuecomment-918781466


   有demo可以重现吗


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org