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

runtime/race: detect when program synchronizes with time.Sleep #6689

Closed
dvyukov opened this issue Oct 30, 2013 · 4 comments
Closed

runtime/race: detect when program synchronizes with time.Sleep #6689

dvyukov opened this issue Oct 30, 2013 · 4 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Oct 30, 2013

There is a common pattern of "synchronization":

var result ...
go func() {
  ...
  result = ...
}()
time.Sleep(time.Second)  // 1 second should be enough for everyone
if bad(result) {
  complain()
}

C++ ThreadSanitizer prints a useful "As if synchronized via sleep" message
with a stack trace of the sleep:
http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/sleep_sync.cc?view=markup

It would be useful to do the same for Go.
@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 1:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 2:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added repo-main.

@dvyukov
Copy link
Member Author

dvyukov commented Feb 26, 2018

This is a very old proactive improvement request, nobody ever asked for it and there are no active plans to implement this, so closing.

@dvyukov dvyukov closed this as completed Feb 26, 2018
@golang golang locked and limited conversation to collaborators Feb 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants