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

May be this tool has some data race problem #26

Open
wgffgw opened this issue May 25, 2018 · 2 comments
Open

May be this tool has some data race problem #26

wgffgw opened this issue May 25, 2018 · 2 comments

Comments

@wgffgw
Copy link

wgffgw commented May 25, 2018

When I build my project using "go build -race" with this tool, after shutdown the process by "Ctrl+C", I found any data race warning, like below :
WARNING: DATA RACE
Read at 0x00c420374de0 by goroutine 15:
github.com/jpillora/overseer.(*master).handleSignal()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:135 +0x115
github.com/jpillora/overseer.(*master).setupSignalling.func1()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:113 +0xa1

Previous write at 0x00c420374de0 by main goroutine:
github.com/jpillora/overseer.(*master).fork()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:350 +0x18f
github.com/jpillora/overseer.(*master).forkLoop()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:339 +0x38
github.com/jpillora/overseer.(*master).run()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:65 +0x172
github.com/jpillora/overseer.runErr()
/home/work/gowork/src/github.com/jpillora/overseer/overseer.go:162 +0x27f
github.com/jpillora/overseer.Run()
/home/work/gowork/src/github.com/jpillora/overseer/overseer.go:99 +0x9d
main.main_overseer()
/home/work/gowork/src/go-entry/main/main.go:59 +0x128
main.main()
/home/work/gowork/src/go-entry/main/main.go:49 +0x358

Goroutine 15 (running) created at:
github.com/jpillora/overseer.(*master).setupSignalling()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:115 +0x161
github.com/jpillora/overseer.(*master).run()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:56 +0xfb
github.com/jpillora/overseer.runErr()
/home/work/gowork/src/github.com/jpillora/overseer/overseer.go:162 +0x27f
github.com/jpillora/overseer.Run()
/home/work/gowork/src/github.com/jpillora/overseer/overseer.go:99 +0x9d
main.main_overseer()
/home/work/gowork/src/go-entry/main/main.go:59 +0x128
main.main()
/home/work/gowork/src/go-entry/main/main.go:49 +0x358

==================
WARNING: DATA RACE
Read at 0x00c4203a20a0 by goroutine 15:
github.com/jpillora/overseer.(*master).handleSignal()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:135 +0x2e2
github.com/jpillora/overseer.(*master).setupSignalling.func1()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:113 +0xa1

Previous write at 0x00c4203a20a0 by main goroutine:
os/exec.Command()
/home/work/soft/go/src/os/exec/exec.go:133 +0x15b
github.com/jpillora/overseer.(*master).fork()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:347 +0x162
github.com/jpillora/overseer.(*master).forkLoop()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:339 +0x38
github.com/jpillora/overseer.(*master).run()
/home/work/gowork/src/github.com/jpillora/overseer/proc_master.go:65 +0x172
github.com/jpillora/overseer.runErr()
/home/work/gowork/src/github.com/jpillora/overseer/overseer.go:162 +0x27f
github.com/jpillora/overseer.Run()
/home/work/gowork/src/github.com/jpillora/overseer/overseer.go:99 +0x9d
main.main_overseer()
/home/work/gowork/src/go-entry/main/main.go:59 +0x128
main.main()
/home/work/gowork/src/go-entry/main/main.go:49 +0x358

@lookfirst
Copy link
Contributor

Interesting, since handleSignal is called in a goroutine, any access to mp properties should probably be mutex locked on the master struct. In practice, this probably isn't a huge deal, but could be cleaned up for sure. @jpillora, what do you think?

@jpillora
Copy link
Owner

Yeah true, though signals occur very infrequently so would be a very rare crash. PR 😁?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants