goutamadwant opened a new pull request, #16369:
URL: https://github.com/apache/dubbo/pull/16369

   ## What is the purpose of the change?
   
   Fixes #16368.
   
   Fastjson2 JSONB deserialization can lose nested fields when multiple threads 
deserialize the same `$ref`-heavy payload for the same target class at the same 
time. In the failing case, shared lists referenced by multiple child objects 
can become `null` after concurrent deserialization.
   
   This change routes both `FastJson2ObjectInput#readObject` overloads through 
a shared helper and synchronizes the fastjson2 parse per requested target 
class. The lock is backed by `ClassValue`, so it does not retain application 
classes or classloaders, and unrelated DTO classes can still deserialize 
concurrently.
   
   The regression test serializes an object graph with shared nested lists, 
verifies a single read succeeds, then repeatedly deserializes the same payload 
from 200 threads while clearing fastjson2 reader caches between rounds. Without 
the fix, the test reports a non-zero count of null nested fields.
   
   Tests:
   
   - Focused repro: 
`FastJson2SerializationTest#testConcurrentReadObjectWithReferences`
   - Targeted slice: `FastJson2SerializationTest,TypeMatchTest`
   - Surefire result: 807 tests, 0 failures, 0 errors, 0 skipped
   
   ## Checklist
   
   - [x] Make sure there is a 
[GitHub_issue](https://github.com/apache/dubbo/issues) field for the change.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Write necessary unit-test to verify your logic correction.
   - [x] Make sure GitHub actions can pass.


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