zhangxffff opened a new pull request, #13813: URL: https://github.com/apache/gluten/pull/13813
## What changes are proposed in this pull request? Fixes #13811. #12370 moved responsibility for closing shuffle streams from `ShuffleStreamReader.nextStream()` to native consumers so that Velox GPU shuffle readers could consume multiple streams concurrently. The Bolt reader introduced in #12454 consumes streams sequentially, but it fetched the next block before closing the exhausted stream. Spark releases the fetcher's current block when a stream closes. Once the fetcher has advanced to block B, closing the stream for block A can release B's buffer. Reading B can then fail with `IllegalReferenceCountException: refCnt: 0`, as observed in TPC-DS Q6 and Q10. This patch resets the Bolt deserializer at end of stream, closing block A while it is still the fetcher's current block. ## How was this patch tested? Added `BoltShuffleReaderTest.closesCurrentStreamBeforeFetchingNext`. It writes two local shuffle files with `BoltShuffleWriter`, reads both through the Bolt shuffle reader, and verifies the values. It also checks that the first stream is closed before the second file is fetched and that the second stream is closed before the fetcher reports end of input. The regression test failed on unpatched main and passed 25 consecutive runs with the fix. The full TPC-DS suite was not rerun. ## Was this patch authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex (GPT-6) -- 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]
