Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#4569][pulsar-client] C++ client producer sendAsync() method will be blocked forever, if enough batched messages sent timeout. (#4569) #4657

Merged
merged 1 commit into from
Jul 3, 2019

Conversation

easyfan
Copy link
Contributor

@easyfan easyfan commented Jul 2, 2019

Fixes #4569

Motivation

*Root cause: a simple mistake in pulsar/pulsar-client-cpp/lib/ProducerImpl.cc:

The reserved spots for all individual messages in a batch message (just reserved, not occupied by pushing in) did not be released in the case of batching message sent failure (sent timeout or any other failure cases), which was processed by ProducerImpl::failPendingMessages(...)*

Modifications

When dealing any failure message, if the current message is a batch one, we should also release the reserved spots in the pendingMessageQueue_, for all individual messages inside this batch message.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as pulsar/pulsar-client-cpp/tests/ProducerTest.cc.

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: no)

Documentation

  • Does this pull request introduce a new feature? (no)

@merlimat merlimat added this to the 2.4.1 milestone Jul 2, 2019
@merlimat merlimat added the type/bug The PR fixed a bug or issue reported a bug label Jul 2, 2019
Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch on this one!

I think this originates from the fact that pendingMessagesQueue_.clear() does not indeed reset the reserver spots counter

@merlimat
Copy link
Contributor

merlimat commented Jul 2, 2019

run cpp tests

1 similar comment
@merlimat
Copy link
Contributor

merlimat commented Jul 3, 2019

run cpp tests

@merlimat merlimat merged commit 2f68615 into apache:master Jul 3, 2019
@easyfan
Copy link
Contributor Author

easyfan commented Jul 4, 2019

@merlimat Already merged? So what happened to the CI blocker?

@merlimat
Copy link
Contributor

merlimat commented Jul 4, 2019

Master branch was fixed yesterday. When CI runs, it attempts to do a clean merge with master, so the fix was automatically picked up just by retesting.

jiazhai pushed a commit that referenced this pull request Aug 28, 2019
…ough batched messages sent timeout. (#4569) (#4657)

(cherry picked from commit 2f68615)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C++ client producer sendAsync() method will be blocked forever, if enough batched messages sent timeout.
2 participants