-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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 goroutine leak in server/etcdserver/raft_test.go #14286
Conversation
3a81b22
to
90bb7ac
Compare
Codecov Report
@@ Coverage Diff @@
## main #14286 +/- ##
==========================================
- Coverage 75.69% 75.30% -0.39%
==========================================
Files 456 456
Lines 37036 37036
==========================================
- Hits 28035 27891 -144
- Misses 7273 7389 +116
- Partials 1728 1756 +28
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
server/etcdserver/raft_test.go
Outdated
@@ -171,6 +171,7 @@ func TestStopRaftWhenWaitingForApplyDone(t *testing.T) { | |||
select { | |||
case <-srv.r.applyc: | |||
case <-time.After(time.Second): | |||
srv.r.stop() |
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.
The srv.r.stop()
may be blocked. I would suggest to follow the same way as line 178 ~ 183, which can be wrapped in a function.
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.
Done.
Signed-off-by: VladSaioc <[email protected]>
90bb7ac
to
6cded3d
Compare
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.
LGTM
Thank you @VladSaioc
package: etcdserver
Potential for goroutine leak in TestStopRaftWhenWaitingForApplyDone. Timeout case will lead raft node goroutine to block at a select statement. Stopping raft node before calling
t.Fatalf
will unblock the select and terminate the child goroutine.