Skip to content

[Bug] Acknowledge the same message-id causes inconsistency unackedMessages number. #19268

Closed

Description

@mattisonchao

Search before asking

  • I searched in the issues and found nothing similar.

Version

all

Minimal reproduce step

/**
     * This test is used to test the unackedMessage number in the consumer.
     */
    @Test
    public void testDuplicateAcknowledgement() throws PulsarClientException, PulsarAdminException {
        final String topicName = "persistent://public/default/duplicated-acknowledgement-test";
        @Cleanup
        Producer<byte[]> producer = pulsarClient.newProducer()
                .topic(topicName)
                .create();
        @Cleanup
        Consumer<byte[]> consumer1 = pulsarClient.newConsumer()
                .topic(topicName)
                .subscriptionName("sub-1")
                .acknowledgmentGroupTime(0, TimeUnit.SECONDS)
                .subscriptionType(SubscriptionType.Shared)
                .subscribe();
        producer.send("1".getBytes(StandardCharsets.UTF_8));
        Message<byte[]> message = consumer1.receive();
        consumer1.acknowledge(message);
        consumer1.acknowledge(message);
        assertEquals(admin.topics().getStats(topicName).getSubscriptions()
                .get("sub-1").getUnackedMessages(), 0);
    }

What did you expect to see?

unackedMessages=0.

What did you see instead?

unackedMessages=-1.

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added
    type/bug
    on Jan 18, 2023
  2. self-assigned this
    on Jan 18, 2023
  3. removed their assignment
    on Jan 18, 2023
  4. labuladong commented on Jan 28, 2023

    @labuladong
    Contributor

    Assign to me please

  5. github-actions commented on Feb 28, 2023

    @github-actions

    The issue had no activity for 30 days, mark with Stale label.

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

Metadata

Metadata

Assignees

Labels

Stalehelp wantedtype/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions