shangxinxiaolin opened a new issue, #3761:
URL: https://github.com/apache/dubbo-go/issues/3761

   ### What happened?
   
   Bean generic conversion silently replaces repeated references to the same 
non-cyclic object with nil. For example, two address fields that point to the 
same address round-trip with the second field missing. The same issue affects 
slice elements and map values (which entry loses its value depends on map 
iteration order).
   
   ### Reproduction
   
   ```go
   g := generalizer.GetBeanGeneralizer()
   value := 42
   original := []*int{&value, &value}
   encoded, err := g.Generalize(original)
   if err != nil { panic(err) }
   decoded, err := g.Realize(encoded, reflect.TypeOf(original))
   if err != nil { panic(err) }
   fmt.Printf("%#v\n", decoded)
   ```
   
   Expected: both elements contain 42. Actual: the second element is nil.
   
   The `visited` pointer set in `BeanGeneralizer.toDescriptor()` is retained 
for the entire traversal, so a shared object reached through two sibling paths 
is mistaken for an ancestor cycle. Removing the pointer from the set when its 
recursive conversion returns distinguishes sharing from actual cycles.
   
   ### Environment
   
   - Upstream develop: `5cfd927a52a48cb6a673f06b6549133b12b9464e`
   - Go 1.25.5, Windows amd64
   - Three public-API round-trip regression cases (struct fields, slice 
elements, map values) fail before the fix and pass afterwards. Existing 
self-cycle and mutual-cycle tests also pass.
   
   Fix and tests are ready and will be submitted in the linked PR. Reproduction 
exercises conversion only, without a running RPC server.
   


-- 
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