-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
tikvclient: fix a bug that double close channels. #10991
tikvclient: fix a bug that double close channels. #10991
Conversation
Signed-off-by: qupeng <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add an unit test
@zz-jason I guess you didn't read the initial comment. Unit tests can't work for these cases because we need some real TiKV services to run tikvclient code. Currently we test tikvclient.go in 2 schrodinger test cases, we can add more cases there instead of here. |
you can use faketikv seem we also need to care client-go , @disksing |
almost lgtm, but have some question.. can we do not call it seems when so it will trigger retry or http2Client#closeStream(will write error to recvBuffer), so it seems ..... but maybe do it in both side will more safe |
@lysu I think don't depend gRPC's internal behaviors is better. So let's call |
Codecov Report
@@ Coverage Diff @@
## master #10991 +/- ##
================================================
- Coverage 81.5977% 81.1269% -0.4709%
================================================
Files 420 420
Lines 90902 89466 -1436
================================================
- Hits 74174 72581 -1593
- Misses 11421 11630 +209
+ Partials 5307 5255 -52 |
Please fix CI @hicqu |
…nto fix-tikvclient-double-close
/run-all-tests |
/run-all-tests |
…nto hicqu/fix-tikvclient-double-close
/run-all-tests |
Signed-off-by: qupeng [email protected]
What problem does this PR solve?
There is a bug in tikvclient module about double closing channels, which causes some threads panic when holding a lock. Although these threads can recover, they will be blocked on that lock so they can't work finally.
What is changed and how it works?
This PR fixed the channel double closing problem, and use
defer
to make the lock logic more clear.Check List
Tests
Related changes