Skip to content

Pulsar reader throws exception java.lang.IllegalStateException: recycled multiple times #7384

Description

@ErikJansenIRefact

Describe the bug
A reader is created to read messages from a topic. The reader throws an exception when reader.readNext() is called.

To Reproduce

  1. Messages are created with the attached CsvExample.java program (TPCH line item data is used as CSV file).
  2. A reader is created and run with the attached ReaderExample.java program.
  3. Most of the time the reader throws an exception, although sometimes it doesn't.
  4. This is the output:

Num lines: 1000000
Message id: 71:99:-1:9999
Num lines: 2000000
Message id: 71:200:-1:9520
Exception in thread "main" java.lang.IllegalStateException: recycled multiple times
at org.apache.pulsar.shade.io.netty.util.Recycler$Stack.pop(Recycler.java:553)
at org.apache.pulsar.shade.io.netty.util.Recycler.get(Recycler.java:162)
at org.apache.pulsar.common.util.collections.BitSetRecyclable.create(BitSetRecyclable.java:1200)
at org.apache.pulsar.client.impl.PersistentAcknowledgmentsGroupingTracker.addBatchIndexAcknowledgment(PersistentAcknowledgmentsGroupingTracker.java:138)
at org.apache.pulsar.client.impl.ConsumerImpl.doAcknowledge(ConsumerImpl.java:551)
at org.apache.pulsar.client.impl.ConsumerBase.doAcknowledgeWithTxn(ConsumerBase.java:390)
at org.apache.pulsar.client.impl.ConsumerBase.acknowledgeCumulativeAsync(ConsumerBase.java:379)
at org.apache.pulsar.client.impl.ConsumerBase.acknowledgeCumulativeAsync(ConsumerBase.java:363)
at org.apache.pulsar.client.impl.ConsumerBase.acknowledgeCumulativeAsync(ConsumerBase.java:326)
at org.apache.pulsar.client.impl.ReaderImpl.readNext(ReaderImpl.java:119)
at ReaderExample.main(ReaderExample.java:19)

Expected behavior
The reader to read all messages instead of throwing an exception.
ReaderExample.java.zip
CsvExample.java.zip

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: iOS
  • Pulsar: 2.6.0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions