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

*: use go-deadlock in race builds #8011

Merged
merged 3 commits into from
Jul 25, 2016
Merged

*: use go-deadlock in race builds #8011

merged 3 commits into from
Jul 25, 2016

Conversation

tamird
Copy link
Contributor

@tamird tamird commented Jul 25, 2016

Fixes #7972.


This change is Reviewable

@sasha-s
Copy link

sasha-s commented Jul 25, 2016

Review status: 0 of 67 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


util/syncutil/mutex_deadlock.go, line 21 [r1] (raw file):

package syncutil

import deadlock "github.com/sasha-s/go-deadlock"

Deadlock is doing os.Exit(2) by default when it sees a potential deadlock.
If that's not what you need, you might want to change deadlock.Opts.OnPotentialDeadlock in init.


Comments from Reviewable

@tamird
Copy link
Contributor Author

tamird commented Jul 25, 2016

Review status: 0 of 67 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


util/syncutil/mutex_deadlock.go, line 21 [r1] (raw file):

Previously, sasha-s wrote…

Deadlock is doing os.Exit(2) by default when it sees a potential deadlock.
If that's not what you need, you might want to change deadlock.Opts.OnPotentialDeadlock in init.

Yeah, I saw. @mberhault any opinions on this? Will affect rho.

Comments from Reviewable

@bdarnell
Copy link
Contributor

Can you put the substantive changes (e.g. gossip.go, and maybe others I haven't found) in a separate commit from the one that does s/sync.Mutex/syncutil.Mutex/g?


Review status: 0 of 67 files reviewed at latest revision, 1 unresolved discussion, some commit checks pending.


Comments from Reviewable

@tamird
Copy link
Contributor Author

tamird commented Jul 25, 2016

@bdarnell done.


Review status: 0 of 67 files reviewed at latest revision, 1 unresolved discussion, some commit checks pending.


Comments from Reviewable

@bdarnell
Copy link
Contributor

LGTM.

Since CI is failing in non-trivial ways and updating this PR is going to be painful, you may want to merge the renaming to use syncutil everywhere without making syncutil use go-deadlock.


Review status: 0 of 67 files reviewed at latest revision, 2 unresolved discussions, some commit checks pending.


build/check-style.sh, line 39 [r6] (raw file):

TestSyncMutex() {
  echo "checking for sync.Mutex usage (use syncutil.Mutex instead)"
  ! git grep -nE 'sync\.Mutex' -- '*.go' | grep -vE '^util/syncutil/mutex_sync\.go\b'

sync\.(RW)?Mutex


util/syncutil/mutex_deadlock.go, line 21 [r1] (raw file):

Previously, tamird (Tamir Duberstein) wrote…

Yeah, I saw. @mberhault any opinions on this? Will affect rho.

I think ideally I'd like this to work like the race detector: log it (and in tests report the test as failed), but don't kill the process. But if that's a pain (and integrating it with the test reporting might be trouble), I'm ok with just killing the process (even on rho).

Comments from Reviewable

@tamird
Copy link
Contributor Author

tamird commented Jul 25, 2016

Review status: 0 of 67 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


build/check-style.sh, line 39 [r6] (raw file):

Previously, bdarnell (Ben Darnell) wrote…

sync\.(RW)?Mutex

Done.

util/syncutil/mutex_deadlock.go, line 21 [r1] (raw file):

Previously, bdarnell (Ben Darnell) wrote…

I think ideally I'd like this to work like the race detector: log it (and in tests report the test as failed), but don't kill the process. But if that's a pain (and integrating it with the test reporting might be trouble), I'm ok with just killing the process (even on rho).

We could piggyback on leaktest in order to get a handle to the `testing.T`, perhaps?

Comments from Reviewable

@mberhault
Copy link
Contributor

Review status: 0 of 67 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


util/syncutil/mutex_deadlock.go, line 21 [r1] (raw file):

Previously, tamird (Tamir Duberstein) wrote…

We could piggyback on leaktest in order to get a handle to the testing.T, perhaps?

I prefer having the option of dying of not (the race detector has that option), but as long as we don't get false positives, I don't mind exits too much.

Comments from Reviewable

@bdarnell
Copy link
Contributor

Review status: 0 of 67 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


util/syncutil/mutex_deadlock.go, line 21 [r1] (raw file):

Previously, mberhault (marc) wrote…

I prefer having the option of dying of not (the race detector has that option), but as long as we don't get false positives, I don't mind exits too much.

You mean have `leaktest` put the `testing.T` in a public global? Eww. What I had in mind with integrating it with test reporting was to parse it out of the logs like go2xunit does for races: https://bitbucket.org/tebeka/go2xunit/src/bca3a606b7abccfdfcab96b2a532becba46dceeb/parsers.go?fileviewer=file-view-default#parsers.go-47

Comments from Reviewable

tamird added 3 commits July 25, 2016 18:00
For now, this is using dummy build tags because using go-deadlock
causes builds to fail in non-trivial ways.
@tamird
Copy link
Contributor Author

tamird commented Jul 25, 2016

Review status: 0 of 67 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


util/syncutil/mutex_deadlock.go, line 21 [r1] (raw file):

Previously, bdarnell (Ben Darnell) wrote…

You mean have leaktest put the testing.T in a public global? Eww. What I had in mind with integrating it with test reporting was to parse it out of the logs like go2xunit does for races: https://bitbucket.org/tebeka/go2xunit/src/bca3a606b7abccfdfcab96b2a532becba46dceeb/parsers.go?fileviewer=file-view-default#parsers.go-47

Ew indeed.

Well, I guess I'll leave it as-is for now, especially since we're not going to use go-deadlock for now.


Comments from Reviewable

@tamird tamird merged commit deadd6c into cockroachdb:master Jul 25, 2016
@tamird tamird deleted the gossip-deadlock branch July 25, 2016 22:23
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

Successfully merging this pull request may close these issues.

4 participants