Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(280)

Issue 6930048: state: fix data race in test failure path (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 4 months ago by dave
Modified:
11 years, 4 months ago
Reviewers:
mp+139142
Visibility:
Public.

Description

state: fix data race in test failure path Several tests in the state package fail under the race detector, probably because the race detector slows them down a lot. This proposal fixes a data race that occurs if the test fails. https://code.launchpad.net/~dave-cheney/juju-core/061-state-watcher-fix-race/+merge/139142 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 10

Patch Set 2 : state: fix data race in test failure path #

Patch Set 3 : state: fix data race in test failure path #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -1 line) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/serve.go View 1 1 chunk +1 line, -1 line 0 comments Download
M state/watcher/watcher_test.go View 1 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 13
dave_cheney.net
Please take a look.
11 years, 4 months ago (2012-12-11 05:11:56 UTC) #1
fwereade
LGTM pending explanation https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go File state/watcher/watcher_test.go (right): https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go#newcode381 state/watcher/watcher_test.go:381: defer s.w.Stop() Would you explain a ...
11 years, 4 months ago (2012-12-11 09:29:00 UTC) #2
rog
same as fwereade. https://codereview.appspot.com/6930048/diff/1/state/api/serve.go File state/api/serve.go (right): https://codereview.appspot.com/6930048/diff/1/state/api/serve.go#newcode24 state/api/serve.go:24: // and key (in PEM format) ...
11 years, 4 months ago (2012-12-11 12:18:12 UTC) #3
dave_cheney.net
https://codereview.appspot.com/6930048/diff/1/state/api/serve.go File state/api/serve.go (right): https://codereview.appspot.com/6930048/diff/1/state/api/serve.go#newcode24 state/api/serve.go:24: // and key (in PEM format) for authentication. On ...
11 years, 4 months ago (2012-12-11 12:22:26 UTC) #4
rog
https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go File state/watcher/watcher_test.go (right): https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go#newcode381 state/watcher/watcher_test.go:381: defer s.w.Stop() On 2012/12/11 12:22:27, dfc wrote: > On ...
11 years, 4 months ago (2012-12-11 12:40:00 UTC) #5
rog
https://codereview.appspot.com/6930048/diff/1/state/api/serve.go File state/api/serve.go (right): https://codereview.appspot.com/6930048/diff/1/state/api/serve.go#newcode24 state/api/serve.go:24: // and key (in PEM format) for authentication. On ...
11 years, 4 months ago (2012-12-11 12:42:17 UTC) #6
dave_cheney.net
This a gofmt 1.1 vs 1.0 issue.
11 years, 4 months ago (2012-12-11 12:42:55 UTC) #7
rog
On 2012/12/11 12:42:55, dfc wrote: > This a gofmt 1.1 vs 1.0 issue. i thought ...
11 years, 4 months ago (2012-12-11 14:36:01 UTC) #8
rog
On 2012/12/11 14:36:01, rog wrote: > On 2012/12/11 12:42:55, dfc wrote: > > This a ...
11 years, 4 months ago (2012-12-11 14:36:31 UTC) #9
dave_cheney.net
> > i thought we'd decided to standardise on 1.0.3 gofmt. > > or perhaps ...
11 years, 4 months ago (2012-12-13 05:41:59 UTC) #10
dave_cheney.net
https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go File state/watcher/watcher_test.go (right): https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go#newcode381 state/watcher/watcher_test.go:381: defer s.w.Stop() > sorry, i still don't see the ...
11 years, 4 months ago (2012-12-13 05:42:06 UTC) #11
rog
LGTM with one suggestion. https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go File state/watcher/watcher_test.go (right): https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go#newcode381 state/watcher/watcher_test.go:381: defer s.w.Stop() On 2012/12/13 05:42:06, ...
11 years, 4 months ago (2012-12-13 14:45:22 UTC) #12
dave_cheney.net
11 years, 4 months ago (2012-12-14 07:38:25 UTC) #13
*** Submitted:

state: fix data race in test failure path

Several tests in the state package fail under the race detector, probably
because the race detector slows them down a lot. This proposal fixes a data race
that occurs if the test fails.

R=fwereade, rog
CC=
https://codereview.appspot.com/6930048

https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go
File state/watcher/watcher_test.go (right):

https://codereview.appspot.com/6930048/diff/1/state/watcher/watcher_test.go#n...
state/watcher/watcher_test.go:381: defer s.w.Stop()
On 2012/12/13 14:45:22, rog wrote:
> On 2012/12/13 05:42:06, dfc wrote:
> > > sorry, i still don't see the issue. TearDownTest stops the watcher before
it
> > > calls LoggingSuite.TearDownTest, which is the thing that changes
log.Debug.
> > 
> > The problem, I believe, is like 357 races with TearDownTest. By stopping the
> > watcher, there are no calls to log.Something before the defer runs.
> 
> ah, i hadn't seen line 357 - that makes sense now (i'd assumed it was
something
> to do with LoggingSuite).
> 
> how about putting this defer next to the lines which make it necessary; after
> line 358, for example?

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b