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 877]Fix send stuck #878

Closed
wants to merge 2 commits into from
Closed

Conversation

billowqiu
Copy link
Contributor

Fixes #877

Motivation

Use select to avoid channel stuck.

Modifications

  • like consumer.Receive func, use for...select idiom.

@Gleiphir2769
Copy link
Contributor

Gleiphir2769 commented Oct 31, 2022

Hi, could you upload the full error stack? I think we need to find out the real reason for doneCh can not be closed. Because doneCh is never closed means that the callback of sendRequest is not be called. This shouldn't happen.

@billowqiu
Copy link
Contributor Author

Hi, could you upload the full error stack? I think we need to find out the real reason for doneCh can not be closed. Because doneCh is never closed means that the callback of sendRequest is not be called. This shouldn't happen.

In the issue link have the stack. I think wait in a channel should with select timeout context to avoid stuck.

@Gleiphir2769
Copy link
Contributor

Gleiphir2769 commented Nov 1, 2022

In the issue link have the stack. I think wait in a channel should with select timeout context to avoid stuck.

You are right, timeout context can avoid doneCh stuck. It's reasonable to use select here.

But send() stuck shouldn't happen. I think add select just skip this problem. I will create a new pr to find out why callback is not be called.

pulsar/producer_partition.go Outdated Show resolved Hide resolved
isDone.Store(true)
return msgID, ctx.Err()
case <-doneCh:
return msgID, err
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't return msgID and err here. They are not assigned here.

RobertIndie pushed a commit that referenced this pull request Jul 11, 2023
…ng as expected (#1053)

Fixes #877 

### Motivation

The original PR is #878. Because the original author @billowqiu has not continued to reply to the review comments for a long time, resubmit the fix here.

### Modifications

- Add select for ctx and doneCh in partitionProducer.Send()

---------

Co-authored-by: shenjiaqi.2769 <shenjiaqi.2769@bytedance.com>
@RobertIndie
Copy link
Member

Fixed by #1053

RobertIndie pushed a commit that referenced this pull request Sep 7, 2023
…ng as expected (#1053)

Fixes #877

### Motivation

The original PR is #878. Because the original author @billowqiu has not continued to reply to the review comments for a long time, resubmit the fix here.

### Modifications

- Add select for ctx and doneCh in partitionProducer.Send()

---------

Co-authored-by: shenjiaqi.2769 <shenjiaqi.2769@bytedance.com>
(cherry picked from commit be35740)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

partitionProducer Send stuck
3 participants