Skip to content

Conversation

@mingyen066
Copy link
Collaborator

@mingyen066 mingyen066 commented Oct 22, 2025

This patch implements
KIP-1205
to address concurrency issues (NPE) related to the lazy initialization
of RecordHeader fields.

The added test verified that concurrent access to RecordHeader.key()
and RecordHeader.value() no longer throws NullPointerException

@github-actions github-actions bot added triage PRs from the community clients small Small PRs labels Oct 22, 2025
@chia7712
Copy link
Member

@mingyen066 please update the upgrade.html as well

@github-actions github-actions bot removed the triage PRs from the community label Oct 23, 2025
ByteBuffer.wrap("value".getBytes(StandardCharsets.UTF_8))
);

ExecutorService pool = Executors.newFixedThreadPool(threads);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we could leverage CompletableFuture

        CountDownLatch startLatch = new CountDownLatch(1);
        var fs = IntStream.range(0, threads).mapToObj(__ -> CompletableFuture.supplyAsync(() -> {
            try {
                startLatch.await();
                header.key();
                header.value();
                return null;
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        })).collect(Collectors.toUnmodifiableList());
        startLatch.countDown();
        fs.forEach(CompletableFuture::join);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more thing: could you please add similar unit test for null value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants