Race conditions
Closed this issue · 1 comments
dpogorzelski commented
Hello, i just found a couple of race conditions, seems like there could be more given that client write and read happens in multiple places so some access synchronization to this data structure would be needed.
Please see below:
WARNING: DATA RACE
Write at 0x00c0002024a0 by goroutine 46:
github.com/yahoo/vssh.(*clientAttr).connect()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/client.go:360 +0x5f7
github.com/yahoo/vssh.(*connect).run()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/client.go:393 +0x20b
github.com/yahoo/vssh.(*VSSH).process.func1()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/vssh.go:223 +0x1f1
Previous read at 0x00c0002024a0 by main goroutine:
github.com/yahoo/vssh.(*VSSH).Wait()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/vssh.go:425 +0xda
Goroutine 46 (running) created at:
github.com/yahoo/vssh.(*VSSH).process()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/vssh.go:216 +0x64
==================
==================
WARNING: DATA RACE
Read at 0x00c000202690 by goroutine 1104:
github.com/yahoo/vssh.(*query).run.func1()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/query.go:74 +0xfd
Previous write at 0x00c000202690 by goroutine 48:
github.com/yahoo/vssh.(*clientAttr).connect()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/client.go:362 +0x69a
github.com/yahoo/vssh.(*connect).run()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/client.go:393 +0x20b
github.com/yahoo/vssh.(*VSSH).process.func1()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/vssh.go:223 +0x1f1
Goroutine 1104 (running) created at:
github.com/yahoo/vssh.(*query).run()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/query.go:63 +0x120
github.com/yahoo/vssh.(*VSSH).process.func1()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/vssh.go:226 +0x27e
Goroutine 48 (running) created at:
github.com/yahoo/vssh.(*VSSH).process()
go/pkg/mod/github.com/yahoo/vssh@v0.0.0-20200715024839-93b738e0a6f1/vssh.go:216 +0x64
mehrdadrad commented
Thanks Dawid! @dawidpogorzelski
I just fixed it!