Skip to content

[Bug] POP consumers occasionally wait for the polling timeout despite available messages #11600

Backlog

Description

@f1amingo

Before Creating the Bug Report

  • I found a bug, not just asking a question.
  • I have searched the GitHub Issues and Discussions and believe this is not a duplicate.
  • I have confirmed this bug belongs to the current repository.

Runtime platform environment

macOS, reproduced with broker components and mocked storage/network dependencies.

RocketMQ version

develop, becbe78.

JDK Version

Azul Zulu OpenJDK 8u462.

Describe the Bug

POP consumers can occasionally wait for the long-polling timeout even though a message is already readable. An arrival notification can run after a request checks for messages but before it enters the waiting queue. With no registered waiter, the notification is lost; the existing rest-count check still uses the earlier empty-read result. A subsequent arrival or the timeout sweep wakes the request. The same check-to-registration race exists in ordinary/KV POP, Notification, Lite Notification and Lite POP.

Steps to Reproduce

  1. Invoke the broker processor with pollTime greater than zero and storage initially returning no message; do not start the polling timeout sweep.
  2. Pause the request immediately before its waiting-queue add operation inserts the request.
  3. Make the message readable (or enqueue the Lite event) and invoke the normal arrival notification while the queue still has no waiter.
  4. Release registration and check whether the processor returns the message or a Notification response with hasMsg=true.
  5. For comparison, publish after registration: the existing arrival path wakes the request normally.

What Did You Expect to See?

An arrival between the message check and polling registration should trigger another eligibility check rather than be forgotten.

What Did You See Instead?

The request remains suspended despite the readable message. With no further arrival it waits for the polling timeout. In an initial component reproduction with a 1-second polling timeout, the response arrived roughly 953-977 ms after publication. Deterministic tests against the current develop processors fail without a timeout sweep.

Additional Context

Unlike #8472, this also occurs with an empty queue and no filtering backlog: the message arrives after the empty read, so restNum remains zero. Queue removal/eviction (#11433) and notifications published before storage visibility (#11272) are separate problems.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions