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

Fixed potential buffered channel block #744

Closed
wants to merge 1 commit into from

Conversation

jojohappy
Copy link
Member

@jojohappy jojohappy commented Jan 16, 2019

Signed-off-by: jojohappy sarahdj0917@gmail.com

Changes

I found a potential bug that would block the buffered channel and the for loop. I also think it is the root cause of CI timeout. I tried to make a change to fix, not sure the changes are correct, but tests would be fine without store timeout.

PTAL @bwplotka @domgreen Thanks!

Verification

To run make test locally and it will be passed.

Signed-off-by: jojohappy <sarahdj0917@gmail.com>
@bwplotka
Copy link
Member

Thanks for diving into this, some questions though:

  1. What CI test you exactly have in mind?
  2. Can you explain where is the race you are trying to fix here? I guess you mean respCh here, right?
    I don't thing moving startStreamSeriesSet outside of loop changes anything. When you look closely startStreamSeriesSet will never block whathever happens with channel. It schedules just one go routine, but I might be wrong here (:

bwplotka added a commit that referenced this pull request Jan 16, 2019
This fixes potential race condition. Bit more efficient version of #744

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
bwplotka added a commit that referenced this pull request Jan 16, 2019
This fixes potential race condition. Bit more efficient version of #744

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Actually, you are totally right here! Totally missed that streamSeriesSet writes to same channel as well!

In fact we even have regression test that.. you need to be unlucky/lucky to get get this bug caught.
This is good, but I proposed more fixes to this code and more consistent flow. There were other problems as well: #745

What do you think?

Anyway thanks for highlighting the problem!

@jojohappy
Copy link
Member Author

@bwplotka That's my pleasure. Totally agree with you. I will close this PR and review yours.

@jojohappy jojohappy closed this Jan 17, 2019
@jojohappy jojohappy deleted the fix_series_data_race branch January 17, 2019 02:24
bwplotka added a commit that referenced this pull request Jan 17, 2019
This fixes potential race condition. Bit more efficient version of #744

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
bwplotka added a commit that referenced this pull request Jan 17, 2019
This fixes potential race condition. Bit more efficient version of #744

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
bwplotka added a commit that referenced this pull request Jan 21, 2019
…#745)

This fixes potential race condition. Bit more efficient version of #744

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
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.

2 participants