CarolDestiny opened a new pull request, #43:
URL: https://github.com/apache/dubbo-net/pull/43

   ### Description
   
   Fixes #9
   
   Legitimate large Hessian2 responses could exceed the fixed normalization 
budgets, and JSON output could normalize an already checked response again. 
This change allows large responses, including a 150,000-element long list, 
while retaining limits on reference expansion.
   
   Each response shares a budget across its value/exception and attachments:
   
   - Expanded nodes: min(2,000,000, max(100,000, 2 × response body bytes)).
   - Conservative JSON bytes: min(64 MiB, max(32 MiB, 8 × response body bytes)).
   
   The node cap remains an independent limit: a response below the 8 MiB 
payload limit can still be rejected. The JSON budget estimates output cost and 
is not a managed-heap memory limit.
   
   #### Changes by file
   
   | File | Changes | Reason |
   | --- | --- | --- |
   | DubboService/Native/NativeDubboCodec.cs | Add BaseNormalizedNodes, 
BaseNormalizedJsonBytes and the two per-payload multipliers; update the 
absolute caps; initialize NormalizationBudget from the response body length. | 
Allow larger legitimate responses while retaining a shared, bounded expansion 
allowance. |
   | DubboService/Native/NativeDubboCodec.cs — accounting and output | Refine 
StringBytes() for UTF-8 and JSON escapes, add IntegerBytes() overloads, account 
for null/Boolean values, and cache the last string's estimated size by object 
identity. Add the internal SerializeResponseJson() method and document its 
precondition. | Reduce false rejections and repeated scanning. Every occurrence 
is still charged; ordinary decoded responses avoid a second normalization pass, 
while events retain the checked path. |
   | DubboService/NativeDubboActuatorSuite.cs | Use SerializeResponseJson() for 
decoded values and Provider exceptions. | Preserve the per-response budget 
decision through final JSON output and retain existing failure handling. |
   | Tests/UnitTestForDubboNet/HessianResponseSafetyTest.cs | Add normal 
large-list, shared-string, Unicode/escape, unpaired-surrogate, integer-boundary 
and compact-scalar regressions. Update shared-budget and exact-node-boundary 
fixtures. | Verify legitimate data passes and DAG, repeated-scalar and boundary 
protections remain effective. |
   | Tests/UnitTestForDubboNet/NativeDubboActuatorSuiteTest.cs | Add seven 
loopback TCP tests through public SendQuery(): large lists/strings, Provider 
exceptions, protocol errors, circular events, and normal/event reference 
amplification. | Cover the complete response-to-result path without external 
registries or Providers. |
   | README.md and readme_cn.md | Document the dynamic formulas, absolute caps, 
shared accounting and estimate semantics. | Make the English and Chinese limits 
match the implementation. |
   
   #### Validation
   
   - Release solution restore and build passed.
   - All 584 unit tests passed, including 64 response-safety cases and seven 
SendQuery loopback cases.
   - Ran dotnet format on all changed C# files; the subsequent 
--verify-no-changes check passed.
   - git diff --check passed.
   - New tests include the Apache license header.
   
   Docker/container checks and the real Java Provider end-to-end suite were not 
run locally because Docker is unavailable. The existing CI workflows cover 
those checks.
   
   ### Checklist
   
   - [x] I confirm the target branch is `main`
   - [x] I have run `dotnet format` to format my code
   - [x] I have run `dotnet test` to run local tests
   - [x] I have added tests that prove my fix is effective or that my feature 
works
   


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