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

endtoend: fix race when closing vtgate #11707

Merged
merged 3 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdn
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/bndr/gotabulate v1.1.2 h1:yC9izuZEphojb9r+KYL4W9IJKO/ceIO8HDwxMA24U4c=
github.com/bndr/gotabulate v1.1.2/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U=
github.com/buger/jsonparser v0.0.0-20200322175846-f7e751efca13 h1:+qUNY4VRkEH46bLUwxCyUU+iOGJMQBVibAaYzWiwWcg=
github.com/buger/jsonparser v0.0.0-20200322175846-f7e751efca13/go.mod h1:tgcrVJ81GPSF0mz+0nu1Xaz0fazGPrmmJfJtxjbHhUQ=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
5 changes: 4 additions & 1 deletion go/test/endtoend/cluster/topo_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (topo *TopoProcess) SetupEtcd() (err error) {
topo.exit = make(chan error)
go func() {
topo.exit <- topo.proc.Wait()
close(topo.exit)
}()

timeout := time.Now().Add(60 * time.Second)
Expand Down Expand Up @@ -227,6 +228,7 @@ func (topo *TopoProcess) SetupConsul(cluster *LocalProcessCluster) (err error) {
topo.exit = make(chan error)
go func() {
topo.exit <- topo.proc.Wait()
close(topo.exit)
}()

timeout := time.Now().Add(60 * time.Second)
Expand Down Expand Up @@ -289,8 +291,9 @@ func (topo *TopoProcess) TearDown(Cell string, originalVtRoot string, currentRoo

case <-time.After(10 * time.Second):
topo.proc.Process.Kill()
err := <-topo.exit
topo.proc = nil
return <-topo.exit
return err
}
}

Expand Down
11 changes: 10 additions & 1 deletion go/test/endtoend/cluster/vtbackup_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ func (vtbackup *VtbackupProcess) Setup() (err error) {
return
}

vtbackup.exit = make(chan error)
go func() {
if vtbackup.proc != nil {
vtbackup.exit <- vtbackup.proc.Wait()
close(vtbackup.exit)
}
}()

return nil
}

Expand All @@ -111,8 +119,9 @@ func (vtbackup *VtbackupProcess) TearDown() error {

case <-time.After(10 * time.Second):
vtbackup.proc.Process.Kill()
err := <-vtbackup.exit
vtbackup.proc = nil
return <-vtbackup.exit
return err
}
}

Expand Down
4 changes: 3 additions & 1 deletion go/test/endtoend/cluster/vtctld_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error)
vtctld.exit = make(chan error)
go func() {
vtctld.exit <- vtctld.proc.Wait()
close(vtctld.exit)
}()

timeout := time.Now().Add(60 * time.Second)
Expand Down Expand Up @@ -138,8 +139,9 @@ func (vtctld *VtctldProcess) TearDown() error {

case <-time.After(10 * time.Second):
vtctld.proc.Process.Kill()
err := <-vtctld.exit
vtctld.proc = nil
return <-vtctld.exit
return err
}
}

Expand Down
4 changes: 3 additions & 1 deletion go/test/endtoend/cluster/vtgate_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func (vtgate *VtgateProcess) Setup() (err error) {
go func() {
if vtgate.proc != nil {
vtgate.exit <- vtgate.proc.Wait()
close(vtgate.exit)
}
}()

Expand Down Expand Up @@ -236,8 +237,9 @@ func (vtgate *VtgateProcess) TearDown() error {

case <-time.After(30 * time.Second):
vtgate.proc.Process.Kill()
err := <-vtgate.exit
vtgate.proc = nil
return <-vtgate.exit
return err
}
}

Expand Down
6 changes: 4 additions & 2 deletions go/test/endtoend/cluster/vtgr_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func (vtgr *VtgrProcess) Start(alias string) (err error) {
go func() {
if vtgr.proc != nil {
vtgr.exit <- vtgr.proc.Wait()
close(vtgr.exit)
}
}()

Expand All @@ -97,8 +98,9 @@ func (vtgr *VtgrProcess) TearDown() error {
return nil

case <-time.After(10 * time.Second):
_ = vtgr.proc.Process.Kill()
vtgr.proc.Process.Kill()
err := <-vtgr.exit
vtgr.proc = nil
return <-vtgr.exit
return err
}
}
4 changes: 3 additions & 1 deletion go/test/endtoend/cluster/vtorc_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (orc *VTOrcProcess) Setup() (err error) {
go func() {
if orc.proc != nil {
orc.exit <- orc.proc.Wait()
close(orc.exit)
}
}()

Expand All @@ -160,8 +161,9 @@ func (orc *VTOrcProcess) TearDown() error {

case <-time.After(30 * time.Second):
_ = orc.proc.Process.Kill()
err := <-orc.exit
orc.proc = nil
return <-orc.exit
return err
}
}

Expand Down
11 changes: 5 additions & 6 deletions go/test/endtoend/cluster/vttablet_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (vttablet *VttabletProcess) Setup() (err error) {
go func() {
if vttablet.proc != nil {
vttablet.exit <- vttablet.proc.Wait()
close(vttablet.exit)
}
}()

Expand Down Expand Up @@ -399,12 +400,10 @@ func (vttablet *VttabletProcess) TearDownWithTimeout(timeout time.Duration) erro
return nil

case <-time.After(timeout):
proc := vttablet.proc
if proc != nil {
vttablet.proc.Process.Kill()
vttablet.proc = nil
}
return <-vttablet.exit
vttablet.proc.Process.Kill()
err := <-vttablet.exit
vttablet.proc = nil
return err
}
}

Expand Down