srv9989 opened a new pull request, #24008: URL: https://github.com/apache/kafka/pull/24008
Summary This PR addresses KAFKA-21374, where global state store reads can receive incorrect record headers from the global processing thread. While investigating the issue, I found that the global processor context retains headers from the record being processed. Since the same context is used by the global state store, other threads can receive unrelated headers during serialization and deserialization. This can cause problems for applications that depend on record headers for deserialization. Changes Made * Updated GlobalProcessorContextImpl to allow the owning global thread to access its record headers, while returning empty contextual headers for reads from other threads. * Updated GlobalStateUpdateTask to clear the record context after processing, including when an exception occurs. * Added regression tests to cover header leakage during normal processing and concurrent global store reads. * Added tests to verify thread ownership and record context cleanup. Testing I first reproduced the issue with a failing regression test and confirmed that the deserializer was receiving headers from an unrelated global record. After applying the fix, I ran the relevant Kafka Streams tests. * 323 selected tests passed. * Sequential and concurrent regression tests passed. * Both at-least-once and exactly-once test scenarios passed. * Checkstyle passed. * Spotless passed. * SpotBugs passed. * git diff --check passed. The concurrent scenario was tested using TopologyTestDriver with controlled thread synchronization. I have not run a separate real-broker concurrency integration test. JIRA: https://issues.apache.org/jira/browse/KAFKA-21374 -- 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]
