apache / apache/pulsar

Unable to batchreceive message the available permit is going to negative

Open
#12,370 1 comment 1 reaction 0 assignees View on GitHub
lifecycle/stale type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

the current version of pulsar client: 2.7.3
the available permit goes to negative .

consumer = pulsarClient.newConsumer()
.topic("persistent://xx/xxxx/xxx-1ms")
.ackTimeout(60, TimeUnit.SECONDS)
.subscriptionName("vmbTest")
// .subscriptionInitialPosition(SubscriptionInitialPosition.Latest)
.batchReceivePolicy(BatchReceivePolicy.builder()
.maxNumMessages(100)
.maxNumBytes(1024 * 1024)
.timeout(1000, TimeUnit.MILLISECONDS)
.build()).subscriptionType(SubscriptionType.Shared)
.subscribe();

while (consumer.isConnected()) {
Messages batchMessages = consumer.batchReceive();
List messages = StreamSupport
.stream(batchMessages.spliterator(), false)
.map(msg -> String.valueOf(msg.getData()))
.collect(Collectors.toList());

consumer.acknowledge(batchMessages);
}
consumer.close();

} catch (PulsarClientException e) {
if (consumer != null) {
consumer.close();
}
}

When does the available permit increment again

Contributor guide

Open the contributing guide

Research direction

Start with the Java consumer batchReceive() entry point and the BatchReceivePolicy configuration shown in the report. Trace how available permits are consumed and replenished while reproducing the example with Pulsar client 2.7.3. Done means the permit behavior is explained and the reported negative value is either corrected or confirmed as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.