anton-vinogradov commented on PR #13262:
URL: https://github.com/apache/ignite/pull/13262#issuecomment-4802285642

   I pushed a minimal alternative targeted at this branch: 
https://github.com/EgorBaranovEnjoysTyping/ignite/pull/1
   
   The root cause is a one-method omission: `SBLimitedLength` overrides every 
append `a(...)` but none of the insert `i(...)` methods, so the identity-hash 
insert in `handleRecursion()` (`buf.i(pos, hash)`) bypasses `onWrite()` / the 
lazy tail allocation. The insert can push the head past the limit while `tail` 
is still `null`, and the next append then NPEs on a null tail — the exact stack 
trace from the ticket.
   
   The alternative overrides `SBLimitedLength.i(int, String)` (~16 lines) to 
route inserts through the same overflow accounting as `a(...)`, and reverts the 
`tostring` package to the master baseline. It also adds a deterministic 
regression test that sweeps payload sizes across the `HEAD_LEN` boundary: it 
reproduces the NPE without the fix (pad ≈ 7978–7980) and passes with it. 
`GridToStringBuilderSelfTest` is green (20 tests).
   
   My reasoning for preferring a localized fix over the node-tree rewrite is in 
the inline review comments above (marker/recover changing the `toString` 
contract, the `Thread`-keyed static map vs the leak-free `ThreadLocal`, and 
`toString` becoming able to throw). If you merge that PR into this branch, it 
replaces the current approach here.
   


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

Reply via email to