Redpanda ListOffsets
can return incorrect results when producing records using franz-go
#25769
Labels
kind/bug
Something isn't working
Version & Environment
Redpanda version: (use
rpk version
):rpk version: v25.1.1
Git ref: c3547f4
Build date: 2025-04-04T23:45:58Z
OS/Arch: linux/arm64
Go version: go1.23.1
Redpanda Cluster
node-0 v25.1.1 - c3547f4
Operating System: OSX Sequoia 15.3.2 (24D81)
github.com/twmb/[email protected]
github.com/twmb/franz-go/pkg/[email protected]
github.com/twmb/franz-go/pkg/[email protected]
colima version 0.8.1
Docker info:
What went wrong?
Please start a Redpanda container like so:
$ docker run --rm -it --name=source -p 8081:8081 -p 9092:9092 -p 9644:9644 redpandadata/redpanda redpanda start --node-id 0 --mode dev-container --set "rpk.additional_start_flags=[--reactor-backend=epoll]" --set redpanda.auto_create_topics_enabled=true --kafka-addr 0.0.0.0:9092 --advertise-kafka-addr host.docker.internal:9092 --schema-registry-addr 0.0.0.0:8081
After that, please run the following code:
You should see the following output:
`rpk topic consume foobar -o ':end' -X brokers=localhost:9092` output:
Note how the record timestamps are in ascending order.
What should have happened instead?
Try uncommenting line 57 (
time.Sleep(250 * time.Millisecond)
) so there is a pause between each emitted message. You should now get the following output (please recreate the container first):From the
kgo.Client.Produce
docs:This seems to break if the records are produced in parallel since
ListOffsetsAfterMilli
returns offsets which contain timestamps that are older than the one supplied as input.When using a Kafka container, even without the sleep,
ListOffsetsAfterMilli
will return the expected offsets.Docker Compose for running Kafka:
How to reproduce the issue?
See above.
Additional information
I tested that the records are compressed:
If I change
kgo.ProducerBatchCompression(kgo.SnappyCompression())
tokgo.ProducerBatchCompression(kgo.NoCompression())
, the issue goes away.JIRA Link: CORE-9778
The text was updated successfully, but these errors were encountered: