GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Bug] Subscription consumption stuck on consumer reconnect · Issue #21199 · apache/pulsar

[Bug] Subscription consumption stuck on consumer reconnect #21199

New issue
Copy link
New issue
Copy link
Closed
#23352
Closed
[Bug] Subscription consumption stuck on consumer reconnect#21199
#23352
Copy link
Labels
type/bugThe PR fixed a bug or issue reported a bug

Description

@ghost
ghost
opened on Sep 18, 2023

Search before asking

  • I searched in the issues and found nothing similar.

Version

Pulsar broker: 2.8.4
Java Pulsar client: 2.8.4

Minimal reproduce step

Non-partitioned topic. Batching is disabled on both producer and consumer. No acknowledge timeout. 5 subscriptions, each has 12 consumers.

One consumer of one subscription fails to process a message and doesn't ack it.
On a fail, I give the consumer a minute more to try to process other messages and ack them, if they are processed successfully. After a minute, I recreate the consumer and try to reprocess the messages, which would help if the error was transient.

What did you expect to see?

I expected to see the subscription backlog consumed further by the consumer with 1 failed message and by the other 11 consumers.

What did you see instead?

If a consumer fails to process one message, processing of all other messages with other keys is also stalled.
Including the other 11 consumers of the subscription.
All the other subscriptions and their consumers of the topic continue processing as expected.

As a symptom, I see the stuck subscription has "waitingReadOp" : false and "subscriptionHavePendingRead" : false, while the other subscription has these fields at true.

stats.txt
stats-internal.txt

Anything else?

The message rate is about 50 messages per second. The same scenario with a few (1-2-5) messages per minute works as expected. So, I believe there might be some race condition.

Are you willing to submit a PR?

  • I'm willing to submit a PR!
Reacted by eric-rakuten

Activity

  1. ghost added
    type/bugThe PR fixed a bug or issue reported a bug
    on Sep 18, 2023
  2. Technoboy- commented on Sep 19, 2023

    @Technoboy-
    Technoboy-
    on Sep 19, 2023
    Contributor
    More actions

    image
    I see there have many unack msg, and the owner broker dump file is also needed

  3. ethqunzhong commented on Oct 20, 2023

    @ethqunzhong
    ethqunzhong
    on Oct 20, 2023
    Contributor
    More actions

    Can normal consumption be restored after unload or restart owner broker ?

  4. lhotari
    changed the title [-][Bug] Subscription consumption stuck on [/-] [+][Bug] Subscription consumption stuck on consumer reconnect[/+] on Aug 21, 2024
  5. lhotari commented on Aug 21, 2024

    @lhotari
    lhotari
    on Aug 21, 2024
    Member
    More actions

    @equanz @codelipenghui Do you think that PIP-282 changes in #21406 21953 address this issue?

    Reacted by Yuri Mizushima
  6. equanz commented on Aug 21, 2024

    @equanz
    equanz
    on Aug 21, 2024
    Contributor
    More actions

    Do you think that PIP-282 changes in #21953 address this issue?

    I think not.

    In #21199 (comment) case:
    After reconnecting, the consumer will be put in the recentlyJoinedConsumers with the lastSentPosition (maybe message 2). So the consumer can receive messages <= message 2.
    #21953

    pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java

    Lines 484 to 499 in 66e1a06

    if (readType == ReadType.Replay) {
    Position minLastSentPositionForRecentJoinedConsumer = recentlyJoinedConsumers.values().iterator().next();
    if (minLastSentPositionForRecentJoinedConsumer != null
    && minLastSentPositionForRecentJoinedConsumer.compareTo(maxLastSentPosition) < 0) {
    maxLastSentPosition = minLastSentPositionForRecentJoinedConsumer;
    }
    }
    // Here, the consumer is one that has recently joined, so we can only send messages that were
    // published before it has joined.
    for (int i = 0; i < maxMessages; i++) {
    if ((entries.get(i)).compareTo(maxLastSentPosition) > 0) {
    // We have already crossed the divider line. All messages in the list are now
    // newer than what we can currently dispatch to this consumer
    return i;
    }
    }

    I cannot conclude that this behavior is incorrect(Isn't this one of feature to preserve ordering?).

    Reacted by Lari Hotari
  7. lhotari commented on Sep 7, 2024

    @lhotari
    lhotari
    on Sep 7, 2024
    Member
    More actions

    It seems that this issue might be addressed together with PIP-282 changes #21953 and other PRs #23226 (merged) and #23231 (in-progress).
    A remaining challenge is the lost acknowledgements issue that I'll follow-up later, that is reported as #22709, but it doesn't yet contain much analysis. #23261 is related. Lost acknowledgements will also cause problems and that issue needs to be resolved as well.

  8. lhotari commented on Sep 14, 2024

    @lhotari
    lhotari
    on Sep 14, 2024
    Member
    More actions

    I've created PIP-379: Key_Shared Draining Hashes for Improved Message Ordering as a proposal to address such issues.

  9. lhotari
    added this to Apache Pulsar / Key_Shared and Acknowledgement reliability and usability improvementson Sep 16, 2024
  10. lhotari
    closed this as completedin #23352on Oct 8, 2024
  11. github-project-automation
    moved this from In Progress to Done in Apache Pulsar / Key_Shared and Acknowledgement reliability and usability improvementson Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type

    Projects

    • Apache Pulsar / Key_Shared and Acknowledgement reliability and usability improvements
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.