KIP-1205 — Improve RecordHeader to be Thread-Safe
Accepted Kafka 4.2 ProtocolClient
Makes RecordHeader thread-safe by using double-checked locking and volatile fields during lazy initialization of the value byte array. Lazy initialization introduced in KAFKA-10438 caused NullPointerException when multiple threads performed concurrent read-only access to ConsumerRecord headers, leading to three reported concurrency bugs.
Details
| Author | Ming-Yen Chung |
| Status | Accepted |
| Kafka Version | 4.2 |
| JIRA | KAFKA-12999 |
| Wiki | View on Apache Wiki |
| Created | 2025-08-18 |
| Last Modified | 2025-11-02 |
Explore how this KIP affects the Kafka protocol in the Protocol Explorer, or see the full KIP database.