nicktindall opened a new pull request, #16865: URL: https://github.com/apache/lucene/pull/16865
### Description `SegmentCommitInfo#sizeInBytes` reads the volatile cache to determine if a computation is necessary, then calculates the new value, assigns it before reading the field again to return the computed value. If someone calls `generationAdvanced` while this is going on we have a TOCTOU race. The race can result in 1. The sentinel value being returned from `sizeInBytes` 2. The cache invalidation being undone by the computation. This PR fixes 1 but leaves 2, a stale value can still be returned from the method, but it ensures the value is not the sentinel value. A deterministic regression test is not included because of the difficulty in reliably reproducing the issue. I'm open to the idea of adding a probabilistic test if the maintainers would prefer it? Fixes #16861 -- 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]
