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

*: fix goroutine leak in ddl intergration test #30369

Merged
merged 2 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions cmd/ddltest/ddl_serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ func createDDLSuite(t *testing.T) (s *ddlSuite) {
require.NoError(t, err)
ddl.RunWorker = false
session.ResetStoreForWithTiKVTest(s.store)
s.dom.Close()
Copy link
Member

Choose a reason for hiding this comment

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

Is this introduced by #28423?

Copy link
Collaborator Author

@lcwangchao lcwangchao Dec 3, 2021

Choose a reason for hiding this comment

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

Yes or no ... The goroutine leaks already happens before #28423 . But it did fails after it because it is when gorotuine leaks check was enabled

require.NoError(t, s.store.Close())

s.store, err = store.New(fmt.Sprintf("tikv://%s%s", *etcd, *tikvPath))
require.NoError(t, err)
s.s, err = session.CreateSession(s.store)
require.NoError(t, err)
s.dom, err = session.BootstrapSession(s.store)
Expand Down Expand Up @@ -235,8 +240,14 @@ func (s *ddlSuite) stopServers() error {
defer s.m.Unlock()

for i := 0; i < len(s.procs); i++ {
if s.procs[i] != nil {
err := s.killServer(s.procs[i].Process)
if proc := s.procs[i]; proc != nil {
if proc.db != nil {
if err := proc.db.Close(); err != nil {
return err
}
}

err := s.killServer(proc.Process)
if err != nil {
return errors.Trace(err)
}
Expand Down
8 changes: 7 additions & 1 deletion cmd/ddltest/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ func TestMain(m *testing.M) {
fmt.Fprint(os.Stderr, err.Error())
os.Exit(1)
}
goleak.VerifyTestMain(m)
opts := []goleak.Option{
goleak.IgnoreTopFunction("go.etcd.io/etcd/pkg/logutil.(*MergeLogger).outputLoop"),
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"),
goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"),
}
goleak.VerifyTestMain(m, opts...)
}