Skip to content

Bug: Message acknowledgment succeeds without receiving ACK_RESPONSE #49

Description

@danielbackes

Description

The consumer currently sends the ACK command to the broker but does not wait for or validate the corresponding ACK_RESPONSE.

As a result, the client may consider a message successfully acknowledged even when the broker did not process the acknowledgment.

Reproduction scenario

  1. Receive a message from Pulsar.
  2. Stop the Pulsar broker gracefully before acknowledging the message.
  3. Call the consumer acknowledgment method.
  4. The client writes the ACK command but does not verify that the broker returned an ACK_RESPONSE.
  5. The acknowledgment method may complete successfully even though the message was not acknowledged.

In my test, waiting for a response after sending the command exposed broker responses such as CLOSE_CONSUMER.

Actual behavior

The client only writes the acknowledgment command to the socket. A successful socket write confirms that the bytes were accepted by the local socket, but it does not confirm that the Pulsar broker received or processed the acknowledgment.

This can cause the application to log or treat a message as acknowledged while Pulsar still considers it unacknowledged, resulting in message redelivery.

Expected behavior

After sending an ACK command, the client should:

  1. Include a request ID in the command.
  2. Wait for the corresponding ACK_RESPONSE.
  3. Queue any MESSAGE commands received while waiting, so they can be processed later.
  4. Handle unrelated commands, including responding to PING and ignoring PONG.
  5. Handle CLOSE_CONSUMER appropriately.
  6. Match the ACK_RESPONSE using its request ID.
  7. Throw an exception if:
    • the broker rejects the acknowledgment;
    • the connection is closed;
    • no matching response is received before the client’s configured timeout.

The acknowledgment method should only return successfully after the matching ACK_RESPONSE has been received and validated.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions