OLD | NEW |
1 Introducing the Go Race Detector | 1 Introducing the Go Race Detector |
2 26 Jun 2013 | 2 26 Jun 2013 |
3 Tags: concurrency, technical | 3 Tags: concurrency, technical |
4 | 4 |
5 Dmitry Vyukov | 5 Dmitry Vyukov |
6 | 6 |
7 Andrew Gerrand | 7 Andrew Gerrand |
8 | 8 |
9 * Introduction | 9 * Introduction |
10 | 10 |
11 [[http://en.wikipedia.org/wiki/Race_condition][Race conditions]] are among the | 11 [[http://en.wikipedia.org/wiki/Race_condition][Race conditions]] are among the |
12 most insidious and elusive programming errors. They typically cause erratic and | 12 most insidious and elusive programming errors. They typically cause erratic and |
13 mysterious failures, often long after the code has been deployed to production. | 13 mysterious failures, often long after the code has been deployed to production. |
14 While Go's concurrency mechanisms make it easy to write clean concurrent code, | 14 While Go's concurrency mechanisms make it easy to write clean concurrent code, |
15 they don't prevent race conditions. Care, diligence, and testing are required. | 15 they don't prevent race conditions. Care, diligence, and testing are required. |
16 And tools can help. | 16 And tools can help. |
17 | 17 |
18 We're happy to announce that Go 1.1 includes a | 18 We're happy to announce that Go 1.1 includes a |
19 [[http://golang.org/doc/articles/race_detector.html][race detector]], | 19 [[http://golang.org/doc/articles/race_detector.html][race detector]], |
20 a new tool for finding race conditions in Go code. | 20 a new tool for finding race conditions in Go code. |
21 It is currently available for Linux, MacOS, and Windows systems | 21 It is currently available for Linux, OS X, and Windows systems |
22 with 64-bit x86 processors. | 22 with 64-bit x86 processors. |
23 | 23 |
24 The race detector is based on the C/C++ | 24 The race detector is based on the C/C++ |
25 [[https://code.google.com/p/thread-sanitizer/][ThreadSanitizer runtime library]]
, | 25 [[https://code.google.com/p/thread-sanitizer/][ThreadSanitizer runtime library]]
, |
26 which has been used to detect many errors in Google's internal code base and in | 26 which has been used to detect many errors in Google's internal code base and in |
27 [[http://www.chromium.org/][Chromium]]. | 27 [[http://www.chromium.org/][Chromium]]. |
28 The technology was integrated with Go in September 2012; since then it has detec
ted | 28 The technology was integrated with Go in September 2012; since then it has detec
ted |
29 [[https://code.google.com/p/go/issues/list?can=1&q=ThreadSanitizer][42 races]] | 29 [[https://code.google.com/p/go/issues/list?can=1&q=ThreadSanitizer][42 races]] |
30 in the standard library. It is now part of our continuous build process, | 30 in the standard library. It is now part of our continuous build process, |
31 where it continues to catch race conditions as they arise. | 31 where it continues to catch race conditions as they arise. |
32 | 32 |
33 * How it works | 33 * How it works |
34 | 34 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 * Conclusions | 239 * Conclusions |
240 | 240 |
241 The race detector is a powerful tool for checking the correctness of concurrent | 241 The race detector is a powerful tool for checking the correctness of concurrent |
242 programs. It will not issue false positives, so take its warnings seriously. | 242 programs. It will not issue false positives, so take its warnings seriously. |
243 But it is only as good as your tests; you must make sure they thoroughly | 243 But it is only as good as your tests; you must make sure they thoroughly |
244 exercise the concurrent properties of your code so that the race detector can | 244 exercise the concurrent properties of your code so that the race detector can |
245 do its job. | 245 do its job. |
246 | 246 |
247 What are you waiting for? Run `"go`test`-race"` on your code today! | 247 What are you waiting for? Run `"go`test`-race"` on your code today! |
OLD | NEW |