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

[Issue 527] fix send goroutine blocked #530

Merged
merged 3 commits into from
Jul 19, 2021

Conversation

jiangbo9510
Copy link
Contributor

@jiangbo9510 jiangbo9510 commented Jun 1, 2021

Fix Issue: #527

Motivation

I add a function to compare and poll block queue in atomic. To fix poll a wrong item in failTimeoutMessages()

Modifications

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

  • 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)

Documentation

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

@jiangbo9510 jiangbo9510 changed the title [Issue 527] the pull request Title [Issue 527] fix send goroutine blocked Jun 1, 2021
@@ -490,21 +490,36 @@ func (p *partitionProducer) failTimeoutMessages() {

// iterate at most viewSize items
for i := 0; i < viewSize; i++ {
item := p.pendingQueue.Poll()
tickerNeedWaiting := time.Duration(0)
item := p.pendingQueue.CompareAndPoll(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be used to refactor the pendingQueue.Peek() at line 464

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should also be used to refactor the pendingQueue.Peek() at line 464

@merlimat There is not necessarily. pendingQueue.Peek()` at line 464 is to check the first item of queue whether timeout. It not modify the queue.

Choose a reason for hiding this comment

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

the bug reason is peek head item and determine if it timeout, and then get a snapshot of pendingQueue, range snapshot and poll all the items in snapshot even if it is not all timeout.
the pendingQueue.Peek() at line 464 just peek(not poll) the head item in queue and check(logically correct), there are no actual operation to pendingQueue, so it looks like no need to refactor

@wolfstudy wolfstudy added this to the 0.6.0 milestone Jun 2, 2021
@jiangbo9510
Copy link
Contributor Author

@wolfstudy When this pull request merge to the master branch?

@jiangbo9510
Copy link
Contributor Author

@merlimat please review my code and merge this pull request to master branch.

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

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

LGTM +1

@wolfstudy
Copy link
Member

cc / @cckellogg @merlimat PTAL

@wolfstudy
Copy link
Member

@jiangbo9510 Please merger master code for failed action CI

@jiangbo9510
Copy link
Contributor Author

jiangbo9510 commented Jul 6, 2021

@jiangbo9510 Please merger master code for failed action CI

@wolfstudy
What does this mean?
Should I merge master to my branch?

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

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

@jiangbo9510 This change may not really solve the problem

@wolfstudy
Copy link
Member

@jiangbo9510 #565

@jiangbo9510
Copy link
Contributor Author

jiangbo9510 commented Jul 14, 2021

@jiangbo9510 #565

@wolfstudy It's anothor problem. If it occured,All send goroutins will blocked by the dead lock.

In my case, Sometimes some send goroutins blocked. and others goroutins can send message successful.

@wolfstudy wolfstudy merged commit 179060f into apache:master Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants